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.
The child processes determine whether the test had an error based on its `error`
property not being `undefined`. However they then change this property to an
empty object if there was no error.
The API determines whether a test had an error based on its (empty) error object
having a `message` property. If a test did not have an error, its `error`
property is set to `null`. This prevents errors without messages from being
reported correctly.
Instead set `error` to `null` in the child processes and rely on that in the
API.
I've added a test to validate errors without messages get reported.