-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add option to use posix exit code upon fatal signal #4989
Open
73rhodes
wants to merge
24
commits into
mochajs:main
Choose a base branch
from
zendesk:master
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+308
−5
Open
Changes from 7 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
8999b7b
Option to use posix exit code upon fatal signal
73rhodes 3b99517
Update test/integration/options/posixExitCodes.spec.js
73rhodes 2150c30
Address PR review comments mocha org
73rhodes 0fb6ca3
Merge pull request #2 from zendesk/dderidder/X-mochajs-pr-review
73rhodes 62528c5
Address PR review comments mocha org
73rhodes 8a4f2bd
Merge pull request #3 from zendesk/dderidder/X-mochajs-pr-review
73rhodes 817d890
Merge branch 'master' into master
73rhodes ad30057
Update docs/index.md
73rhodes 592f071
Fix exit code when no signal caught
73rhodes 34f2822
Coverage for posix exit code with normally failing tests
73rhodes 3438da6
Merge pull request #4 from zendesk/dderidder/X-mochajs-pr-review-part2
73rhodes b6e6d30
Update docs/index.md
73rhodes d2991a1
Address PR comments; use os.constants
73rhodes 7cf79d8
Merge pull request #5 from zendesk/dderidder/X-mochajs-pr-review-part3
73rhodes 609f94f
Remove test that asserts the problematic behavior
73rhodes b71eaf3
Merge pull request #6 from zendesk/dderidder/X-mochajs-pr-review-part4
73rhodes 26bebac
Merge branch 'mochajs:master' into master
73rhodes 0aa939f
Omit win32 from signals test suite
73rhodes 59e471d
Merge pull request #7 from zendesk/dderidder/X-win32-fixup
73rhodes 6d237fc
Update docs/index.md
73rhodes ca78dbc
Update package.json
73rhodes 1809576
Merge pull request #8 from zendesk/73rhodes-patch-1
73rhodes df38431
WIP - support posix-exit-codes option for both child-process and in-p…
73rhodes 9ee844a
Merge pull request #11 from zendesk/dderidder/fix-exit-codes-pr-update
73rhodes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
73rhodes marked this conversation as resolved.
Show resolved
Hide resolved
|
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,7 @@ | ||
'use strict'; | ||
|
||
describe('signal suite', function () { | ||
it('test SIGTERM', function () { | ||
process.kill(process.pid, 'SIGTERM'); | ||
}); | ||
}); |
JoshuaKGoldberg marked this conversation as resolved.
Show resolved
Hide resolved
|
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,46 @@ | ||
'use strict'; | ||
|
||
var helpers = require('../helpers'); | ||
var runMocha = helpers.runMocha; | ||
|
||
describe('--posix-exit-codes', function () { | ||
describe('when enabled with node options', function () { | ||
var args = ['--no-warnings', '--posix-exit-codes']; | ||
73rhodes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
it('should exit with code 134 on SIGABRT', function (done) { | ||
73rhodes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
var fixture = 'signals-sigabrt.fixture.js'; | ||
runMocha(fixture, args, function postmortem(err, res) { | ||
if (err) { | ||
return done(err); | ||
} | ||
expect(res.code, 'to be', 134); | ||
73rhodes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
done(); | ||
}); | ||
}); | ||
|
||
it('should exit with code 143 on SIGTERM', function (done) { | ||
73rhodes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
var fixture = 'signals-sigterm.fixture.js'; | ||
runMocha(fixture, args, function postmortem(err, res) { | ||
if (err) { | ||
return done(err); | ||
} | ||
expect(res.code, 'to be', 143); | ||
73rhodes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
done(); | ||
}); | ||
}); | ||
}); | ||
|
||
73rhodes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
describe('when not enabled with node options', function () { | ||
it('should exit with code null on SIGABRT', function (done) { | ||
var fixture = 'signals-sigabrt.fixture.js'; | ||
var args = ['--no-warnings']; | ||
runMocha(fixture, args, function postmortem(err, res) { | ||
if (err) { | ||
return done(err); | ||
} | ||
expect(res.code, 'to be', null); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the documentation the
signal
argument of theexit
event onchild_process.spawn()
is always a string – when is it ever something else?