Skip to content

Commit

Permalink
Merge pull request #7 from zendesk/dderidder/X-win32-fixup
Browse files Browse the repository at this point in the history
Omit win32 from signals test suite
  • Loading branch information
73rhodes committed Apr 26, 2024
2 parents 26bebac + 0aa939f commit 59e471d
Showing 1 changed file with 31 additions and 29 deletions.
60 changes: 31 additions & 29 deletions test/integration/options/posixExitCodes.spec.js
Expand Up @@ -9,42 +9,44 @@ const EXIT_FAILURE = 1;
const SIGNAL_OFFSET = 128;

describe('--posix-exit-codes', function () {
describe('when enabled, and with node options', function () {
var args = ['--no-warnings', '--posix-exit-codes'];
if (os.platform() !== 'win32') { // SIGTERM is not supported on Windows
describe('when enabled, and with node options', function () {
var args = ['--no-warnings', '--posix-exit-codes'];

it('should exit with correct POSIX shell code on SIGABRT', function (done) {
var fixture = 'signals-sigabrt.fixture.js';
runMocha(fixture, args, function postmortem(err, res) {
if (err) {
return done(err);
}
expect(res.code, 'to be', SIGNAL_OFFSET + os.constants.signals.SIGABRT);
done();
it('should exit with correct POSIX shell code on SIGABRT', function (done) {
var fixture = 'signals-sigabrt.fixture.js';
runMocha(fixture, args, function postmortem(err, res) {
if (err) {
return done(err);
}
expect(res.code, 'to be', SIGNAL_OFFSET + os.constants.signals.SIGABRT);
done();
});
});
});

it('should exit with correct POSIX shell code on SIGTERM', function (done) {
var fixture = 'signals-sigterm.fixture.js';
runMocha(fixture, args, function postmortem(err, res) {
if (err) {
return done(err);
}
expect(res.code, 'to be', SIGNAL_OFFSET + os.constants.signals.SIGTERM);
done();
it('should exit with correct POSIX shell code on SIGTERM', function (done) {
var fixture = 'signals-sigterm.fixture.js';
runMocha(fixture, args, function postmortem(err, res) {
if (err) {
return done(err);
}
expect(res.code, 'to be', SIGNAL_OFFSET + os.constants.signals.SIGTERM);
done();
});
});
});

it('should exit with code 1 if there are test failures', function (done) {
var fixture = 'failing.fixture.js';
runMocha(fixture, args, function postmortem(err, res) {
if (err) {
return done(err);
}
expect(res.code, 'to be', EXIT_FAILURE);
done();
it('should exit with code 1 if there are test failures', function (done) {
var fixture = 'failing.fixture.js';
runMocha(fixture, args, function postmortem(err, res) {
if (err) {
return done(err);
}
expect(res.code, 'to be', EXIT_FAILURE);
done();
});
});
});
});
}

describe('when not enabled, and with node options', function () {
it('should exit with the number of failed tests', function (done) {
Expand Down

0 comments on commit 59e471d

Please sign in to comment.