Hi,
I constantly get exceptions in my unit tests, if the component uses ion-radio:
ERROR: TypeError: config.get is not a function
TypeError: config.get is not a function
at addEventListener (http://localhost:9877/_karma_webpack_/webpack:/node_modules/@ionic/core/dist/esm/helpers-dd7e4b7b.js:49:1)
at Radio.connectedCallback (http://localhost:9877/_karma_webpack_/webpack:/node_modules/@ionic/core/dist/esm/ion-radio_2.entry.js:64:23)
at safeCall (http://localhost:9877/_karma_webpack_/webpack:/node_modules/@ionic/core/dist/esm/index-7a8b7a1c.js:1262:1)
The strange thing is, that these exceptions occur as soon as there is more than one test in a spec.ts file, but even if these tests are empty:
describe('SampleTest', () => {
let component: MySampleComponent;
let fixture: ComponentFixture<MySampleComponent>;
beforeEach(async () => {
TestBed.configureTestingModule({
declarations: [MySampleComponent],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [
CommonModule,
FormsModule,
ReactiveFormsModule,
RouterModule.forRoot([], { relativeLinkResolution: 'legacy' }),
TranslateModule.forRoot({
activeLang: 'en'
}),
RouterTestingModule.withRoutes([]),
IonicModule.forRoot()
]
}).compileComponents().catch(error => fail(error));
fixture = TestBed.createComponent(InAppPreferencesComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should run A', () => {
});
it('should run B', () => {
});
});
If I remove the detectChanges, no error is thrown.
Any idea what’s going wrong here, or how to solve it?
1 post - 1 participant