Ric*_*ard 5 karma-runner angular
当未导入/声明子组件时,我们在测试中看到错误,但测试并未失败。随着时间的推移,这导致这些测试已添加到代码库中。

我们希望确保这些实际上破坏了测试,以便我们可以防止它们被提交。
有什么办法可以让这个测试失败吗?
如何重现:
child(以及导出组件)child在应用程序模块中导入模块<app-child></app-child>app.component.htmlng run build/start工作正常,但是ng run test抛出:
ERROR: 'NG0304: 'app-child' is not a known element:
1. If 'app-child' is an Angular component, then verify that it is part of this module.
2. If 'app-child' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.'
Chrome Headless 88.0.4324.150 (Mac OS 11.2.1): Executed 1 of 2 SUCCESS (0 secs / 0.028 secs)
ERROR: 'NG0304: 'app-child' is not a known element:
1. If 'app-child' is an Angular component, then verify that it is part of this module.
Chrome Headless 88.0.4324.150 (Mac OS 11.2.1): Executed 2 of 2 SUCCESS (0.051 secs / 0.037 secs)
TOTAL: 2 SUCCESS
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
412 次 |
| 最近记录: |