Skip to content

Override process.exit to give some context when it's called unexpectedly in a test. #861

@jamestalmage

Description

@jamestalmage

Issuehunt badges

Just had an issue on Gitter where a users code was causing process.exit(1) to be called. He got the "test.js exited with a non-zero exit code message", but there was no helpful information.

I say we try and capture that somehow:

var oldExit = process.exit;
process.exit = function (code) {
  if (code > 0) {
    var stack = new Error().stack;
    // log it? send it to parent?
    // ...
  }
  oldExit.apply(process, arguments);
};

There is a $60.00 open bounty on this issue. Add more on Issuehunt.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions