首页 > 解决方案 > 找出在 Karma 测试期间哪个 Angular 组件发出错误

问题描述

在运行我的 Karma 测试时,我收到很多错误(实际上是警告),如下所示:

ERROR: 'NG0304: 'fa-icon' is not a known element:
1. If 'fa-icon' is an Angular component, then verify that it is part of this module.
2. If 'fa-icon' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.'

现在,一旦您知道哪个组件抱怨未知元素,这很容易解决。问题是应用程序有几十个,而 Karma 的输出没有提供任何关于问题出在哪里的线索。

如何找出导致错误的组件,而不需要有选择地对每个组件运行测试?

标签: angularkarma-runner

解决方案


推荐阅读