I am looking for a way to share the TestBed between different files in Angular spec files. I understand, that I can always write a simple util class to do so, but am not sure if that is the correct way.
For example, if I have:
parent.module.ts ---> imports other modules and has providers
- one.component.ts
- two.component.ts
- three.component.ts
Now when writing the spec files for the above components, I need to set the TestBed
configuration in each of them. Which is almost the contents of the parent.module.ts
for its declarations, imports, providers etc.
This seems like a lot of repetition of code considering a parent module with lots of child components. Like I said above, I can always extract the TestBed.configureTestingModule
into a separate file. But I am not sure if it is the correct way.
Also what should be the location of the file and I hope it will not be a part of my release bundle.