Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5630170

Browse filesBrowse files
RaisinTenmarco-ippolito
authored andcommitted
test: account for truthy signal in flaky async_hooks tests
When the spawned child process gets closed with a signal, the exit code is not set and that is why the exit code assertion was failing. This change adjusts the test to check the signal and if it is truthy, it doesn't assert the exit code and instead logs the signal and continues the rest of the assertions. Refs: #58463 (comment) Refs: #58199 Refs: #58463 Signed-off-by: Darshan Sen <raisinten@gmail.com> PR-URL: #58478 Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de> Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 1e5363b commit 5630170
Copy full SHA for 5630170

2 files changed

+12-4Lines changed: 12 additions & 4 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎test/async-hooks/test-emit-after-on-destroyed.js‎

Copy file name to clipboardExpand all lines: test/async-hooks/test-emit-after-on-destroyed.js
+6-2Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,12 @@ if (process.argv[2] === 'child') {
5252
child.stderr.on('data', (d) => { errData = Buffer.concat([ errData, d ]); });
5353
child.stdout.on('data', (d) => { outData = Buffer.concat([ outData, d ]); });
5454

55-
child.on('close', common.mustCall((code) => {
56-
assert.strictEqual(code, 1);
55+
child.on('close', common.mustCall((code, signal) => {
56+
if (signal) {
57+
console.log(`Child closed with signal: ${signal}`);
58+
} else {
59+
assert.strictEqual(code, 1);
60+
}
5761
assert.match(outData.toString(), heartbeatMsg,
5862
'did not crash until we reached offending line of code ' +
5963
`(found ${outData})`);
Collapse file

‎test/async-hooks/test-improper-unwind.js‎

Copy file name to clipboardExpand all lines: test/async-hooks/test-improper-unwind.js
+6-2Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,12 @@ if (process.argv[2] === 'child') {
5555
child.stderr.on('data', (d) => { errData = Buffer.concat([ errData, d ]); });
5656
child.stdout.on('data', (d) => { outData = Buffer.concat([ outData, d ]); });
5757

58-
child.on('close', common.mustCall((code) => {
59-
assert.strictEqual(code, 1);
58+
child.on('close', common.mustCall((code, signal) => {
59+
if (signal) {
60+
console.log(`Child closed with signal: ${signal}`);
61+
} else {
62+
assert.strictEqual(code, 1);
63+
}
6064
assert.match(outData.toString(), heartbeatMsg,
6165
'did not crash until we reached offending line of code ' +
6266
`(found ${outData})`);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.