Previously, we ran the window in devMode, but didn’t set devMode to true
early enough to compute the correct resource path. This caused errors
when attempting to load the bundled keymaps when running atom —test
without the —dev flag.
Log output to stderr as we did before, so that grunt can, in turn, output it to
console when specs fail.
Welcome back build failures! 🎉
/cc: @nathansobo @maxbrunsfeld
The idea with this commit is to implement a timeout functionality that does not
rely on a system utility (such as unix `timeout`). Tests could hang because of a
CPU-bound task and, as a result, we need to handle timeouts in a separate
process.
An ideal implementation would first spawn the timeout, which in turn would spawn
the tests, acting as a supervisor and making sure they do not exceed the
supplied time. However, setting up such an environment would have been trickier,
thus the test process spawns the timeout cop before running any test. This, in
turn, invokes a `setTimeout` function and kills the parent process as soon as
the timeout gets triggered, logging to console the reason why the parent process
was killed (and exiting the parent process with code 130).
I haven't used `Task` because, in order to log stuff to the console, we need to
fork the ChildProcess from `remote`, as otherwise nothing gets written out.
If the nearest containing package.json of a test path has an
atomTestRunner field, we’ll require the specified file as a test runner
rather than the default jasmine runner.
For some reason, logging to stderr/stdout from the render process only
works when Atom is run via child_process.spawn, which is how `apm test`
invokes it.
I’m trying to make a convenient interface for running tests directly via
the `atom` command, and this is the only way I could find to long to
stdout from the render process.
I’m also choosing stdout rather than stderr because in this case, you’re
intentionally running the tests and want to see feedback.