Skip to content

Commit

Permalink
test: refactor async-hooks test-callback-error
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Trott committed Jun 11, 2017
1 parent af3aa68 commit a08b59f
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions test/async-hooks/test-callback-error.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,14 @@ switch (process.argv[2]) {
async_hooks.triggerId());
async_hooks.emitBefore(async_hooks.currentId());
break;
}

if (process.execArgv.includes('--abort-on-uncaught-exception')) {
initHooks({
oninit: common.mustCall(() => { throw new Error('test_callback_abort'); })
}).enable();
case 'test_callback_abort':
initHooks({
oninit: common.mustCall(() => { throw new Error('test_callback_abort'); })
}).enable();

async_hooks.emitInit(async_hooks.currentId(), 'test_callback_abort',
async_hooks.triggerId());
async_hooks.emitInit(async_hooks.currentId(), 'test_callback_abort',
async_hooks.triggerId());
break;
}

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

0 comments on commit a08b59f

Please sign in to comment.