* display current time when mini & verbose reporters finish
I'm using toLocaleTimeString() which works even back to Node.js 0.10. Forcing a
24-hour clock because we're geeks.
* watcher: restart logger on subsequent runs
The CLI starts the logger so the watcher shouldn't reset it on its first run.
Restart the logger after resetting, this allows the mini reporter to render its
spinner.
* better api.run stub in watcher test
Return an object for the runStatus, add assertions to verify this object is
passed to logger.finish()
* assert that r/rs reruns all tests
* clear mini reporter in watch mode
Clear the mini reporter unless the previous run had failures, or "r\n" was
entered on stdin.
* consistent empty lines in finish output
Always print two empty lines before each error/rejection/exception when the mini
and verbose reporters finish. Remove trailing whitespace from stack traces.
Always print an empty line after the finish output.
Add a test helper to more easily compare line output, with useful debug
information. At the moment this new helper is only used for failing tests.
* print line if reporter was not be cleared
Watch mode won't clear the mini reporter if there were errors, or "r\n" was
entered on stdin. The verbose reporter can't be cleared at all. To improve the
separation between multiple test runs, write a horizontal line when starting a
new test run and the reporter was not cleared.
* remove debug output from cli test
* detect improper use of t.throws
Protects against a common misuse of t.throws (Like that seen in #739).
This required the creation of a custom babel plugin.
https://github.com/jamestalmage/babel-plugin-ava-throws-helper
* relative file path and colors
* protect against null/undefined in _setAssertError
* use babel-code-frame to do syntax highlighting on the Error
* require `babel-code-frame` inline. It has a sizable dependency graph
* remove middle section of message. It is redundant given code-frame
* further tests and add documentation.
* update readme.md
* 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.
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.
In Node 0.10 pause() does not return the stream.
The stream was being paused because get-stream did not use flowing mode, and
adding the 'data' listener would switch the stream to flowing mode. However
that did not work with Node 0.10 either. get-stream has been updated to use
flowing mode, which makes pause() unnecessary. The test now passes in Node 0.10.
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.
This prevents interference between the mini logger and child processes that use `console.log`. The mini reporter previously used logUpdate which deletes lines previously written with the logUpdate API before writing a new one. This caused problems if lines from console.log were written inbetween logUpdate calls. It would delete the users log messages instead of the test status line. To fix this, we store the last written last log line, clear it, write the users log output, then restore the last log line. This keeps the miniReporter output always at the bottom of the log output.
It also fixes an incorrect use of the `child_process` API. We were using the `stdio` option for `child_process.fork`, but that option is ignored (it is honored for just about every other method in that API). See: 7b355c5bb3/lib/child_process.js (L49-L50)
It also adds a set of visual tests which can be run via `npm run visual`. They must be run manually, and should be run as part of our pre-release process.
This uses `nyc` directly instead of via `tap`. There is currently some semver brokeness happening due to a major version bump in `nyc` making it's way into a minor version bump for `tap`. I think the easiest solution is just to avoid the problem altogether by turning off `tap`s coverage option and using `nyc` directly.
Reference:
https://github.com/isaacs/node-tap/pull/197
---
This also switches us to the `classic` reporter. Historically were using `dots` reporter with `tape`, but that provided poor diagnostic information on failures. The `classic` reporter does a much better job of providing all the information we need when a test fails.