更新至 Angular v15。跑步时ng test
我收到以下错误:
⠋ Generating browser application bundles (phase: setup)...node:internal/process/promises:288
triggerUncaughtException(err, true /* fromPromise */);
^
AssertionError [ERR_ASSERTION]: Compilation cannot be undefined.
at webpackOptions.entry (D:\wqems\WqEMS-portal\wqems-portal\node_modules\@angular-devkit\build-angular\src\webpack\plugins\styles-webpack-plugin.js:58:46)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
generatedMessage: false,
code: 'ERR_ASSERTION',
actual: undefined,
expected: true,
operator: '=='
}
Node.js v18.12.1
任何有关出现问题的帮助将不胜感激。
该错误是由于测试时找不到样式文件造成的。在“test.styles”下的 angular.json 文件中,必须调整 *.(s)css 的路径,以便它们有效。
e.g.:
“样式”:[“src/styles/global.css”]
to
“样式”:[“src/styles/global.scss”]
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)