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.
If a test throws synchronously, but the error is not an Error instance, create
an AssertionError like for rejected promises.
Use inspect() to include a string representation of the actual error, and
include it in the `actual` property.
Remove special handling which converted `undefined` error values to the
`'undefined'` string.
Previously, Sequence was checking for Promise-type result
every time, to detect when a Promise needs to be returned
from .run() method, which created a deep Promise chain.
After this change, when Sequence finds Promise-type result
it uses Promise.each on all the remaining tests.