feat(@angular/cli): option to build and run only specified spec files #12955
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A new
--specoption is added. It is a glob/pattern that specifies which specs should be included in the build.e.g.
ng test --spec=app/services/auth*(.spec.tsis added automatically if missing)When karma is already running, selected spec can be updated by running
ng test --spec=app/login* --spec-updateWith such option it is also trivial to add custom vscode task to be able to run currently open spec file.
Behind the scenes a new
test.generated.ts(could be temp?) is saved next to originaltest.tswhich instead of usingrequire.contextimports all matching files. This gives quite a big boost in the project at work (at least 10s on each iterative build!)Fixes #3603
Motivation: It is a pain in a big application to wait until entire app is rebuilt just to run single
fitblock. Takes almost a minute with 4000+ tests and barely works when code coverage is enabled.Missing: docs(?) and tests
Disclaimer: this is quick and dirty solution that can be improved a lot but some feedback before making it nice would be great!