Skip to content

Conversation

@FDIM
Copy link
Contributor

@FDIM FDIM commented Nov 13, 2018

A new --spec option 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.ts is added automatically if missing)

When karma is already running, selected spec can be updated by running ng test --spec=app/login* --spec-update

With 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 original test.ts which instead of using require.context imports 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 fit block. 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!

@FDIM FDIM force-pushed the feature/running-selected-specs branch from 980c262 to 7ea9e7c Compare November 13, 2018 22:43
@FDIM FDIM force-pushed the feature/running-selected-specs branch from 7ea9e7c to 21d9f42 Compare November 19, 2018 22:27
@FDIM FDIM force-pushed the feature/running-selected-specs branch from 21d9f42 to 52fc9e9 Compare November 19, 2018 22:34
@ngbot
Copy link

ngbot bot commented Dec 6, 2018

Hi @FDIM! This PR has merge conflicts due to recent upstream merges.
Please help to unblock it by resolving these conflicts. Thanks!

@mgechev
Copy link
Member

mgechev commented Dec 20, 2018

@FDIM would you add e2e tests for the feature?

@mgechev
Copy link
Member

mgechev commented Jan 11, 2019

Closing it due to inactivity. Please reopen if you come back to it.

@mgechev mgechev closed this Jan 11, 2019
@FDIM
Copy link
Contributor Author

FDIM commented Jan 12, 2019

@mgechev I've updated the branch - refactored it a bit, added tests and I think it's ready for review

Edit: looks like I can't reopen the PR - will create new one

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Run A Single Unit Test

4 participants