Recently I upgraded my application to Angular 17
this error is only happening when I issue test command
ng test
Application build and execution works properly and it went to production everything is fine there, only in jasmine testing I am blocked, is anyone faced similar issue let me know the fix
Angular 17.0.0 code
describe('TestComponent', () => {
let component: TestComponent;
let fixture: ComponentFixture<TestComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ TestComponent ],
imports: [
CommonModule,
BrowserModule,
AppModule
]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(HeaderComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
Error coming from
at reportUnknownPropertyError (http://localhost:9876/_karma_webpack_/webpack:/node_modules/@angular/core/fesm2022/core.mjs:9036:15)
I fixed the issue by duplicating the module code
app.module.tstoapp.module.spec.tsand introduce
schemasection withCUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMAas belowand use this new module in jasmine code