Is there anyway to run ng test with a different test entry-point to the one specified in .angular-cli.json?
https://github.com/angular/angular-cli/issues/8579#issuecomment-346313383 provides a solution for increasing rebuild times by using lazy loaded chunks. But I fear that breaking up the tests into chunks might cause some tests to be missed.
Ideally i would have two files:
test.ts, test.tmp.ts
with test.ts containing:
const context = require.context('./', true, /\.spec\.ts$/);
while test.tmp.ts has:
const context = require.context('./app/some_module/', true, /\.spec\.ts$/);
This way, while developing, I can run something like ng test --entry-point=test.tmp.ts. Ideally test.tmp.ts will be git.ignored.
At the moment, its possible to call ng test --config=different_karma.conf.js to specify a different karma.conf.js, and within karma.conf.js you can change the reference to test.ts within that. However, this doesn't successfully run the tests, unless I change the apps.0.test entry point in angular-cli.json to test.tmp.ts.
The error I get is:
Uncaught SyntaxError: Unexpected string at src/test.tmp.ts:3
One solution is to create another app within .angular-cli.json which is a copy of the first with a different entry point, and call ng test -app but then you have to maintain two different app configs.
I can change test.ts directly each time, but its possible that might get committed.
Edit: https://stackoverflow.com/a/43669082/5464931 makes it seem like changing angular-cli.json was not neccessary, but I can't seem to get that to work.