After using angular-cli to create a new project (ng new my-project-name
), I ran npm run test
successfully without any issues.
To display font icons in my project, I added the Font Awesome module from https://www.npmjs.com/package/angular-font-awesome.
In my HTML file, I included the
<fa name="bars"></fa>
tag and received the expected output. However, upon running npm run test
again, I encountered 3 failures related to the fa
tag.
One of the failure reports looked like this:
'fa' is not a known element:
1. If 'fa' is an Angular component, then verify that it is part of this module.
2. To allow any element add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. ("--The content below is only a placeholder and can be replaced.-->
<div style="text-align:center"> [ERROR ->]<fa name="bars"></fa>
<h1> Welcome to {{title}}!
"): ng:///DynamicTestModule/AppComponent.html@2:2 Error: Template parse errors:
at syntaxError home/harsha/Documents/Projects/testProject/node_modules/@angular/compiler/esm5/compiler.js:466:22)
I attempted solutions like adding NO_ERRORS_SCHEMA
and CUSTOM_ELEMENTS_SCHEMA
in the app.module.ts
file, but none of them resolved the issue.
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
AngularFontAwesomeModule
],
providers: [],
bootstrap: [AppComponent],
schemas: [
CUSTOM_ELEMENTS_SCHEMA,
NO_ERRORS_SCHEMA
]
})`
Unfortunately, these fixes did not work as expected.