-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Make .only sticky in watch mode #621
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Note that if you edit a file without exclusive tests, AVA will report |
lib/watcher.js
Outdated
| }); | ||
| }; | ||
|
|
||
| Watcher.prototype.updateExlusivity = function (file, hasExclusive) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exlusivity -> exclusivity
|
PR looks good @novemberborn, but I feel like we really have to come up with a replacement for |
api.js
Outdated
| }; | ||
|
|
||
| Api.prototype.run = function (files) { | ||
| Api.prototype.run = function (files, forceHasExclusive) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the second argument would be better as an optional options object with an option called forceHasExclusive.
http://ariya.ofilabs.com/2011/08/hall-of-api-shame-boolean-trap.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. Opted for runOnlyExclusive which is the same as the option passed to the runner.
English is weird 😉
|
|
Pushed fixups for the feedback. Some of the changes were slightly more involved so would like feedback before squashing 😄 |
Can you show an example on when this would happen exactly? More helpful messages are always welcome. |
Imagine you have two test files: Maybe it should report It'd also help if I added debug output so you can see the tests are being run in exclusive mode. |
Agreed. Mind opening issues for this? Can be follow-up improvements. |
Sure. Anything else on this PR? I'm tracking down the intermittent CI failure but that's not related to this PR. |
|
Looks good. Land it ;) |
A second argument can be passed to Api#run(). If true the tests will be run in exclusive mode, regardless of whether exclusive tests are detected. The Api now remits the 'stats' event from the forks. The watcher keeps track of exclusive tests. If all test files that contained exclusive tests need to be rerun it runs them without forcing exclusive mode. This means the exclusivity is determined by the tests themselves. If a test file, containing exclusive tests, is not one of the files being rerun, it forces exclusive mode. This ensures only exclusive tests are run in the changed files, making .only sticky. If all test files that contained exclusive tests are removed, sticky mode is disabled. The same happens if there are no more exclusive tests after a run. Fixes #593.
ac097ee to
b4abee1
Compare
Make .only sticky in watch mode
Fixes #593.
The watcher keeps track of exclusive tests. If all test files that contained exclusive tests need to be rerun it runs them without forcing exclusive mode. This means the exclusivity is determined by the tests themselves.
If a test file, containing exclusive tests, is not one of the files being rerun, it forces exclusive mode. This ensures only exclusive tests are run in the changed files, making .only sticky.
If all test files that contained exclusive tests are removed, sticky mode is disabled. The same happens if there are no more exclusive tests after a run.
A second argument can be passed to Api#run(). If true the tests will be run in exclusive mode, regardless of whether exclusive tests are detected. The Api now remits the 'stats' event from the forks.