Reputation: 51
I have a fairly large Angular8 app I'm running unit test for, i would like the ng test command to run the test for only all spec.ts files within a specified/desired module and not for all spec.ts files in the entire codebase. I tried specifying the module name in the test.ts file path but it throws module not found error in terminal, but specifying a specific component name in the test.ts file runs the test for the single component but doesn't work for module. Thanks
Upvotes: 1
Views: 11116
Reputation: 163
src/app/test.ts
.const context = require.context('<MODULE_PATH>', true, /.spec\.ts$/);
Upvotes: 2
Reputation: 8948
If you're using a newer version of Angular, you might use the --include
as stated here and here
But if you're using Jasmine you can just add the letter "f" to your describe
as so - fdescribe()
.
Or use it on the test itself - fit()
That way you "focus" on just one test or test suite and run only that.
Upvotes: 3