PR #576 changed the `t.throws()` assertion to return the thrown error, or if
asynchronous a promise for the rejection reason. Unfortunately this only worked
for asynchronous errors.
The tests cover the changes in `lib/assert.js` but `t.throws()` is an *enhanced*
assertion. This commit ensures any values returned from `lib/assert.js`
assertions are indeed returned by the corresponding `t.` assertions.
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.
Catch exceptions when initially running files. Don't run any tests, just report
the exception.
Move test teardown into a callback for the run promise so it can be used when
--match is used but there are no matches, and when exceptions occur while
initially running files.
Teardown causes the test promise to reject, which leads to an attempt to run
the tests. Add a guard to prevent this.
Fixes#622.
If --match is used but no tests match, report an error rather than running all
tests.
Now exclusive tests are marked as no longer exclusive if they don't match. Set
defaults for the 'match' option in the Api and Runner.
Fixes#606.
* Move the bulk of tryRun() out of the forEach into a run() method
* Bail out early to reduce nesting
* Count down to 0 rather than up to the filesCount
* Guard more explicitly against repeated tries when stats are emitted *and*
the process crashes to prevent premature test runs