`ng g config` to generate `test.ts`
Command
test
Description
It is possible to generate the karma.conf.js file but not to generate the test.ts file.
This file can be really useful to add things like custom matchers.
Describe the solution you'd like
Something like ng g config test that would re-add the test.ts file to the project, allowing to customize it.
I have a WIP PR to add this if the team is OK.
Describe alternatives you've considered
You can manually add the file if you know how it should look.
Or maybe we could have an extra field in the karma builder like 'setup', to just specify a file that would add the custom matchers.
Hi @cexbrayat,
What would you like to customize in the test.ts?
as I mentioned in the issue, it can be useful to add custom Jasmine matchers to all tests, for example:
beforeEach(() => {
jasmine.addMatchers(customMatchers);
});
I'll add another use case: in the upcoming zoneless experiment, it will be handy to add provideExperimentalZonelessChangeDetection() into initTestBed. A way to add test.ts back into the project would simplify that.