I'm using angular 2 CLI for my web project, and I wrote a lot of unit tests, as my code base grows larger, the tests become more and more heavier. I was wondering if it's possible to test only certain part of the spec
files I specified ?
Asked
Active
Viewed 1,062 times
1

Matt Downey
- 363
- 6
- 18
2 Answers
2
You can manually turn off tests or just run specific tests, with the following syntax.
If you prefix "describe" blocks with an f, only that will run:
fdescribe()
If you prefix "it" blocks with an f, only that will run:
fit()
You can also prefix with an 'x' to not run a block: xit() and xdescribe()
1
There is test.ts
file
// Then we find all the tests.
const context = require.context('./', true, /\.spec\.ts$/);
If i want to test only pipes i can write:
const context = require.context('./', true, /pipe\.spec\.ts$/);

yurzui
- 205,937
- 32
- 433
- 399