diff --git a/test/async-hooks/test-callback-error.js b/test/async-hooks/test-callback-error.js index 8fe0177449e4ff..6b09e4bb49748d 100644 --- a/test/async-hooks/test-callback-error.js +++ b/test/async-hooks/test-callback-error.js @@ -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']);