Support posix-exit-codes for child and in-process modes #11
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
Mocha has two ways of running: as a child process or in the main process. If there are any node command-line options (with or without mocha command line options) it will spawn a child process to run mocha and pass the node-specific options to that child process.
Reviewers of our PR to the upstream mocha repository requested that the
--posix-exit-codes
option should be supported in both modes of operation (mocha as a child process AND mocha in the main process). Originally I had it only working for mocha as a child process because that satisfies our use-case where we run mocha vianyc
which passes node-specific options.This PR also adds some additional unit tests to round out the coverage for these four scenarios:
Note that in ALL cases, when a fatal signal (ie. SIGABRT, SIGTERM) kills the mocha process, the exit code should now be [128 + numeric value of signal] in compliance with standard posix & bash command behaviour.