更新至 Angular v15。运行时ng test
我收到以下错误:
\xe2\xa0\x8b Generating browser application bundles (phase: setup)...node:internal/process/promises:288\n triggerUncaughtException(err, true /* fromPromise */);\n ^\n\nAssertionError [ERR_ASSERTION]: Compilation cannot be undefined.\n at webpackOptions.entry (D:\\wqems\\WqEMS-portal\\wqems-portal\\node_modules\\@angular-devkit\\build-angular\\src\\webpack\\plugins\\styles-webpack-plugin.js:58:46)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {\n generatedMessage: false,\n code: 'ERR_ASSERTION',\n actual: undefined,\n expected: true,\n operator: '=='\n}\n\nNode.js v18.12.1\n
Run Code Online (Sandbox Code Playgroud)\n任何有关出现问题的帮助将不胜感激。
\n该错误是由于测试时找不到样式文件造成的。在“test.styles”下的 angular.json 文件中,必须调整 *.(s)css 的路径,以便它们有效。
例如:
“样式”:[“src/styles/global.css”]
到
“样式”:[“src/styles/global.scss”]
在升级 Angular 14 -> 15 后,我也遇到了这个错误,但仅限于我的四个子项目之一。事实证明,这个单一子项目没有任何业力测试(不再),因此方法findTests()
没有@angular-devkit
找到任何匹配**/*.spec.ts
,并引发了这个误导性错误。
就我而言,我通过简单地添加一个虚拟测试用例来修复它,因为我想保留工作测试链供以后使用。
归档时间: |
|
查看次数: |
4090 次 |
最近记录: |