Skip to content

Commit 812e0b0

Browse files
Trottaddaleax
authored andcommitted
test: refactor async-hooks test-callback-error
Two child processes have their logic in a switch statement and a third uses an `if` statement to detect it. Move all three child process tasks into switch statement. PR-URL: #13554 Reviewed-By: Trevor Norris <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: David Cai <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Yuta Hiroto <[email protected]>
1 parent 00d2f7c commit 812e0b0

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

test/async-hooks/test-callback-error.js

+7-8
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,14 @@ switch (process.argv[2]) {
2424
async_hooks.triggerId());
2525
async_hooks.emitBefore(async_hooks.currentId());
2626
break;
27-
}
28-
29-
if (process.execArgv.includes('--abort-on-uncaught-exception')) {
30-
initHooks({
31-
oninit: common.mustCall(() => { throw new Error('test_callback_abort'); })
32-
}).enable();
27+
case 'test_callback_abort':
28+
initHooks({
29+
oninit: common.mustCall(() => { throw new Error('test_callback_abort'); })
30+
}).enable();
3331

34-
async_hooks.emitInit(async_hooks.currentId(), 'test_callback_abort',
35-
async_hooks.triggerId());
32+
async_hooks.emitInit(async_hooks.currentId(), 'test_callback_abort',
33+
async_hooks.triggerId());
34+
break;
3635
}
3736

3837
const c1 = spawnSync(`${process.execPath}`, [__filename, 'test_init_callback']);

0 commit comments

Comments
 (0)