* convert-source-map@^1.2.0
The generateMapFileComment() method used in #662 isn't available in v1.1.2.
* use already required convert-source-map dependency
No need to require the generateMapFileComment() method separately.
Also remove unnecessary linebreak at the end of the file.
The child process is no longer killed from the main process, instead it exits
upon receiving an 'exit' message. This makes the changes from
<https://github.com/sindresorhus/ava/pull/155> redundant.
When loading the test file, test workers intercept the require call and load the
cached code instead. Libraries like nyc may also be intercepting require calls,
however they won't know that different code was loaded. They may then attempt to
resolve a source map from the original file location.
This commit adds a source map file comment to the cached code. The file path is
relative from the directory of the original file to where the source map is
cached.
Add a test which mimics how nyc resolves the source map.
clean-yaml-object is the error serialization tool used by node-tap.
It has some nice benefits over serailze-error including better stringification of functions and buffers.
More importantly, the shared code will help keep our tap output consistent with that of node-tap.
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.
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.
Explicitly normalize test file paths as they're discovered in `api.js`. They end
up being normalized implicitly in `fork.js` but it's saner if test file paths
always use backslashes on Windows.
Assume test file and source patterns use slashes. Ensure such when recursing
directories in `api.js` and when matching files in `watcher.js`.
Fix watcher tests to emit dependencies and chokidar changes using
platform-specific paths.
Test workers keep track of test dependencies for all registered file extensions.
These are sent back to the Api as part of the 'teardown' event, ensuring they're
captured irrespective of whether tests passed.
The watcher rejects any dependencies that are not source files, matching how
Chokidar watches for source file modifications. It maintains a list of source
dependencies for each test file.
The watcher will find the test files that depend on modified source files and
rerun those (along with any other modified test files). If any modified source
files cannot be mapped to test files all tests are rerun. This is necessary
because only `require()` dependencies are tracked, not file access.
fork.js sends the teardown command when uncaught exceptions occur, if there are
no tests, and when results are received. However the results message is sent
from the worker when all tests have run. This means teardown can be sent more
than once.
Use a class-based approach so state can be kept on the instances, reducing the
need to pass it through function calls and closures. Extract debouncer into
a separate class (kept within the module).
Rather than passing process.stdin the CLI is now responsible for starting
observation.
When 'rs' is entered directly rerun all tests, without passing through the
change detection.
Reset the logger before every test run, including the first.
If a test is rejected with a non-Error reason an AssertionError is created.
Like when a non-Error is thrown, use inspect() to include a string
representation of the rejection reason.