From df08779e0dfa82ceb69e129ae0548e97352aaddf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Tue, 17 Jul 2018 08:23:49 +0200 Subject: [PATCH] test: make crashOnUnhandleRejection opt-out MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit removes `common.crashOnUnhandledRejection()` and adds `common.disableCrashOnUnhandledRejection()`. To reduce the risk of mistakes and make writing tests that involve promises simpler, always install the unhandledRejection hook in tests and provide a way to disable it for the rare cases where it's needed. PR-URL: https://github.com/nodejs/node/pull/21849 Reviewed-By: Tobias Nießen Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen Reviewed-By: Gus Caplan Reviewed-By: Ruben Bridgewater Reviewed-By: James M Snell Reviewed-By: Trivikram Kamat --- doc/guides/writing-tests.md | 28 ++++++------------- test/addons-napi/test_promise/test.js | 2 -- .../test_threadsafe_function/test.js | 2 -- .../callback-scope/test-resolve-async.js | 2 -- test/addons/make-callback-recurse/test.js | 2 -- ...promise.chain-promise-before-init-hooks.js | 2 -- test/async-hooks/test-promise.js | 2 -- test/common/README.md | 15 +++++----- test/common/index.js | 7 +++-- test/common/index.mjs | 4 +-- test/common/inspector-helper.js | 1 + test/es-module/test-esm-dynamic-import.js | 2 -- test/es-module/test-esm-error-cache.js | 4 +-- ...oader-missing-dynamic-instantiate-hook.mjs | 7 +---- test/es-module/test-esm-throw-undefined.mjs | 4 +-- test/internet/test-dns-any.js | 2 -- test/internet/test-dns-ipv4.js | 2 -- test/internet/test-dns-ipv6.js | 2 -- test/internet/test-dns-txt-sigsegv.js | 4 +-- test/internet/test-dns.js | 2 -- .../test-inspector-cluster-port-clash.js | 2 -- .../unhandled_promise_trace_warnings.js | 3 +- test/parallel/test-assert-async.js | 2 -- ...test-async-hooks-disable-during-promise.js | 1 - .../test-async-hooks-enable-during-promise.js | 2 -- ...test-async-hooks-promise-enable-disable.js | 2 -- .../test-async-hooks-promise-triggerid.js | 2 -- .../test-async-wrap-pop-id-during-load.js | 3 +- .../test-async-wrap-promise-after-enabled.js | 2 -- test/parallel/test-c-ares.js | 2 -- .../test-child-process-promisified.js | 2 -- test/parallel/test-dns-lookup.js | 2 -- test/parallel/test-dns-promises-resolve.js | 2 -- .../test-dns-resolveany-bad-ancount.js | 2 -- test/parallel/test-dns-resolveany.js | 2 -- test/parallel/test-dns-resolvens-typeerror.js | 2 -- test/parallel/test-dns.js | 2 -- test/parallel/test-domain-promise.js | 2 -- test/parallel/test-fs-lchown.js | 2 -- ...est-fs-promises-file-handle-append-file.js | 1 - .../test-fs-promises-file-handle-chmod.js | 1 - .../test-fs-promises-file-handle-read.js | 1 - .../test-fs-promises-file-handle-readFile.js | 1 - .../test-fs-promises-file-handle-stat.js | 1 - .../test-fs-promises-file-handle-sync.js | 4 +-- .../test-fs-promises-file-handle-truncate.js | 1 - .../test-fs-promises-file-handle-write.js | 1 - .../test-fs-promises-file-handle-writeFile.js | 1 - .../test-fs-promises-readfile-empty.js | 4 +-- test/parallel/test-fs-promises-readfile.js | 2 -- test/parallel/test-fs-promises-writefile.js | 2 -- test/parallel/test-fs-promises.js | 5 +--- test/parallel/test-fs-promisified.js | 2 -- test/parallel/test-fs-stat-bigint.js | 1 - test/parallel/test-http-agent.js | 1 - test/parallel/test-http2-backpressure.js | 2 -- .../test-http2-client-promisify-connect.js | 2 -- test/parallel/test-http2-window-size.js | 1 - ...est-inspect-async-hook-setup-at-inspect.js | 1 - test/parallel/test-inspector-esm.js | 2 -- .../test-inspector-multisession-js.js | 2 -- .../test-inspector-multisession-ws.js | 2 -- test/parallel/test-inspector-reported-host.js | 2 -- .../parallel/test-inspector-tracing-domain.js | 2 -- test/parallel/test-internal-module-wrap.js | 3 +- ...test-microtask-queue-integration-domain.js | 4 +-- .../test-microtask-queue-integration.js | 4 +-- .../test-microtask-queue-run-domain.js | 4 +-- ...st-microtask-queue-run-immediate-domain.js | 4 +-- .../test-microtask-queue-run-immediate.js | 4 +-- test/parallel/test-microtask-queue-run.js | 4 +-- ...-connections-close-makes-more-available.js | 8 +----- ...est-promises-unhandled-proxy-rejections.js | 2 ++ .../test-promises-unhandled-rejections.js | 4 ++- ...st-promises-unhandled-symbol-rejections.js | 2 ++ ...promises-warning-on-unhandled-rejection.js | 2 ++ test/parallel/test-repl-load-multiline.js | 2 -- test/parallel/test-repl-top-level-await.js | 2 -- test/parallel/test-repl.js | 2 -- test/parallel/test-stream-finished.js | 2 -- test/parallel/test-stream-pipeline.js | 2 -- .../test-stream-readable-async-iterators.js | 2 -- test/parallel/test-timers-promisified.js | 2 -- test/parallel/test-util-inspect-namespace.js | 4 +-- test/parallel/test-util-promisify.js | 2 -- test/parallel/test-util-types.js | 4 +-- test/parallel/test-vm-module-basic.js | 2 -- .../parallel/test-vm-module-dynamic-import.js | 1 - test/parallel/test-vm-module-errors.js | 1 - test/parallel/test-vm-module-import-meta.js | 2 -- test/parallel/test-vm-module-link.js | 1 - test/parallel/test-vm-module-reevaluate.js | 1 - test/parallel/test-wasm-simple.js | 4 +-- test/parallel/test-zlib-empty-buffer.js | 4 +-- .../test-zlib-flush-multiple-scheduled.js | 2 -- test/sequential/test-async-wrap-getasyncid.js | 4 +-- .../test-inspector-async-call-stack-abort.js | 1 + ...spector-async-hook-setup-at-inspect-brk.js | 1 - ...st-inspector-async-hook-setup-at-signal.js | 1 - ...spector-async-stack-traces-promise-then.js | 1 - ...spector-async-stack-traces-set-interval.js | 1 - test/sequential/test-inspector-bindings.js | 2 -- test/sequential/test-inspector-break-e.js | 1 - .../test-inspector-break-when-eval.js | 1 - test/sequential/test-inspector-console.js | 1 - test/sequential/test-inspector-contexts.js | 1 - .../test-inspector-debug-brk-flag.js | 1 - test/sequential/test-inspector-debug-end.js | 2 -- test/sequential/test-inspector-exception.js | 2 -- .../sequential/test-inspector-ip-detection.js | 2 -- .../test-inspector-not-blocked-on-idle.js | 1 - .../test-inspector-overwrite-config.js | 2 -- .../sequential/test-inspector-port-cluster.js | 1 - .../test-inspector-scriptparsed-context.js | 1 - .../test-inspector-stop-profile-after-done.js | 1 - test/sequential/test-inspector-stress-http.js | 2 -- test/sequential/test-inspector.js | 2 -- 117 files changed, 58 insertions(+), 241 deletions(-) diff --git a/doc/guides/writing-tests.md b/doc/guides/writing-tests.md index e4a9e296ff46e7..2059a709ff8a95 100644 --- a/doc/guides/writing-tests.md +++ b/doc/guides/writing-tests.md @@ -225,34 +225,24 @@ countdown.dec(); // The countdown callback will be invoked now. #### Testing promises -When writing tests involving promises, either make sure that the -`onFulfilled` or the `onRejected` handler is wrapped in -`common.mustCall()` or `common.mustNotCall()` accordingly, or -call `common.crashOnUnhandledRejection()` in the top level of the -test to make sure that unhandled rejections would result in a test -failure. For example: +When writing tests involving promises, it is generally good to wrap the +`onFulfilled` handler, otherwise the test could successfully finish if the +promise never resolves (pending promises do not keep the event loop alive). The +`common` module automatically adds a handler that makes the process crash - and +hence, the test fail - in the case of an `unhandledRejection` event. It is +possible to disable it with `common.disableCrashOnUnhandledRejection()` if +needed. ```javascript const common = require('../common'); const assert = require('assert'); const fs = require('fs').promises; -// Use `common.crashOnUnhandledRejection()` to make sure unhandled rejections -// will fail the test. -common.crashOnUnhandledRejection(); - -// Or, wrap the `onRejected` handler in `common.mustNotCall()`. -fs.writeFile('test-file', 'test').catch(common.mustNotCall()); - -// Or, wrap the `onFulfilled` handler in `common.mustCall()`. -// If there are assertions in the `onFulfilled` handler, wrap -// the next `onRejected` handler in `common.mustNotCall()` -// to handle potential failures. +// Wrap the `onFulfilled` handler in `common.mustCall()`. fs.readFile('test-file').then( common.mustCall( (content) => assert.strictEqual(content.toString(), 'test2') - )) - .catch(common.mustNotCall()); + )); ``` ### Flags diff --git a/test/addons-napi/test_promise/test.js b/test/addons-napi/test_promise/test.js index 477ceb75969d51..feaa4ebfef688a 100644 --- a/test/addons-napi/test_promise/test.js +++ b/test/addons-napi/test_promise/test.js @@ -7,8 +7,6 @@ const common = require('../../common'); const assert = require('assert'); const test_promise = require(`./build/${common.buildType}/test_promise`); -common.crashOnUnhandledRejection(); - // A resolution { const expected_result = 42; diff --git a/test/addons-napi/test_threadsafe_function/test.js b/test/addons-napi/test_threadsafe_function/test.js index 8d8a6d9d8c6827..d998853559ddda 100644 --- a/test/addons-napi/test_threadsafe_function/test.js +++ b/test/addons-napi/test_threadsafe_function/test.js @@ -12,8 +12,6 @@ const expectedArray = (function(arrayLength) { return result; })(binding.ARRAY_LENGTH); -common.crashOnUnhandledRejection(); - // Handle the rapid teardown test case as the child process. We unref the // thread-safe function after we have received two values. This causes the // process to exit and the environment cleanup handler to be invoked. diff --git a/test/addons/callback-scope/test-resolve-async.js b/test/addons/callback-scope/test-resolve-async.js index 3e96234787c7b3..98e1910b49df7b 100644 --- a/test/addons/callback-scope/test-resolve-async.js +++ b/test/addons/callback-scope/test-resolve-async.js @@ -4,8 +4,6 @@ const common = require('../../common'); const assert = require('assert'); const { testResolveAsync } = require(`./build/${common.buildType}/binding`); -common.crashOnUnhandledRejection(); - let called = false; testResolveAsync().then(() => { called = true; }); diff --git a/test/addons/make-callback-recurse/test.js b/test/addons/make-callback-recurse/test.js index a3ea399a4967c8..102890cc964d2a 100644 --- a/test/addons/make-callback-recurse/test.js +++ b/test/addons/make-callback-recurse/test.js @@ -9,8 +9,6 @@ const makeCallback = binding.makeCallback; // Make sure this is run in the future. const mustCallCheckDomains = common.mustCall(checkDomains); -common.crashOnUnhandledRejection(); - // Make sure that using MakeCallback allows the error to propagate. assert.throws(function() { makeCallback({}, function() { diff --git a/test/async-hooks/test-promise.chain-promise-before-init-hooks.js b/test/async-hooks/test-promise.chain-promise-before-init-hooks.js index 873fd272cf2d29..9046bc3514abfc 100644 --- a/test/async-hooks/test-promise.chain-promise-before-init-hooks.js +++ b/test/async-hooks/test-promise.chain-promise-before-init-hooks.js @@ -8,8 +8,6 @@ const { checkInvocations } = require('./hook-checks'); if (!common.isMainThread) common.skip('Worker bootstrapping works differently -> different async IDs'); -common.crashOnUnhandledRejection(); - const p = new Promise(common.mustCall(function executor(resolve, reject) { resolve(5); })); diff --git a/test/async-hooks/test-promise.js b/test/async-hooks/test-promise.js index d3070b7cbd594d..729704b7928f7d 100644 --- a/test/async-hooks/test-promise.js +++ b/test/async-hooks/test-promise.js @@ -9,8 +9,6 @@ const { checkInvocations } = require('./hook-checks'); if (!common.isMainThread) common.skip('Worker bootstrapping works differently -> different async IDs'); -common.crashOnUnhandledRejection(); - const hooks = initHooks(); hooks.enable(); diff --git a/test/common/README.md b/test/common/README.md index 41cc88aca10f59..3dee2f19704934 100644 --- a/test/common/README.md +++ b/test/common/README.md @@ -55,18 +55,19 @@ symlinks ([SeCreateSymbolicLinkPrivilege](https://msdn.microsoft.com/en-us/library/windows/desktop/bb530716(v=vs.85).aspx)). On non-Windows platforms, this always returns `true`. -### crashOnUnhandledRejection() - -Installs a `process.on('unhandledRejection')` handler that crashes the process -after a tick. This is useful for tests that use Promises and need to make sure -no unexpected rejections occur, because currently they result in silent -failures. - ### ddCommand(filename, kilobytes) * return [<Object>] Platform normalizes the `dd` command +### disableCrashOnUnhandledRejection() + +Removes the `process.on('unhandledRejection')` handler that crashes the process +after a tick. The handler is useful for tests that use Promises and need to make +sure no unexpected rejections occur, because currently they result in silent +failures. However, it is useful in some rare cases to disable it, for example if +the `unhandledRejection` hook is directly used by the test. + ### enoughTestMem * [<boolean>] diff --git a/test/common/index.js b/test/common/index.js index 1df37db54be493..bcd28cc28710e7 100644 --- a/test/common/index.js +++ b/test/common/index.js @@ -814,9 +814,10 @@ exports.getBufferSources = function getBufferSources(buf) { }; // Crash the process on unhandled rejections. -exports.crashOnUnhandledRejection = function() { - process.on('unhandledRejection', - (err) => process.nextTick(() => { throw err; })); +const crashOnUnhandledRejection = (err) => { throw err; }; +process.on('unhandledRejection', crashOnUnhandledRejection); +exports.disableCrashOnUnhandledRejection = function() { + process.removeListener('unhandledRejection', crashOnUnhandledRejection); }; exports.getTTYfd = function getTTYfd() { diff --git a/test/common/index.mjs b/test/common/index.mjs index f73a9d9be5c08e..8bf512f6b92f6e 100644 --- a/test/common/index.mjs +++ b/test/common/index.mjs @@ -52,7 +52,7 @@ const { skipIf32Bits, getArrayBufferViews, getBufferSources, - crashOnUnhandledRejection, + disableCrashOnUnhandledRejection, getTTYfd, runWithInvalidFD, hijackStdout, @@ -112,7 +112,7 @@ export { skipIf32Bits, getArrayBufferViews, getBufferSources, - crashOnUnhandledRejection, + disableCrashOnUnhandledRejection, getTTYfd, runWithInvalidFD, hijackStdout, diff --git a/test/common/inspector-helper.js b/test/common/inspector-helper.js index 13726049798f0e..84393c4281fa88 100644 --- a/test/common/inspector-helper.js +++ b/test/common/inspector-helper.js @@ -25,6 +25,7 @@ function spawnChildProcess(inspectorFlags, scriptContents, scriptFile) { const handler = tearDown.bind(null, child); process.on('exit', handler); process.on('uncaughtException', handler); + common.disableCrashOnUnhandledRejection(); process.on('unhandledRejection', handler); process.on('SIGINT', handler); diff --git a/test/es-module/test-esm-dynamic-import.js b/test/es-module/test-esm-dynamic-import.js index 91757172880f67..6a80da49472b36 100644 --- a/test/es-module/test-esm-dynamic-import.js +++ b/test/es-module/test-esm-dynamic-import.js @@ -5,8 +5,6 @@ const assert = require('assert'); const { URL } = require('url'); const vm = require('vm'); -common.crashOnUnhandledRejection(); - const relativePath = '../fixtures/es-modules/test-esm-ok.mjs'; const absolutePath = require.resolve('../fixtures/es-modules/test-esm-ok.mjs'); const targetURL = new URL('file:///'); diff --git a/test/es-module/test-esm-error-cache.js b/test/es-module/test-esm-error-cache.js index 22ffa9abe96a37..98244615eff2c6 100644 --- a/test/es-module/test-esm-error-cache.js +++ b/test/es-module/test-esm-error-cache.js @@ -2,11 +2,9 @@ // Flags: --experimental-modules -const common = require('../common'); +require('../common'); const assert = require('assert'); -common.crashOnUnhandledRejection(); - const file = '../fixtures/syntax/bad_syntax.js'; let error; diff --git a/test/es-module/test-esm-loader-missing-dynamic-instantiate-hook.mjs b/test/es-module/test-esm-loader-missing-dynamic-instantiate-hook.mjs index 27447b3e436afe..f2b37f7e8a4db6 100644 --- a/test/es-module/test-esm-loader-missing-dynamic-instantiate-hook.mjs +++ b/test/es-module/test-esm-loader-missing-dynamic-instantiate-hook.mjs @@ -1,11 +1,6 @@ // Flags: --experimental-modules --loader ./test/fixtures/es-module-loaders/missing-dynamic-instantiate-hook.mjs -import { - crashOnUnhandledRejection, - expectsError -} from '../common'; - -crashOnUnhandledRejection(); +import { expectsError } from '../common'; import('test').catch(expectsError({ code: 'ERR_MISSING_DYNAMIC_INSTANTIATE_HOOK', diff --git a/test/es-module/test-esm-throw-undefined.mjs b/test/es-module/test-esm-throw-undefined.mjs index 877728178762ba..541127eee5919f 100644 --- a/test/es-module/test-esm-throw-undefined.mjs +++ b/test/es-module/test-esm-throw-undefined.mjs @@ -1,6 +1,5 @@ // Flags: --experimental-modules -/* eslint-disable node-core/required-modules */ -import common from '../common/index.js'; +import '../common'; import assert from 'assert'; async function doTest() { @@ -12,5 +11,4 @@ async function doTest() { ); } -common.crashOnUnhandledRejection(); doTest(); diff --git a/test/internet/test-dns-any.js b/test/internet/test-dns-any.js index be5fc4b1addefc..e8425a6ca5632d 100644 --- a/test/internet/test-dns-any.js +++ b/test/internet/test-dns-any.js @@ -9,8 +9,6 @@ const net = require('net'); let running = false; const queue = []; -common.crashOnUnhandledRejection(); - const dnsPromises = dns.promises; const isIPv4 = net.isIPv4; const isIPv6 = net.isIPv6; diff --git a/test/internet/test-dns-ipv4.js b/test/internet/test-dns-ipv4.js index 837d45f2ad4128..1179cd6f5d6c7f 100644 --- a/test/internet/test-dns-ipv4.js +++ b/test/internet/test-dns-ipv4.js @@ -7,8 +7,6 @@ const net = require('net'); const util = require('util'); const isIPv4 = net.isIPv4; -common.crashOnUnhandledRejection(); - const dnsPromises = dns.promises; let running = false; const queue = []; diff --git a/test/internet/test-dns-ipv6.js b/test/internet/test-dns-ipv6.js index 283b182390ae72..b2cd6163e8007c 100644 --- a/test/internet/test-dns-ipv6.js +++ b/test/internet/test-dns-ipv6.js @@ -4,8 +4,6 @@ const { addresses } = require('../common/internet'); if (!common.hasIPv6) common.skip('this test, no IPv6 support'); -common.crashOnUnhandledRejection(); - const assert = require('assert'); const dns = require('dns'); const net = require('net'); diff --git a/test/internet/test-dns-txt-sigsegv.js b/test/internet/test-dns-txt-sigsegv.js index b572c6bb7fb421..9f65b6ec24ffc0 100644 --- a/test/internet/test-dns-txt-sigsegv.js +++ b/test/internet/test-dns-txt-sigsegv.js @@ -1,11 +1,9 @@ 'use strict'; -const common = require('../common'); +require('../common'); const assert = require('assert'); const dns = require('dns'); const dnsPromises = dns.promises; -common.crashOnUnhandledRejection(); - (async function() { const result = await dnsPromises.resolveTxt('www.microsoft.com'); assert.strictEqual(result.length, 0); diff --git a/test/internet/test-dns.js b/test/internet/test-dns.js index 593d621e82f5b1..4608713927abbd 100644 --- a/test/internet/test-dns.js +++ b/test/internet/test-dns.js @@ -30,8 +30,6 @@ const isIPv6 = net.isIPv6; const util = require('util'); const dnsPromises = dns.promises; -common.crashOnUnhandledRejection(); - let expected = 0; let completed = 0; let running = false; diff --git a/test/known_issues/test-inspector-cluster-port-clash.js b/test/known_issues/test-inspector-cluster-port-clash.js index 51ae94f59769ae..9fa2b483568c93 100644 --- a/test/known_issues/test-inspector-cluster-port-clash.js +++ b/test/known_issues/test-inspector-cluster-port-clash.js @@ -23,8 +23,6 @@ if (process.config.variables.v8_enable_inspector === 0) { const cluster = require('cluster'); const net = require('net'); -common.crashOnUnhandledRejection(); - const ports = [process.debugPort]; const clashPort = process.debugPort + 2; function serialFork() { diff --git a/test/message/unhandled_promise_trace_warnings.js b/test/message/unhandled_promise_trace_warnings.js index 48450fb21e2169..d51a2cd3da2106 100644 --- a/test/message/unhandled_promise_trace_warnings.js +++ b/test/message/unhandled_promise_trace_warnings.js @@ -1,5 +1,6 @@ // Flags: --trace-warnings 'use strict'; -require('../common'); +const common = require('../common'); +common.disableCrashOnUnhandledRejection(); const p = Promise.reject(new Error('This was rejected')); setImmediate(() => p.catch(() => {})); diff --git a/test/parallel/test-assert-async.js b/test/parallel/test-assert-async.js index 4b3664e0cbdf15..30c9a741c6ab10 100644 --- a/test/parallel/test-assert-async.js +++ b/test/parallel/test-assert-async.js @@ -5,8 +5,6 @@ const assert = require('assert'); // Test assert.rejects() and assert.doesNotReject() by checking their // expected output and by verifying that they do not work sync -common.crashOnUnhandledRejection(); - // Run all tests in parallel and check their outcome at the end. const promises = []; diff --git a/test/parallel/test-async-hooks-disable-during-promise.js b/test/parallel/test-async-hooks-disable-during-promise.js index ace9bca6799a13..6b9b53bd30f0f5 100644 --- a/test/parallel/test-async-hooks-disable-during-promise.js +++ b/test/parallel/test-async-hooks-disable-during-promise.js @@ -1,7 +1,6 @@ 'use strict'; const common = require('../common'); const async_hooks = require('async_hooks'); -common.crashOnUnhandledRejection(); if (!common.isMainThread) common.skip('Worker bootstrapping works differently -> different AsyncWraps'); diff --git a/test/parallel/test-async-hooks-enable-during-promise.js b/test/parallel/test-async-hooks-enable-during-promise.js index 29d25de9805de6..ce3253b01c1279 100644 --- a/test/parallel/test-async-hooks-enable-during-promise.js +++ b/test/parallel/test-async-hooks-enable-during-promise.js @@ -2,8 +2,6 @@ const common = require('../common'); const async_hooks = require('async_hooks'); -common.crashOnUnhandledRejection(); - Promise.resolve(1).then(common.mustCall(() => { async_hooks.createHook({ init: common.mustCall(), diff --git a/test/parallel/test-async-hooks-promise-enable-disable.js b/test/parallel/test-async-hooks-promise-enable-disable.js index b7692c45cd9b2e..150ccc88b0dc52 100644 --- a/test/parallel/test-async-hooks-promise-enable-disable.js +++ b/test/parallel/test-async-hooks-promise-enable-disable.js @@ -8,8 +8,6 @@ let p_resource = null; let p_er = null; let p_inits = 0; -common.crashOnUnhandledRejection(); - // Not useful to place common.mustCall() around 'exit' event b/c it won't be // able to check it anyway. process.on('exit', (code) => { diff --git a/test/parallel/test-async-hooks-promise-triggerid.js b/test/parallel/test-async-hooks-promise-triggerid.js index 507a8a4ada2c7e..467fddd359d835 100644 --- a/test/parallel/test-async-hooks-promise-triggerid.js +++ b/test/parallel/test-async-hooks-promise-triggerid.js @@ -6,8 +6,6 @@ const async_hooks = require('async_hooks'); if (!common.isMainThread) common.skip('Worker bootstrapping works differently -> different async IDs'); -common.crashOnUnhandledRejection(); - const promiseAsyncIds = []; async_hooks.createHook({ diff --git a/test/parallel/test-async-wrap-pop-id-during-load.js b/test/parallel/test-async-wrap-pop-id-during-load.js index ff3f637b87c270..31d2113eabc163 100644 --- a/test/parallel/test-async-wrap-pop-id-during-load.js +++ b/test/parallel/test-async-wrap-pop-id-during-load.js @@ -1,8 +1,9 @@ 'use strict'; -require('../common'); +const common = require('../common'); if (process.argv[2] === 'async') { + common.disableCrashOnUnhandledRejection(); async function fn() { fn(); throw new Error(); diff --git a/test/parallel/test-async-wrap-promise-after-enabled.js b/test/parallel/test-async-wrap-promise-after-enabled.js index 5df8f13c008e19..0d58cbd653868b 100644 --- a/test/parallel/test-async-wrap-promise-after-enabled.js +++ b/test/parallel/test-async-wrap-promise-after-enabled.js @@ -12,8 +12,6 @@ const async_hooks = require('async_hooks'); const seenEvents = []; -common.crashOnUnhandledRejection(); - const p = new Promise((resolve) => resolve(1)); p.then(() => seenEvents.push('then')); diff --git a/test/parallel/test-c-ares.js b/test/parallel/test-c-ares.js index 59ae40b2b82568..8b1cf79868c328 100644 --- a/test/parallel/test-c-ares.js +++ b/test/parallel/test-c-ares.js @@ -23,8 +23,6 @@ const common = require('../common'); const assert = require('assert'); -common.crashOnUnhandledRejection(); - const dns = require('dns'); const dnsPromises = dns.promises; diff --git a/test/parallel/test-child-process-promisified.js b/test/parallel/test-child-process-promisified.js index 0fa9c68a92d884..877bf06662e4e0 100644 --- a/test/parallel/test-child-process-promisified.js +++ b/test/parallel/test-child-process-promisified.js @@ -4,8 +4,6 @@ const assert = require('assert'); const child_process = require('child_process'); const { promisify } = require('util'); -common.crashOnUnhandledRejection(); - const exec = promisify(child_process.exec); const execFile = promisify(child_process.execFile); diff --git a/test/parallel/test-dns-lookup.js b/test/parallel/test-dns-lookup.js index 5ee3bc7051e521..3413bcffd8abe9 100644 --- a/test/parallel/test-dns-lookup.js +++ b/test/parallel/test-dns-lookup.js @@ -5,8 +5,6 @@ const cares = process.binding('cares_wrap'); const dns = require('dns'); const dnsPromises = dns.promises; -common.crashOnUnhandledRejection(); - // Stub `getaddrinfo` to *always* error. cares.getaddrinfo = () => process.binding('uv').UV_ENOENT; diff --git a/test/parallel/test-dns-promises-resolve.js b/test/parallel/test-dns-promises-resolve.js index fcaa8977a5ba18..430f4251379097 100644 --- a/test/parallel/test-dns-promises-resolve.js +++ b/test/parallel/test-dns-promises-resolve.js @@ -4,8 +4,6 @@ const assert = require('assert'); const dnsPromises = require('dns').promises; -common.crashOnUnhandledRejection(); - // Error when rrtype is invalid. { const rrtype = 'DUMMY'; diff --git a/test/parallel/test-dns-resolveany-bad-ancount.js b/test/parallel/test-dns-resolveany-bad-ancount.js index d48d9385b84b90..4b13421b316aee 100644 --- a/test/parallel/test-dns-resolveany-bad-ancount.js +++ b/test/parallel/test-dns-resolveany-bad-ancount.js @@ -6,8 +6,6 @@ const assert = require('assert'); const dgram = require('dgram'); const dnsPromises = dns.promises; -common.crashOnUnhandledRejection(); - const server = dgram.createSocket('udp4'); server.on('message', common.mustCall((msg, { address, port }) => { diff --git a/test/parallel/test-dns-resolveany.js b/test/parallel/test-dns-resolveany.js index f9a6399cef52d0..46694f240336cf 100644 --- a/test/parallel/test-dns-resolveany.js +++ b/test/parallel/test-dns-resolveany.js @@ -6,8 +6,6 @@ const assert = require('assert'); const dgram = require('dgram'); const dnsPromises = dns.promises; -common.crashOnUnhandledRejection(); - const answers = [ { type: 'A', address: '1.2.3.4', ttl: 123 }, { type: 'AAAA', address: '::42', ttl: 123 }, diff --git a/test/parallel/test-dns-resolvens-typeerror.js b/test/parallel/test-dns-resolvens-typeerror.js index ec57bba6148742..5a72b540130e0c 100644 --- a/test/parallel/test-dns-resolvens-typeerror.js +++ b/test/parallel/test-dns-resolvens-typeerror.js @@ -29,8 +29,6 @@ const common = require('../common'); const dns = require('dns'); const dnsPromises = dns.promises; -common.crashOnUnhandledRejection(); - common.expectsError( () => dnsPromises.resolveNs([]), // bad name { diff --git a/test/parallel/test-dns.js b/test/parallel/test-dns.js index 9acf18994e6fe7..3a44be92804746 100644 --- a/test/parallel/test-dns.js +++ b/test/parallel/test-dns.js @@ -26,8 +26,6 @@ const assert = require('assert'); const dns = require('dns'); const dnsPromises = dns.promises; -common.crashOnUnhandledRejection(); - const existing = dns.getServers(); assert(existing.length > 0); diff --git a/test/parallel/test-domain-promise.js b/test/parallel/test-domain-promise.js index f1c966d4afd4fd..1c6e62956085ce 100644 --- a/test/parallel/test-domain-promise.js +++ b/test/parallel/test-domain-promise.js @@ -5,8 +5,6 @@ const domain = require('domain'); const fs = require('fs'); const vm = require('vm'); -common.crashOnUnhandledRejection(); - { const d = domain.create(); diff --git a/test/parallel/test-fs-lchown.js b/test/parallel/test-fs-lchown.js index 23469eb279aede..bf8673c0718769 100644 --- a/test/parallel/test-fs-lchown.js +++ b/test/parallel/test-fs-lchown.js @@ -7,8 +7,6 @@ const fs = require('fs'); const path = require('path'); const { promises } = fs; -common.crashOnUnhandledRejection(); - // Validate the path argument. [false, 1, {}, [], null, undefined].forEach((i) => { const err = { type: TypeError, code: 'ERR_INVALID_ARG_TYPE' }; diff --git a/test/parallel/test-fs-promises-file-handle-append-file.js b/test/parallel/test-fs-promises-file-handle-append-file.js index 7766ac4c904642..f9abef359e0064 100644 --- a/test/parallel/test-fs-promises-file-handle-append-file.js +++ b/test/parallel/test-fs-promises-file-handle-append-file.js @@ -13,7 +13,6 @@ const assert = require('assert'); const tmpDir = tmpdir.path; tmpdir.refresh(); -common.crashOnUnhandledRejection(); async function validateAppendBuffer() { const filePath = path.resolve(tmpDir, 'tmp-append-file-buffer.txt'); diff --git a/test/parallel/test-fs-promises-file-handle-chmod.js b/test/parallel/test-fs-promises-file-handle-chmod.js index 8b9d8b1c0d193d..6b51639d410b3a 100644 --- a/test/parallel/test-fs-promises-file-handle-chmod.js +++ b/test/parallel/test-fs-promises-file-handle-chmod.js @@ -13,7 +13,6 @@ const assert = require('assert'); const tmpDir = tmpdir.path; tmpdir.refresh(); -common.crashOnUnhandledRejection(); async function validateFilePermission() { const filePath = path.resolve(tmpDir, 'tmp-chmod.txt'); diff --git a/test/parallel/test-fs-promises-file-handle-read.js b/test/parallel/test-fs-promises-file-handle-read.js index 621e63c075a256..13f8c277780d07 100644 --- a/test/parallel/test-fs-promises-file-handle-read.js +++ b/test/parallel/test-fs-promises-file-handle-read.js @@ -14,7 +14,6 @@ const assert = require('assert'); const tmpDir = tmpdir.path; tmpdir.refresh(); -common.crashOnUnhandledRejection(); async function validateRead() { const filePath = path.resolve(tmpDir, 'tmp-read-file.txt'); diff --git a/test/parallel/test-fs-promises-file-handle-readFile.js b/test/parallel/test-fs-promises-file-handle-readFile.js index 9e6fcc2784c49d..c31e175019a3fb 100644 --- a/test/parallel/test-fs-promises-file-handle-readFile.js +++ b/test/parallel/test-fs-promises-file-handle-readFile.js @@ -13,7 +13,6 @@ const assert = require('assert'); const tmpDir = tmpdir.path; tmpdir.refresh(); -common.crashOnUnhandledRejection(); async function validateReadFile() { const filePath = path.resolve(tmpDir, 'tmp-read-file.txt'); diff --git a/test/parallel/test-fs-promises-file-handle-stat.js b/test/parallel/test-fs-promises-file-handle-stat.js index 7d44b8e3dae2b7..19ee365213d302 100644 --- a/test/parallel/test-fs-promises-file-handle-stat.js +++ b/test/parallel/test-fs-promises-file-handle-stat.js @@ -11,7 +11,6 @@ const tmpdir = require('../common/tmpdir'); const assert = require('assert'); tmpdir.refresh(); -common.crashOnUnhandledRejection(); async function validateStat() { const filePath = path.resolve(tmpdir.path, 'tmp-read-file.txt'); diff --git a/test/parallel/test-fs-promises-file-handle-sync.js b/test/parallel/test-fs-promises-file-handle-sync.js index cf28df31cb2e0f..fc6d00c0b8fc13 100644 --- a/test/parallel/test-fs-promises-file-handle-sync.js +++ b/test/parallel/test-fs-promises-file-handle-sync.js @@ -1,5 +1,5 @@ 'use strict'; -const common = require('../common'); +require('../common'); const assert = require('assert'); const fixtures = require('../common/fixtures'); const tmpdir = require('../common/tmpdir'); @@ -7,8 +7,6 @@ const tmpdir = require('../common/tmpdir'); const { access, copyFile, open } = require('fs').promises; const path = require('path'); -common.crashOnUnhandledRejection(); - async function validateSync() { tmpdir.refresh(); const dest = path.resolve(tmpdir.path, 'baz.js'); diff --git a/test/parallel/test-fs-promises-file-handle-truncate.js b/test/parallel/test-fs-promises-file-handle-truncate.js index 44d919a042e276..65f998db748567 100644 --- a/test/parallel/test-fs-promises-file-handle-truncate.js +++ b/test/parallel/test-fs-promises-file-handle-truncate.js @@ -7,7 +7,6 @@ const { open, readFile } = require('fs').promises; const tmpdir = require('../common/tmpdir'); tmpdir.refresh(); -common.crashOnUnhandledRejection(); async function validateTruncate() { const text = 'Hello world'; diff --git a/test/parallel/test-fs-promises-file-handle-write.js b/test/parallel/test-fs-promises-file-handle-write.js index 49df2bf54f45ed..da8cfc0a4bf96b 100644 --- a/test/parallel/test-fs-promises-file-handle-write.js +++ b/test/parallel/test-fs-promises-file-handle-write.js @@ -13,7 +13,6 @@ const assert = require('assert'); const tmpDir = tmpdir.path; tmpdir.refresh(); -common.crashOnUnhandledRejection(); async function validateWrite() { const filePathForHandle = path.resolve(tmpDir, 'tmp-write.txt'); diff --git a/test/parallel/test-fs-promises-file-handle-writeFile.js b/test/parallel/test-fs-promises-file-handle-writeFile.js index a53384cc221645..e39c59f5cae80c 100644 --- a/test/parallel/test-fs-promises-file-handle-writeFile.js +++ b/test/parallel/test-fs-promises-file-handle-writeFile.js @@ -13,7 +13,6 @@ const assert = require('assert'); const tmpDir = tmpdir.path; tmpdir.refresh(); -common.crashOnUnhandledRejection(); async function validateWriteFile() { const filePathForHandle = path.resolve(tmpDir, 'tmp-write-file2.txt'); diff --git a/test/parallel/test-fs-promises-readfile-empty.js b/test/parallel/test-fs-promises-readfile-empty.js index 24c17655c62135..ef15a2681123c6 100644 --- a/test/parallel/test-fs-promises-readfile-empty.js +++ b/test/parallel/test-fs-promises-readfile-empty.js @@ -1,5 +1,5 @@ 'use strict'; -const common = require('../common'); +require('../common'); const assert = require('assert'); const { promises: fs } = require('fs'); @@ -7,8 +7,6 @@ const fixtures = require('../common/fixtures'); const fn = fixtures.path('empty.txt'); -common.crashOnUnhandledRejection(); - fs.readFile(fn) .then(assert.ok); diff --git a/test/parallel/test-fs-promises-readfile.js b/test/parallel/test-fs-promises-readfile.js index b1186ad2172507..ff25be75b84ff0 100644 --- a/test/parallel/test-fs-promises-readfile.js +++ b/test/parallel/test-fs-promises-readfile.js @@ -10,8 +10,6 @@ tmpdir.refresh(); const fn = path.join(tmpdir.path, 'large-file'); -common.crashOnUnhandledRejection(); - async function validateReadFile() { // Creating large buffer with random content const buffer = Buffer.from( diff --git a/test/parallel/test-fs-promises-writefile.js b/test/parallel/test-fs-promises-writefile.js index 1bb6945c6782da..858e90bc6291de 100644 --- a/test/parallel/test-fs-promises-writefile.js +++ b/test/parallel/test-fs-promises-writefile.js @@ -10,8 +10,6 @@ const tmpDir = tmpdir.path; tmpdir.refresh(); -common.crashOnUnhandledRejection(); - const dest = path.resolve(tmpDir, 'tmp.txt'); const buffer = Buffer.from('abc'.repeat(1000)); const buffer2 = Buffer.from('xyz'.repeat(1000)); diff --git a/test/parallel/test-fs-promises.js b/test/parallel/test-fs-promises.js index 602f1191b7aef5..26e1f8d71c292f 100644 --- a/test/parallel/test-fs-promises.js +++ b/test/parallel/test-fs-promises.js @@ -32,16 +32,13 @@ const { const tmpDir = tmpdir.path; -common.crashOnUnhandledRejection(); - // fs.promises should not be enumerable as long as it causes a warning to be // emitted. assert.strictEqual(Object.keys(fs).includes('promises'), false); { access(__filename, 'r') - .then(common.mustCall()) - .catch(common.mustNotCall()); + .then(common.mustCall()); access('this file does not exist', 'r') .then(common.mustNotCall()) diff --git a/test/parallel/test-fs-promisified.js b/test/parallel/test-fs-promisified.js index 13cf5e0e0f45f3..0744f62fd17fa5 100644 --- a/test/parallel/test-fs-promisified.js +++ b/test/parallel/test-fs-promisified.js @@ -5,8 +5,6 @@ const fs = require('fs'); const path = require('path'); const { promisify } = require('util'); -common.crashOnUnhandledRejection(); - const read = promisify(fs.read); const write = promisify(fs.write); const exists = promisify(fs.exists); diff --git a/test/parallel/test-fs-stat-bigint.js b/test/parallel/test-fs-stat-bigint.js index 6d0a064def5d25..943c0d55d86ba8 100644 --- a/test/parallel/test-fs-stat-bigint.js +++ b/test/parallel/test-fs-stat-bigint.js @@ -8,7 +8,6 @@ const path = require('path'); const tmpdir = require('../common/tmpdir'); const { isDate } = require('util').types; -common.crashOnUnhandledRejection(); tmpdir.refresh(); const fn = path.join(tmpdir.path, 'test-file'); diff --git a/test/parallel/test-http-agent.js b/test/parallel/test-http-agent.js index 6dc7f75ce0bc05..4ff781ecb95f91 100644 --- a/test/parallel/test-http-agent.js +++ b/test/parallel/test-http-agent.js @@ -24,7 +24,6 @@ const common = require('../common'); const Countdown = require('../common/countdown'); const assert = require('assert'); const http = require('http'); -common.crashOnUnhandledRejection(); const N = 4; const M = 4; diff --git a/test/parallel/test-http2-backpressure.js b/test/parallel/test-http2-backpressure.js index 9b69dddbfd2e26..db58e8da33df33 100644 --- a/test/parallel/test-http2-backpressure.js +++ b/test/parallel/test-http2-backpressure.js @@ -9,8 +9,6 @@ const assert = require('assert'); const http2 = require('http2'); const makeDuplexPair = require('../common/duplexpair'); -common.crashOnUnhandledRejection(); - { let req; const server = http2.createServer(); diff --git a/test/parallel/test-http2-client-promisify-connect.js b/test/parallel/test-http2-client-promisify-connect.js index 2eb7da3b9cfd85..3e41bee49bb5c3 100644 --- a/test/parallel/test-http2-client-promisify-connect.js +++ b/test/parallel/test-http2-client-promisify-connect.js @@ -1,7 +1,6 @@ 'use strict'; const common = require('../common'); -common.crashOnUnhandledRejection(); if (!common.hasCrypto) common.skip('missing crypto'); @@ -18,7 +17,6 @@ server.listen(0, common.mustCall(() => { const connect = util.promisify(http2.connect); connect(`http://localhost:${server.address().port}`) - .catch(common.mustNotCall()) .then(common.mustCall((client) => { assert(client); const req = client.request(); diff --git a/test/parallel/test-http2-window-size.js b/test/parallel/test-http2-window-size.js index 3d1c14de847e48..164a778e1f8c54 100644 --- a/test/parallel/test-http2-window-size.js +++ b/test/parallel/test-http2-window-size.js @@ -10,7 +10,6 @@ if (!common.hasCrypto) common.skip('missing crypto'); const assert = require('assert'); const h2 = require('http2'); -common.crashOnUnhandledRejection(); // Given a list of buffers and an initial window size, have a server write // each buffer to the HTTP2 Writable stream, and let the client verify that diff --git a/test/parallel/test-inspect-async-hook-setup-at-inspect.js b/test/parallel/test-inspect-async-hook-setup-at-inspect.js index 6b1c875138ba01..48de93c061479b 100644 --- a/test/parallel/test-inspect-async-hook-setup-at-inspect.js +++ b/test/parallel/test-inspect-async-hook-setup-at-inspect.js @@ -3,7 +3,6 @@ const common = require('../common'); common.skipIfInspectorDisabled(); common.skipIf32Bits(); -common.crashOnUnhandledRejection(); const { NodeInstance } = require('../common/inspector-helper.js'); const assert = require('assert'); diff --git a/test/parallel/test-inspector-esm.js b/test/parallel/test-inspector-esm.js index 62f0feefade88d..d94f8d10bb08ca 100644 --- a/test/parallel/test-inspector-esm.js +++ b/test/parallel/test-inspector-esm.js @@ -110,6 +110,4 @@ async function runTest() { assert.strictEqual((await child.expectShutdown()).exitCode, 55); } -common.crashOnUnhandledRejection(); - runTest(); diff --git a/test/parallel/test-inspector-multisession-js.js b/test/parallel/test-inspector-multisession-js.js index c899eeae713908..097b77e2c24231 100644 --- a/test/parallel/test-inspector-multisession-js.js +++ b/test/parallel/test-inspector-multisession-js.js @@ -54,8 +54,6 @@ async function test() { console.log('Sessions were disconnected'); } -common.crashOnUnhandledRejection(); - const interval = setInterval(() => {}, 1000); test().then(() => { clearInterval(interval); diff --git a/test/parallel/test-inspector-multisession-ws.js b/test/parallel/test-inspector-multisession-ws.js index d17adab2f486cc..02fde12e1c1c2f 100644 --- a/test/parallel/test-inspector-multisession-ws.js +++ b/test/parallel/test-inspector-multisession-ws.js @@ -70,6 +70,4 @@ async function runTest() { return child.expectShutdown(); } -common.crashOnUnhandledRejection(); - runTest(); diff --git a/test/parallel/test-inspector-reported-host.js b/test/parallel/test-inspector-reported-host.js index f54ea16625d218..142003e49f747c 100644 --- a/test/parallel/test-inspector-reported-host.js +++ b/test/parallel/test-inspector-reported-host.js @@ -7,8 +7,6 @@ common.skipIfInspectorDisabled(); const assert = require('assert'); const { NodeInstance } = require('../common/inspector-helper.js'); -common.crashOnUnhandledRejection(); - async function test() { const madeUpHost = '111.111.111.111:11111'; const child = new NodeInstance(undefined, 'var a = 1'); diff --git a/test/parallel/test-inspector-tracing-domain.js b/test/parallel/test-inspector-tracing-domain.js index 7cbb4325709ecb..9c6fa471b5a39b 100644 --- a/test/parallel/test-inspector-tracing-domain.js +++ b/test/parallel/test-inspector-tracing-domain.js @@ -65,6 +65,4 @@ async function test() { console.log('Success'); } -common.crashOnUnhandledRejection(); - test(); diff --git a/test/parallel/test-internal-module-wrap.js b/test/parallel/test-internal-module-wrap.js index bb4a648ef7f684..99f1e9d6e70e69 100644 --- a/test/parallel/test-internal-module-wrap.js +++ b/test/parallel/test-internal-module-wrap.js @@ -2,8 +2,7 @@ // Flags: --expose-internals -const common = require('../common'); -common.crashOnUnhandledRejection(); +require('../common'); const assert = require('assert'); const { ModuleWrap } = require('internal/test/binding'); diff --git a/test/parallel/test-microtask-queue-integration-domain.js b/test/parallel/test-microtask-queue-integration-domain.js index 8a4a06f9ffbe5e..98da703ee51429 100644 --- a/test/parallel/test-microtask-queue-integration-domain.js +++ b/test/parallel/test-microtask-queue-integration-domain.js @@ -20,7 +20,7 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; -const common = require('../common'); +require('../common'); const assert = require('assert'); // Requiring the domain module here changes the function that is used by node to @@ -30,8 +30,6 @@ const assert = require('assert'); // removed. require('domain'); -common.crashOnUnhandledRejection(); - const implementations = [ function(fn) { Promise.resolve().then(fn); diff --git a/test/parallel/test-microtask-queue-integration.js b/test/parallel/test-microtask-queue-integration.js index a7241d99ee9395..57c384f8ba8177 100644 --- a/test/parallel/test-microtask-queue-integration.js +++ b/test/parallel/test-microtask-queue-integration.js @@ -20,11 +20,9 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; -const common = require('../common'); +require('../common'); const assert = require('assert'); -common.crashOnUnhandledRejection(); - const implementations = [ function(fn) { Promise.resolve().then(fn); diff --git a/test/parallel/test-microtask-queue-run-domain.js b/test/parallel/test-microtask-queue-run-domain.js index a895504fc2972a..39baf930232411 100644 --- a/test/parallel/test-microtask-queue-run-domain.js +++ b/test/parallel/test-microtask-queue-run-domain.js @@ -20,7 +20,7 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; -const common = require('../common'); +require('../common'); const assert = require('assert'); // Requiring the domain module here changes the function that is used by node to @@ -30,8 +30,6 @@ const assert = require('assert'); // removed. require('domain'); -common.crashOnUnhandledRejection(); - function enqueueMicrotask(fn) { Promise.resolve().then(fn); } diff --git a/test/parallel/test-microtask-queue-run-immediate-domain.js b/test/parallel/test-microtask-queue-run-immediate-domain.js index 807affd0589861..60b17bc38c2670 100644 --- a/test/parallel/test-microtask-queue-run-immediate-domain.js +++ b/test/parallel/test-microtask-queue-run-immediate-domain.js @@ -20,7 +20,7 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; -const common = require('../common'); +require('../common'); const assert = require('assert'); // Requiring the domain module here changes the function that is used by node to @@ -30,8 +30,6 @@ const assert = require('assert'); // removed. require('domain'); -common.crashOnUnhandledRejection(); - function enqueueMicrotask(fn) { Promise.resolve().then(fn); } diff --git a/test/parallel/test-microtask-queue-run-immediate.js b/test/parallel/test-microtask-queue-run-immediate.js index 1e26f4beebfbe4..4d998cf0b8a59c 100644 --- a/test/parallel/test-microtask-queue-run-immediate.js +++ b/test/parallel/test-microtask-queue-run-immediate.js @@ -20,11 +20,9 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; -const common = require('../common'); +require('../common'); const assert = require('assert'); -common.crashOnUnhandledRejection(); - function enqueueMicrotask(fn) { Promise.resolve().then(fn); } diff --git a/test/parallel/test-microtask-queue-run.js b/test/parallel/test-microtask-queue-run.js index ba9cf6731ef75b..85eb770da1e0ff 100644 --- a/test/parallel/test-microtask-queue-run.js +++ b/test/parallel/test-microtask-queue-run.js @@ -20,11 +20,9 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; -const common = require('../common'); +require('../common'); const assert = require('assert'); -common.crashOnUnhandledRejection(); - function enqueueMicrotask(fn) { Promise.resolve().then(fn); } diff --git a/test/parallel/test-net-server-max-connections-close-makes-more-available.js b/test/parallel/test-net-server-max-connections-close-makes-more-available.js index eb045c704c637c..f607f28c10eaa2 100644 --- a/test/parallel/test-net-server-max-connections-close-makes-more-available.js +++ b/test/parallel/test-net-server-max-connections-close-makes-more-available.js @@ -1,9 +1,8 @@ 'use strict'; -const common = require('../common'); +require('../common'); const assert = require('assert'); const net = require('net'); -common.crashOnUnhandledRejection(); // Sets the server's maxConnections property to 1. // Open 2 connections (connection 0 and connection 1). @@ -84,8 +83,3 @@ process.on('exit', function() { // ...but that only connections 0 and 2 were successful. assert.deepStrictEqual(received, ['0', '2']); }); - -process.on('unhandledRejection', function() { - console.error('promise rejected'); - assert.fail('A promise in the chain rejected'); -}); diff --git a/test/parallel/test-promises-unhandled-proxy-rejections.js b/test/parallel/test-promises-unhandled-proxy-rejections.js index dfd1ee322a6443..83062e9520165b 100644 --- a/test/parallel/test-promises-unhandled-proxy-rejections.js +++ b/test/parallel/test-promises-unhandled-proxy-rejections.js @@ -1,6 +1,8 @@ 'use strict'; const common = require('../common'); +common.disableCrashOnUnhandledRejection(); + const expectedDeprecationWarning = ['Unhandled promise rejections are ' + 'deprecated. In the future, promise ' + 'rejections that are not handled will ' + diff --git a/test/parallel/test-promises-unhandled-rejections.js b/test/parallel/test-promises-unhandled-rejections.js index 1ade061994c3bb..92b6d7a96147a1 100644 --- a/test/parallel/test-promises-unhandled-rejections.js +++ b/test/parallel/test-promises-unhandled-rejections.js @@ -1,8 +1,10 @@ 'use strict'; -require('../common'); +const common = require('../common'); const assert = require('assert'); const domain = require('domain'); +common.disableCrashOnUnhandledRejection(); + const asyncTest = (function() { let asyncTestsEnabled = false; let asyncTestLastCheck; diff --git a/test/parallel/test-promises-unhandled-symbol-rejections.js b/test/parallel/test-promises-unhandled-symbol-rejections.js index e5084b50c189fd..2102de81918bd7 100644 --- a/test/parallel/test-promises-unhandled-symbol-rejections.js +++ b/test/parallel/test-promises-unhandled-symbol-rejections.js @@ -1,6 +1,8 @@ 'use strict'; const common = require('../common'); +common.disableCrashOnUnhandledRejection(); + const expectedValueWarning = ['Symbol()', common.noWarnCode]; const expectedDeprecationWarning = ['Unhandled promise rejections are ' + 'deprecated. In the future, promise ' + diff --git a/test/parallel/test-promises-warning-on-unhandled-rejection.js b/test/parallel/test-promises-warning-on-unhandled-rejection.js index 3ac7d8698beb37..ba420157e72bbd 100644 --- a/test/parallel/test-promises-warning-on-unhandled-rejection.js +++ b/test/parallel/test-promises-warning-on-unhandled-rejection.js @@ -7,6 +7,8 @@ const common = require('../common'); const assert = require('assert'); +common.disableCrashOnUnhandledRejection(); + let b = 0; process.on('warning', common.mustCall((warning) => { diff --git a/test/parallel/test-repl-load-multiline.js b/test/parallel/test-repl-load-multiline.js index 8ab878ae768ddd..fd58a3c21dd884 100644 --- a/test/parallel/test-repl-load-multiline.js +++ b/test/parallel/test-repl-load-multiline.js @@ -4,8 +4,6 @@ const fixtures = require('../common/fixtures'); const assert = require('assert'); const repl = require('repl'); -common.crashOnUnhandledRejection(); - const command = `.load ${fixtures.path('repl-load-multiline.js')}`; const terminalCode = '\u001b[1G\u001b[0J \u001b[1G'; const terminalCodeRegex = new RegExp(terminalCode.replace(/\[/g, '\\['), 'g'); diff --git a/test/parallel/test-repl-top-level-await.js b/test/parallel/test-repl-top-level-await.js index 5a07f5ced14450..f1e2303938b7a6 100644 --- a/test/parallel/test-repl-top-level-await.js +++ b/test/parallel/test-repl-top-level-await.js @@ -5,8 +5,6 @@ const assert = require('assert'); const { stripVTControlCharacters } = require('internal/readline'); const repl = require('repl'); -common.crashOnUnhandledRejection(); - // Flags: --expose-internals --experimental-repl-await const PROMPT = 'await repl > '; diff --git a/test/parallel/test-repl.js b/test/parallel/test-repl.js index 5459371f00c24d..35cd3e11afab53 100644 --- a/test/parallel/test-repl.js +++ b/test/parallel/test-repl.js @@ -26,8 +26,6 @@ const assert = require('assert'); const net = require('net'); const repl = require('repl'); -common.crashOnUnhandledRejection(); - const message = 'Read, Eval, Print Loop'; const prompt_unix = 'node via Unix socket> '; const prompt_tcp = 'node via TCP socket> '; diff --git a/test/parallel/test-stream-finished.js b/test/parallel/test-stream-finished.js index 2b0c156eb06845..3aade5610c7045 100644 --- a/test/parallel/test-stream-finished.js +++ b/test/parallel/test-stream-finished.js @@ -6,8 +6,6 @@ const assert = require('assert'); const fs = require('fs'); const { promisify } = require('util'); -common.crashOnUnhandledRejection(); - { const rs = new Readable({ read() {} diff --git a/test/parallel/test-stream-pipeline.js b/test/parallel/test-stream-pipeline.js index f735054e88e9b8..6f9bca811f5728 100644 --- a/test/parallel/test-stream-pipeline.js +++ b/test/parallel/test-stream-pipeline.js @@ -9,8 +9,6 @@ const http = require('http'); const http2 = require('http2'); const { promisify } = require('util'); -common.crashOnUnhandledRejection(); - { let finished = false; const processed = []; diff --git a/test/parallel/test-stream-readable-async-iterators.js b/test/parallel/test-stream-readable-async-iterators.js index 39761b413260f1..d8eb83a58506d1 100644 --- a/test/parallel/test-stream-readable-async-iterators.js +++ b/test/parallel/test-stream-readable-async-iterators.js @@ -4,8 +4,6 @@ const common = require('../common'); const { Readable } = require('stream'); const assert = require('assert'); -common.crashOnUnhandledRejection(); - async function tests() { await (async function() { console.log('read without for..await'); diff --git a/test/parallel/test-timers-promisified.js b/test/parallel/test-timers-promisified.js index 1dad1d8cfc0d1c..85e7093cfa185f 100644 --- a/test/parallel/test-timers-promisified.js +++ b/test/parallel/test-timers-promisified.js @@ -6,8 +6,6 @@ const { promisify } = require('util'); /* eslint-disable no-restricted-syntax */ -common.crashOnUnhandledRejection(); - const setTimeout = promisify(timers.setTimeout); const setImmediate = promisify(timers.setImmediate); diff --git a/test/parallel/test-util-inspect-namespace.js b/test/parallel/test-util-inspect-namespace.js index fddbcdb34697d9..e73f475cff55cc 100644 --- a/test/parallel/test-util-inspect-namespace.js +++ b/test/parallel/test-util-inspect-namespace.js @@ -2,11 +2,9 @@ // Flags: --experimental-vm-modules -const common = require('../common'); +require('../common'); const assert = require('assert'); -common.crashOnUnhandledRejection(); - const { Module } = require('vm'); const { inspect } = require('util'); diff --git a/test/parallel/test-util-promisify.js b/test/parallel/test-util-promisify.js index 5e1994a730d733..0bece0df426b7b 100644 --- a/test/parallel/test-util-promisify.js +++ b/test/parallel/test-util-promisify.js @@ -7,8 +7,6 @@ const vm = require('vm'); const { promisify } = require('util'); const { customPromisifyArgs } = require('internal/util'); -common.crashOnUnhandledRejection(); - const stat = promisify(fs.stat); { diff --git a/test/parallel/test-util-types.js b/test/parallel/test-util-types.js index de5a89ab4abc80..59a9dcceb59d6a 100644 --- a/test/parallel/test-util-types.js +++ b/test/parallel/test-util-types.js @@ -1,14 +1,12 @@ // Flags: --harmony-bigint --experimental-vm-modules 'use strict'; -const common = require('../common'); +require('../common'); const fixtures = require('../common/fixtures'); const assert = require('assert'); const { types, inspect } = require('util'); const vm = require('vm'); const { JSStream } = process.binding('js_stream'); -common.crashOnUnhandledRejection(); - const external = (new JSStream())._externalStream; const wasmBuffer = fixtures.readSync('test.wasm'); diff --git a/test/parallel/test-vm-module-basic.js b/test/parallel/test-vm-module-basic.js index 4bbe0a95ee6724..1f699ddf5b4334 100644 --- a/test/parallel/test-vm-module-basic.js +++ b/test/parallel/test-vm-module-basic.js @@ -6,8 +6,6 @@ const common = require('../common'); const assert = require('assert'); const { Module, createContext } = require('vm'); -common.crashOnUnhandledRejection(); - (async function test1() { const context = createContext({ foo: 'bar', diff --git a/test/parallel/test-vm-module-dynamic-import.js b/test/parallel/test-vm-module-dynamic-import.js index ca4dceb5def731..bb45337cf1a83c 100644 --- a/test/parallel/test-vm-module-dynamic-import.js +++ b/test/parallel/test-vm-module-dynamic-import.js @@ -3,7 +3,6 @@ // Flags: --experimental-vm-modules --experimental-modules --harmony-dynamic-import const common = require('../common'); -common.crashOnUnhandledRejection(); const assert = require('assert'); const { Module, createContext } = require('vm'); diff --git a/test/parallel/test-vm-module-errors.js b/test/parallel/test-vm-module-errors.js index 424d35e8aaf67a..720f28525b4d35 100644 --- a/test/parallel/test-vm-module-errors.js +++ b/test/parallel/test-vm-module-errors.js @@ -3,7 +3,6 @@ // Flags: --experimental-vm-modules const common = require('../common'); -common.crashOnUnhandledRejection(); const assert = require('assert'); diff --git a/test/parallel/test-vm-module-import-meta.js b/test/parallel/test-vm-module-import-meta.js index 835ef5b6eb5de0..5e97f1ac541d54 100644 --- a/test/parallel/test-vm-module-import-meta.js +++ b/test/parallel/test-vm-module-import-meta.js @@ -6,8 +6,6 @@ const common = require('../common'); const assert = require('assert'); const { Module } = require('vm'); -common.crashOnUnhandledRejection(); - async function testBasic() { const m = new Module('import.meta;', { initializeImportMeta: common.mustCall((meta, module) => { diff --git a/test/parallel/test-vm-module-link.js b/test/parallel/test-vm-module-link.js index d9ee8e7767f43a..ead6721bd4564f 100644 --- a/test/parallel/test-vm-module-link.js +++ b/test/parallel/test-vm-module-link.js @@ -3,7 +3,6 @@ // Flags: --experimental-vm-modules const common = require('../common'); -common.crashOnUnhandledRejection(); const assert = require('assert'); const { URL } = require('url'); diff --git a/test/parallel/test-vm-module-reevaluate.js b/test/parallel/test-vm-module-reevaluate.js index e4f5858800e297..e08ab734501ff2 100644 --- a/test/parallel/test-vm-module-reevaluate.js +++ b/test/parallel/test-vm-module-reevaluate.js @@ -3,7 +3,6 @@ // Flags: --experimental-vm-modules const common = require('../common'); -common.crashOnUnhandledRejection(); const assert = require('assert'); diff --git a/test/parallel/test-wasm-simple.js b/test/parallel/test-wasm-simple.js index 02a97ec2c9455f..f00f10c436650a 100644 --- a/test/parallel/test-wasm-simple.js +++ b/test/parallel/test-wasm-simple.js @@ -1,11 +1,9 @@ 'use strict'; -const common = require('../common'); +require('../common'); const assert = require('assert'); const fixtures = require('../common/fixtures'); -common.crashOnUnhandledRejection(); - const buffer = fixtures.readSync('test.wasm'); assert.ok(WebAssembly.validate(buffer), 'Buffer should be valid WebAssembly'); diff --git a/test/parallel/test-zlib-empty-buffer.js b/test/parallel/test-zlib-empty-buffer.js index 8b299f8728282d..e351db54571732 100644 --- a/test/parallel/test-zlib-empty-buffer.js +++ b/test/parallel/test-zlib-empty-buffer.js @@ -1,12 +1,10 @@ 'use strict'; -const common = require('../common'); +require('../common'); const zlib = require('zlib'); const { inspect, promisify } = require('util'); const assert = require('assert'); const emptyBuffer = Buffer.alloc(0); -common.crashOnUnhandledRejection(); - (async function() { for (const [ compress, decompress, method ] of [ [ zlib.deflateRawSync, zlib.inflateRawSync, 'raw sync' ], diff --git a/test/parallel/test-zlib-flush-multiple-scheduled.js b/test/parallel/test-zlib-flush-multiple-scheduled.js index 19548672389fde..0b752557e441bc 100644 --- a/test/parallel/test-zlib-flush-multiple-scheduled.js +++ b/test/parallel/test-zlib-flush-multiple-scheduled.js @@ -8,8 +8,6 @@ const { Z_PARTIAL_FLUSH, Z_SYNC_FLUSH, Z_FULL_FLUSH, Z_FINISH } = zlib.constants; -common.crashOnUnhandledRejection(); - async function getOutput(...sequenceOfFlushes) { const zipper = zlib.createGzip({ highWaterMark: 16384 }); diff --git a/test/sequential/test-async-wrap-getasyncid.js b/test/sequential/test-async-wrap-getasyncid.js index cae156f790cef6..2a2737497a9d70 100644 --- a/test/sequential/test-async-wrap-getasyncid.js +++ b/test/sequential/test-async-wrap-getasyncid.js @@ -11,8 +11,6 @@ const fixtures = require('../common/fixtures'); const tmpdir = require('../common/tmpdir'); const { getSystemErrorName } = require('util'); -common.crashOnUnhandledRejection(); - // Make sure that all Providers are tested. { const hooks = require('async_hooks').createHook({ @@ -198,7 +196,7 @@ if (common.hasCrypto) { // eslint-disable-line node-core/crypto-check testInitialized(fd, 'FileHandle'); await fd.close(); } - openTest().then(common.mustCall()).catch(common.mustNotCall()); + openTest().then(common.mustCall()); } { diff --git a/test/sequential/test-inspector-async-call-stack-abort.js b/test/sequential/test-inspector-async-call-stack-abort.js index 1ec46ab3cfeb9d..946d6dc1920d6b 100644 --- a/test/sequential/test-inspector-async-call-stack-abort.js +++ b/test/sequential/test-inspector-async-call-stack-abort.js @@ -9,6 +9,7 @@ const { strictEqual } = require('assert'); const eyecatcher = 'nou, houdoe he?'; if (process.argv[2] === 'child') { + common.disableCrashOnUnhandledRejection(); const { Session } = require('inspector'); const { promisify } = require('util'); const { registerAsyncHook } = process.binding('inspector'); diff --git a/test/sequential/test-inspector-async-hook-setup-at-inspect-brk.js b/test/sequential/test-inspector-async-hook-setup-at-inspect-brk.js index e0c3b4dcb86e37..9a2822e8f5740d 100644 --- a/test/sequential/test-inspector-async-hook-setup-at-inspect-brk.js +++ b/test/sequential/test-inspector-async-hook-setup-at-inspect-brk.js @@ -3,7 +3,6 @@ const common = require('../common'); common.skipIfInspectorDisabled(); common.skipIf32Bits(); -common.crashOnUnhandledRejection(); const { NodeInstance } = require('../common/inspector-helper.js'); const assert = require('assert'); diff --git a/test/sequential/test-inspector-async-hook-setup-at-signal.js b/test/sequential/test-inspector-async-hook-setup-at-signal.js index e0b87b0ebb162c..6f8ccfacb9964c 100644 --- a/test/sequential/test-inspector-async-hook-setup-at-signal.js +++ b/test/sequential/test-inspector-async-hook-setup-at-signal.js @@ -3,7 +3,6 @@ const common = require('../common'); common.skipIfInspectorDisabled(); common.skipIf32Bits(); -common.crashOnUnhandledRejection(); const { NodeInstance } = require('../common/inspector-helper.js'); const assert = require('assert'); diff --git a/test/sequential/test-inspector-async-stack-traces-promise-then.js b/test/sequential/test-inspector-async-stack-traces-promise-then.js index e803be7167f592..0acb603147b798 100644 --- a/test/sequential/test-inspector-async-stack-traces-promise-then.js +++ b/test/sequential/test-inspector-async-stack-traces-promise-then.js @@ -3,7 +3,6 @@ const common = require('../common'); common.skipIfInspectorDisabled(); common.skipIf32Bits(); -common.crashOnUnhandledRejection(); const { NodeInstance } = require('../common/inspector-helper'); const assert = require('assert'); diff --git a/test/sequential/test-inspector-async-stack-traces-set-interval.js b/test/sequential/test-inspector-async-stack-traces-set-interval.js index 326032d40b20e6..fd294296cb035d 100644 --- a/test/sequential/test-inspector-async-stack-traces-set-interval.js +++ b/test/sequential/test-inspector-async-stack-traces-set-interval.js @@ -3,7 +3,6 @@ const common = require('../common'); common.skipIfInspectorDisabled(); common.skipIf32Bits(); -common.crashOnUnhandledRejection(); const { NodeInstance } = require('../common/inspector-helper'); const assert = require('assert'); diff --git a/test/sequential/test-inspector-bindings.js b/test/sequential/test-inspector-bindings.js index c23c8520e0601d..bea8b552202087 100644 --- a/test/sequential/test-inspector-bindings.js +++ b/test/sequential/test-inspector-bindings.js @@ -115,8 +115,6 @@ async function testNoCrashConsoleLogBeforeThrow() { session.disconnect(); } -common.crashOnUnhandledRejection(); - async function doTests() { await testNoCrashWithExceptionInCallback(); testSampleDebugSession(); diff --git a/test/sequential/test-inspector-break-e.js b/test/sequential/test-inspector-break-e.js index 8db403ad2cd0d0..567ef7911c446d 100644 --- a/test/sequential/test-inspector-break-e.js +++ b/test/sequential/test-inspector-break-e.js @@ -3,7 +3,6 @@ const common = require('../common'); common.skipIfInspectorDisabled(); -common.crashOnUnhandledRejection(); const assert = require('assert'); const { NodeInstance } = require('../common/inspector-helper.js'); diff --git a/test/sequential/test-inspector-break-when-eval.js b/test/sequential/test-inspector-break-when-eval.js index b14e01a30185ed..8be5285221d513 100644 --- a/test/sequential/test-inspector-break-when-eval.js +++ b/test/sequential/test-inspector-break-when-eval.js @@ -65,5 +65,4 @@ async function runTests() { assert.strictEqual(0, (await child.expectShutdown()).exitCode); } -common.crashOnUnhandledRejection(); runTests(); diff --git a/test/sequential/test-inspector-console.js b/test/sequential/test-inspector-console.js index 6a06c798881654..3d36e9328dd529 100644 --- a/test/sequential/test-inspector-console.js +++ b/test/sequential/test-inspector-console.js @@ -35,5 +35,4 @@ async function runTest() { session.disconnect(); } -common.crashOnUnhandledRejection(); runTest(); diff --git a/test/sequential/test-inspector-contexts.js b/test/sequential/test-inspector-contexts.js index fb59e9dee14892..d2285e82536326 100644 --- a/test/sequential/test-inspector-contexts.js +++ b/test/sequential/test-inspector-contexts.js @@ -151,5 +151,4 @@ async function testBreakpointHit() { await pausedPromise; } -common.crashOnUnhandledRejection(); testContextCreatedAndDestroyed().then(testBreakpointHit); diff --git a/test/sequential/test-inspector-debug-brk-flag.js b/test/sequential/test-inspector-debug-brk-flag.js index 61eb4f97c655dc..0e5df52560d2b1 100644 --- a/test/sequential/test-inspector-debug-brk-flag.js +++ b/test/sequential/test-inspector-debug-brk-flag.js @@ -37,5 +37,4 @@ async function runTests() { assert.strictEqual(55, (await child.expectShutdown()).exitCode); } -common.crashOnUnhandledRejection(); runTests(); diff --git a/test/sequential/test-inspector-debug-end.js b/test/sequential/test-inspector-debug-end.js index dadee26258d346..d73e7dccc1a8fe 100644 --- a/test/sequential/test-inspector-debug-end.js +++ b/test/sequential/test-inspector-debug-end.js @@ -42,6 +42,4 @@ async function runTest() { await testSessionNoCrash(); } -common.crashOnUnhandledRejection(); - runTest(); diff --git a/test/sequential/test-inspector-exception.js b/test/sequential/test-inspector-exception.js index 3f83b37c7265a8..ef67e1d9a57264 100644 --- a/test/sequential/test-inspector-exception.js +++ b/test/sequential/test-inspector-exception.js @@ -41,6 +41,4 @@ async function runTest() { assert.strictEqual(1, (await child.expectShutdown()).exitCode); } -common.crashOnUnhandledRejection(); - runTest(); diff --git a/test/sequential/test-inspector-ip-detection.js b/test/sequential/test-inspector-ip-detection.js index 14be5e6824a4a2..4e0f9b871b8ab0 100644 --- a/test/sequential/test-inspector-ip-detection.js +++ b/test/sequential/test-inspector-ip-detection.js @@ -44,6 +44,4 @@ async function test() { instance.kill(); } -common.crashOnUnhandledRejection(); - test(); diff --git a/test/sequential/test-inspector-not-blocked-on-idle.js b/test/sequential/test-inspector-not-blocked-on-idle.js index 3b1befe35df199..b5a16316dece9f 100644 --- a/test/sequential/test-inspector-not-blocked-on-idle.js +++ b/test/sequential/test-inspector-not-blocked-on-idle.js @@ -18,5 +18,4 @@ async function runTests() { node.kill(); } -common.crashOnUnhandledRejection(); runTests(); diff --git a/test/sequential/test-inspector-overwrite-config.js b/test/sequential/test-inspector-overwrite-config.js index 46cb922402f360..49f48a59a04b4f 100644 --- a/test/sequential/test-inspector-overwrite-config.js +++ b/test/sequential/test-inspector-overwrite-config.js @@ -36,8 +36,6 @@ async function testConsoleLog() { session.disconnect(); } -common.crashOnUnhandledRejection(); - async function runTests() { await testConsoleLog(); assert.ok(asserted, 'log statement did not reach the inspector'); diff --git a/test/sequential/test-inspector-port-cluster.js b/test/sequential/test-inspector-port-cluster.js index dfaf59c711cd13..f7bebd926e9780 100644 --- a/test/sequential/test-inspector-port-cluster.js +++ b/test/sequential/test-inspector-port-cluster.js @@ -2,7 +2,6 @@ const common = require('../common'); -common.crashOnUnhandledRejection(); common.skipIfInspectorDisabled(); const assert = require('assert'); diff --git a/test/sequential/test-inspector-scriptparsed-context.js b/test/sequential/test-inspector-scriptparsed-context.js index abffbfe5fc67f2..1e862e9174cb3f 100644 --- a/test/sequential/test-inspector-scriptparsed-context.js +++ b/test/sequential/test-inspector-scriptparsed-context.js @@ -2,7 +2,6 @@ 'use strict'; const common = require('../common'); common.skipIfInspectorDisabled(); -common.crashOnUnhandledRejection(); const { NodeInstance } = require('../common/inspector-helper.js'); const assert = require('assert'); diff --git a/test/sequential/test-inspector-stop-profile-after-done.js b/test/sequential/test-inspector-stop-profile-after-done.js index 678f98a556c099..cde1a0256067fe 100644 --- a/test/sequential/test-inspector-stop-profile-after-done.js +++ b/test/sequential/test-inspector-stop-profile-after-done.js @@ -28,5 +28,4 @@ async function runTests() { assert.strictEqual((await child.expectShutdown()).exitCode, 0); } -common.crashOnUnhandledRejection(); runTests(); diff --git a/test/sequential/test-inspector-stress-http.js b/test/sequential/test-inspector-stress-http.js index 4787c35e32c899..fd168f29f7bb0f 100644 --- a/test/sequential/test-inspector-stress-http.js +++ b/test/sequential/test-inspector-stress-http.js @@ -29,6 +29,4 @@ async function runTest() { return child.kill(); } -common.crashOnUnhandledRejection(); - runTest(); diff --git a/test/sequential/test-inspector.js b/test/sequential/test-inspector.js index 0a9b2ccd1abd3d..ba1fce25a04fad 100644 --- a/test/sequential/test-inspector.js +++ b/test/sequential/test-inspector.js @@ -292,6 +292,4 @@ async function runTest() { assert.strictEqual(55, (await child.expectShutdown()).exitCode); } -common.crashOnUnhandledRejection(); - runTest();