I want to import certain modules for all testing suits such as ngrx Store, ngx translate or httpClientModule in an [email protected] project with angular 5.
in the generated test.ts I have added a test.configureTestingModule
const testBed: TestBed = getTestBed();
testBed.initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting()
);
testBed.configureTestingModule({
imports: [
HttpClientModule,
StoreModule.forRoot(reducers, { metaReducers }),
TranslateModule.forRoot({
loader: {
provide: TranslateLoader,
useFactory: (createTranslateLoader),
deps: [HttpClient]
}
}),
]
}
Still in a user.servive.spec.ts it says no provider for Store.
user.service.spec.ts
describe('UserService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
providers: [UserService]
});
});
it('should be created', inject([UserService], (service: UserService) => {
expect(service).toBeTruthy();
}));
});
Does the Test.configureTestingModule in user.service.spec "overwrite" the one from test.ts?
If so, how can I configure the TestBed on a global level to avoid importing repetitive modules?
Thanks!