Skip to content

Commit 8b3f2e3

Browse files
committed
Add test case for numerical signal
1 parent f9ae3f5 commit 8b3f2e3

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
'use strict';
2+
const os = require('node:os');
3+
4+
describe('signal suite', function () {
5+
it('test SIGTERM', function () {
6+
process.kill(process.pid, os.constants.signals['SIGTERM']);
7+
});
8+
});

test/integration/options/posixExitCodes.spec.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,26 @@ describe('--posix-exit-codes', function () {
4949
}
5050
});
5151

52+
it('should exit with the correct POSIX shell code on numeric fatal signal', function(done) {
53+
// not supported on Windows
54+
if (os.platform() !== 'win32') {
55+
var fixture = 'signals-sigterm-numeric.fixture.js';
56+
runMocha(fixture, args, function postmortem(err, res) {
57+
if (err) {
58+
return done(err);
59+
}
60+
expect(
61+
res.code,
62+
'to be',
63+
SIGNAL_OFFSET + os.constants.signals.SIGTERM
64+
);
65+
done();
66+
});
67+
} else {
68+
done();
69+
}
70+
});
71+
5272
it('should exit with code 1 if there are test failures', function (done) {
5373
var fixture = 'failing.fixture.js';
5474
runMocha(fixture, args, function postmortem(err, res) {

0 commit comments

Comments
 (0)