diff options
author | Rich Trott <rtrott@gmail.com> | 2017-06-08 12:25:31 -0700 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2017-06-11 11:20:31 -0700 |
commit | a08b59f2a6bac0cc9207e9ea980481ea704a11fd (patch) | |
tree | 86b829e249f1fe572f44ae4ffe5bd8f7eab7046f /test/async-hooks/test-callback-error.js | |
parent | af3aa682ac534bb55765f5fef2755a88e5ff2580 (diff) | |
download | android-node-v8-a08b59f2a6bac0cc9207e9ea980481ea704a11fd.tar.gz android-node-v8-a08b59f2a6bac0cc9207e9ea980481ea704a11fd.tar.bz2 android-node-v8-a08b59f2a6bac0cc9207e9ea980481ea704a11fd.zip |
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: https://github.com/nodejs/node/pull/13554
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: David Cai <davidcai1993@yahoo.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Diffstat (limited to 'test/async-hooks/test-callback-error.js')
-rw-r--r-- | test/async-hooks/test-callback-error.js | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/test/async-hooks/test-callback-error.js b/test/async-hooks/test-callback-error.js index 8fe0177449..6b09e4bb49 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']); |