-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Option to use posix exit code upon fatal signal
- Loading branch information
Showing
5 changed files
with
56 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
'use strict'; | ||
|
||
describe('signal suite', function () { | ||
it('test SIGABRT', function () { | ||
process.kill(process.pid, 'SIGABRT'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
'use strict'; | ||
|
||
var helpers = require('../helpers'); | ||
var runMocha = helpers.runMocha; | ||
|
||
describe('--posix-exit-codes', function () { | ||
// subprocess | ||
var mocha; | ||
|
||
function killSubprocess() { | ||
mocha.kill('SIGKILL'); | ||
} | ||
|
||
// these two handlers deal with a ctrl-c on command-line | ||
before(function () { | ||
process.on('SIGINT', killSubprocess); | ||
}); | ||
|
||
after(function () { | ||
process.removeListener('SIGINT', killSubprocess); | ||
}); | ||
|
||
describe('when enabled with node options', function () { | ||
it('should exit with code 134 on SIGABRT', function (done) { | ||
var fixture = 'posix-exit-codes.fixture.js'; | ||
var args = ['--no-warnings', '--posix-exit-codes']; | ||
mocha = runMocha(fixture, args, function postmortem(err, res) { | ||
if (err) { | ||
return done(err); | ||
} | ||
expect(res.code, 'to be', 134); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); |