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.
I want to start focusing on getting our require times down,
both in the main thread and forked tests.
This adds `time-require` support directly to the CLI to assist in that.
This is especially important for forked test processes, where I currently
have to manually add a line of code each time I want to test an optimization.
I don't think this should be a publicly documented move. I think we want
the freedom to remove this once we are happy with performance.
I have placed comments above all `time-require` references, indicating
it is for internal use only. Users have been given fair warning against
relying on its inclusion long term.
Usage:
```sh
$ DEBUG=ava ./cli.js test/fixture/es2015.js --sorted
```
`--sorted` is optional. It sorts the requires from most expensive to least. The default is sequential sorting.
The output will display multiple `time-require` reports.
One for each forked process, and the last one for the main thread.
This passes terminal width information to, and enables ansi-color
support in, the forked process. It makes the output of `time-require`
much prettier when used in a fork.
add small delay on exit from babel
(cherry picked from commit 11961f7)
if AVA is not required in a test, throw an error instead of process.exit
only extend timeout if env.AVA_APPVEYOR is set, so we only slow down
in our tests.
wait for forked streams to end before resolving promise
(cherry picked from commit 4539ccc)
wait for io streams to end even when fork promise is rejected
(cherry picked from commit 6bff82a)
Killing the parent process skips execution of `end` listeners
on remaining forked child processes.
This interferes with `nyc` if processes are kept running after
test completion.
Refrence: https://github.com/bcoe/nyc/issues/52