summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichaël Zasso <targos@protonmail.com>2018-07-17 08:23:49 +0200
committerMichaël Zasso <targos@protonmail.com>2018-07-19 08:47:28 +0200
commitdf08779e0dfa82ceb69e129ae0548e97352aaddf (patch)
treea589930afbeaf5481f3fe614eeee05fc04b7ec35
parent373aae1f86c1d061123e3aec28980aa2e7d1ebd4 (diff)
downloadandroid-node-v8-df08779e0dfa82ceb69e129ae0548e97352aaddf.tar.gz
android-node-v8-df08779e0dfa82ceb69e129ae0548e97352aaddf.tar.bz2
android-node-v8-df08779e0dfa82ceb69e129ae0548e97352aaddf.zip
test: make crashOnUnhandleRejection opt-out
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 <tniessen@tnie.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
-rw-r--r--doc/guides/writing-tests.md28
-rw-r--r--test/addons-napi/test_promise/test.js2
-rw-r--r--test/addons-napi/test_threadsafe_function/test.js2
-rw-r--r--test/addons/callback-scope/test-resolve-async.js2
-rw-r--r--test/addons/make-callback-recurse/test.js2
-rw-r--r--test/async-hooks/test-promise.chain-promise-before-init-hooks.js2
-rw-r--r--test/async-hooks/test-promise.js2
-rw-r--r--test/common/README.md15
-rw-r--r--test/common/index.js7
-rw-r--r--test/common/index.mjs4
-rw-r--r--test/common/inspector-helper.js1
-rw-r--r--test/es-module/test-esm-dynamic-import.js2
-rw-r--r--test/es-module/test-esm-error-cache.js4
-rw-r--r--test/es-module/test-esm-loader-missing-dynamic-instantiate-hook.mjs7
-rw-r--r--test/es-module/test-esm-throw-undefined.mjs4
-rw-r--r--test/internet/test-dns-any.js2
-rw-r--r--test/internet/test-dns-ipv4.js2
-rw-r--r--test/internet/test-dns-ipv6.js2
-rw-r--r--test/internet/test-dns-txt-sigsegv.js4
-rw-r--r--test/internet/test-dns.js2
-rw-r--r--test/known_issues/test-inspector-cluster-port-clash.js2
-rw-r--r--test/message/unhandled_promise_trace_warnings.js3
-rw-r--r--test/parallel/test-assert-async.js2
-rw-r--r--test/parallel/test-async-hooks-disable-during-promise.js1
-rw-r--r--test/parallel/test-async-hooks-enable-during-promise.js2
-rw-r--r--test/parallel/test-async-hooks-promise-enable-disable.js2
-rw-r--r--test/parallel/test-async-hooks-promise-triggerid.js2
-rw-r--r--test/parallel/test-async-wrap-pop-id-during-load.js3
-rw-r--r--test/parallel/test-async-wrap-promise-after-enabled.js2
-rw-r--r--test/parallel/test-c-ares.js2
-rw-r--r--test/parallel/test-child-process-promisified.js2
-rw-r--r--test/parallel/test-dns-lookup.js2
-rw-r--r--test/parallel/test-dns-promises-resolve.js2
-rw-r--r--test/parallel/test-dns-resolveany-bad-ancount.js2
-rw-r--r--test/parallel/test-dns-resolveany.js2
-rw-r--r--test/parallel/test-dns-resolvens-typeerror.js2
-rw-r--r--test/parallel/test-dns.js2
-rw-r--r--test/parallel/test-domain-promise.js2
-rw-r--r--test/parallel/test-fs-lchown.js2
-rw-r--r--test/parallel/test-fs-promises-file-handle-append-file.js1
-rw-r--r--test/parallel/test-fs-promises-file-handle-chmod.js1
-rw-r--r--test/parallel/test-fs-promises-file-handle-read.js1
-rw-r--r--test/parallel/test-fs-promises-file-handle-readFile.js1
-rw-r--r--test/parallel/test-fs-promises-file-handle-stat.js1
-rw-r--r--test/parallel/test-fs-promises-file-handle-sync.js4
-rw-r--r--test/parallel/test-fs-promises-file-handle-truncate.js1
-rw-r--r--test/parallel/test-fs-promises-file-handle-write.js1
-rw-r--r--test/parallel/test-fs-promises-file-handle-writeFile.js1
-rw-r--r--test/parallel/test-fs-promises-readfile-empty.js4
-rw-r--r--test/parallel/test-fs-promises-readfile.js2
-rw-r--r--test/parallel/test-fs-promises-writefile.js2
-rw-r--r--test/parallel/test-fs-promises.js5
-rw-r--r--test/parallel/test-fs-promisified.js2
-rw-r--r--test/parallel/test-fs-stat-bigint.js1
-rw-r--r--test/parallel/test-http-agent.js1
-rw-r--r--test/parallel/test-http2-backpressure.js2
-rw-r--r--test/parallel/test-http2-client-promisify-connect.js2
-rw-r--r--test/parallel/test-http2-window-size.js1
-rw-r--r--test/parallel/test-inspect-async-hook-setup-at-inspect.js1
-rw-r--r--test/parallel/test-inspector-esm.js2
-rw-r--r--test/parallel/test-inspector-multisession-js.js2
-rw-r--r--test/parallel/test-inspector-multisession-ws.js2
-rw-r--r--test/parallel/test-inspector-reported-host.js2
-rw-r--r--test/parallel/test-inspector-tracing-domain.js2
-rw-r--r--test/parallel/test-internal-module-wrap.js3
-rw-r--r--test/parallel/test-microtask-queue-integration-domain.js4
-rw-r--r--test/parallel/test-microtask-queue-integration.js4
-rw-r--r--test/parallel/test-microtask-queue-run-domain.js4
-rw-r--r--test/parallel/test-microtask-queue-run-immediate-domain.js4
-rw-r--r--test/parallel/test-microtask-queue-run-immediate.js4
-rw-r--r--test/parallel/test-microtask-queue-run.js4
-rw-r--r--test/parallel/test-net-server-max-connections-close-makes-more-available.js8
-rw-r--r--test/parallel/test-promises-unhandled-proxy-rejections.js2
-rw-r--r--test/parallel/test-promises-unhandled-rejections.js4
-rw-r--r--test/parallel/test-promises-unhandled-symbol-rejections.js2
-rw-r--r--test/parallel/test-promises-warning-on-unhandled-rejection.js2
-rw-r--r--test/parallel/test-repl-load-multiline.js2
-rw-r--r--test/parallel/test-repl-top-level-await.js2
-rw-r--r--test/parallel/test-repl.js2
-rw-r--r--test/parallel/test-stream-finished.js2
-rw-r--r--test/parallel/test-stream-pipeline.js2
-rw-r--r--test/parallel/test-stream-readable-async-iterators.js2
-rw-r--r--test/parallel/test-timers-promisified.js2
-rw-r--r--test/parallel/test-util-inspect-namespace.js4
-rw-r--r--test/parallel/test-util-promisify.js2
-rw-r--r--test/parallel/test-util-types.js4
-rw-r--r--test/parallel/test-vm-module-basic.js2
-rw-r--r--test/parallel/test-vm-module-dynamic-import.js1
-rw-r--r--test/parallel/test-vm-module-errors.js1
-rw-r--r--test/parallel/test-vm-module-import-meta.js2
-rw-r--r--test/parallel/test-vm-module-link.js1
-rw-r--r--test/parallel/test-vm-module-reevaluate.js1
-rw-r--r--test/parallel/test-wasm-simple.js4
-rw-r--r--test/parallel/test-zlib-empty-buffer.js4
-rw-r--r--test/parallel/test-zlib-flush-multiple-scheduled.js2
-rw-r--r--test/sequential/test-async-wrap-getasyncid.js4
-rw-r--r--test/sequential/test-inspector-async-call-stack-abort.js1
-rw-r--r--test/sequential/test-inspector-async-hook-setup-at-inspect-brk.js1
-rw-r--r--test/sequential/test-inspector-async-hook-setup-at-signal.js1
-rw-r--r--test/sequential/test-inspector-async-stack-traces-promise-then.js1
-rw-r--r--test/sequential/test-inspector-async-stack-traces-set-interval.js1
-rw-r--r--test/sequential/test-inspector-bindings.js2
-rw-r--r--test/sequential/test-inspector-break-e.js1
-rw-r--r--test/sequential/test-inspector-break-when-eval.js1
-rw-r--r--test/sequential/test-inspector-console.js1
-rw-r--r--test/sequential/test-inspector-contexts.js1
-rw-r--r--test/sequential/test-inspector-debug-brk-flag.js1
-rw-r--r--test/sequential/test-inspector-debug-end.js2
-rw-r--r--test/sequential/test-inspector-exception.js2
-rw-r--r--test/sequential/test-inspector-ip-detection.js2
-rw-r--r--test/sequential/test-inspector-not-blocked-on-idle.js1
-rw-r--r--test/sequential/test-inspector-overwrite-config.js2
-rw-r--r--test/sequential/test-inspector-port-cluster.js1
-rw-r--r--test/sequential/test-inspector-scriptparsed-context.js1
-rw-r--r--test/sequential/test-inspector-stop-profile-after-done.js1
-rw-r--r--test/sequential/test-inspector-stress-http.js2
-rw-r--r--test/sequential/test-inspector.js2
117 files changed, 58 insertions, 241 deletions
diff --git a/doc/guides/writing-tests.md b/doc/guides/writing-tests.md
index e4a9e296ff..2059a709ff 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 477ceb7596..feaa4ebfef 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 8d8a6d9d8c..d998853559 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 3e96234787..98e1910b49 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 a3ea399a49..102890cc96 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 873fd272cf..9046bc3514 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 d3070b7cbd..729704b792 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 41cc88aca1..3dee2f1970 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 [&lt;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
* [&lt;boolean>]
diff --git a/test/common/index.js b/test/common/index.js
index 1df37db54b..bcd28cc287 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 f73a9d9be5..8bf512f6b9 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 1372604979..84393c4281 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 9175717288..6a80da4947 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 22ffa9abe9..98244615ef 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 27447b3e43..f2b37f7e8a 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 8777281787..541127eee5 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 be5fc4b1ad..e8425a6ca5 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 837d45f2ad..1179cd6f5d 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 283b182390..b2cd6163e8 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 b572c6bb7f..9f65b6ec24 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 593d621e82..4608713927 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 51ae94f597..9fa2b48356 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 48450fb21e..d51a2cd3da 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 4b3664e0cb..30c9a741c6 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 ace9bca679..6b9b53bd30 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 29d25de980..ce3253b01c 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 b7692c45cd..150ccc88b0 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 507a8a4ada..467fddd359 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 ff3f637b87..31d2113eab 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 5df8f13c00..0d58cbd653 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 59ae40b2b8..8b1cf79868 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 0fa9c68a92..877bf06662 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 5ee3bc7051..3413bcffd8 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 fcaa8977a5..430f425137 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 d48d9385b8..4b13421b31 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 f9a6399cef..46694f2403 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 ec57bba614..5a72b54013 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 9acf18994e..3a44be9280 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 f1c966d4af..1c6e629560 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 23469eb279..bf8673c071 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 7766ac4c90..f9abef359e 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 8b9d8b1c0d..6b51639d41 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 621e63c075..13f8c27778 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 9e6fcc2784..c31e175019 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 7d44b8e3da..19ee365213 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 cf28df31cb..fc6d00c0b8 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 44d919a042..65f998db74 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 49df2bf54f..da8cfc0a4b 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 a53384cc22..e39c59f5ca 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 24c17655c6..ef15a26811 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 b1186ad217..ff25be75b8 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 1bb6945c67..858e90bc62 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 602f1191b7..26e1f8d71c 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 13cf5e0e0f..0744f62fd1 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 6d0a064def..943c0d55d8 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 6dc7f75ce0..4ff781ecb9 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 9b69dddbfd..db58e8da33 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 2eb7da3b9c..3e41bee49b 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 3d1c14de84..164a778e1f 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 6b1c875138..48de93c061 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 62f0feefad..d94f8d10bb 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 c899eeae71..097b77e2c2 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 d17adab2f4..02fde12e1c 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 f54ea16625..142003e49f 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 7cbb432570..9c6fa471b5 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 bb4a648ef7..99f1e9d6e7 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 8a4a06f9ff..98da703ee5 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 a7241d99ee..57c384f8ba 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 a895504fc2..39baf93023 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 807affd058..60b17bc38c 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 1e26f4beeb..4d998cf0b8 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 ba9cf6731e..85eb770da1 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 eb045c704c..f607f28c10 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 dfd1ee322a..83062e9520 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 1ade061994..92b6d7a961 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 e5084b50c1..2102de8191 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 3ac7d8698b..ba420157e7 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 8ab878ae76..fd58a3c21d 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 5a07f5ced1..f1e2303938 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 5459371f00..35cd3e11af 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 2b0c156eb0..3aade5610c 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 f735054e88..6f9bca811f 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 39761b4132..d8eb83a585 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 1dad1d8cfc..85e7093cfa 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 fddbcdb346..e73f475cff 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 5e1994a730..0bece0df42 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 de5a89ab4a..59a9dcceb5 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 4bbe0a95ee..1f699ddf5b 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 ca4dceb5de..bb45337cf1 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 424d35e8aa..720f28525b 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 835ef5b6eb..5e97f1ac54 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 d9ee8e7767..ead6721bd4 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 e4f5858800..e08ab73450 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 02a97ec2c9..f00f10c436 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 8b299f8728..e351db5457 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 1954867238..0b752557e4 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 cae156f790..2a2737497a 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 1ec46ab3cf..946d6dc192 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 e0c3b4dcb8..9a2822e8f5 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 e0b87b0ebb..6f8ccfacb9 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 e803be7167..0acb603147 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 326032d40b..fd294296cb 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 c23c8520e0..bea8b55220 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 8db403ad2c..567ef7911c 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 b14e01a301..8be5285221 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 6a06c79888..3d36e9328d 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 fb59e9dee1..d2285e8253 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 61eb4f97c6..0e5df52560 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 dadee26258..d73e7dccc1 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 3f83b37c72..ef67e1d9a5 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 14be5e6824..4e0f9b871b 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 3b1befe35d..b5a16316de 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 46cb922402..49f48a59a0 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 dfaf59c711..f7bebd926e 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 abffbfe5fc..1e862e9174 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 678f98a556..cde1a02560 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 4787c35e32..fd168f29f7 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 0a9b2ccd1a..ba1fce25a0 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();