summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorcjihrig <cjihrig@gmail.com>2019-07-04 16:20:20 -0400
committerMichaƫl Zasso <targos@protonmail.com>2019-07-20 11:05:21 +0200
commit4cb0fc3ab150f3f60e6d100ee7dd83b60c1885db (patch)
tree680acd3588b179ef40435c1a18ca2bf2a9b09d57 /test
parente2adfb79b0cf2c6e93e0738c36b4107a36fd607c (diff)
downloadandroid-node-v8-4cb0fc3ab150f3f60e6d100ee7dd83b60c1885db.tar.gz
android-node-v8-4cb0fc3ab150f3f60e6d100ee7dd83b60c1885db.tar.bz2
android-node-v8-4cb0fc3ab150f3f60e6d100ee7dd83b60c1885db.zip
process: refactor unhandledRejection logic
This commit prevents a deprecation warning from being emitted if the unhandledRejection event was actually handled. PR-URL: https://github.com/nodejs/node/pull/28540 Fixes: https://github.com/nodejs/node/issues/28539 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Masashi Hirano <shisama07@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'test')
-rw-r--r--test/parallel/test-promise-handled-rejection-no-warning.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/parallel/test-promise-handled-rejection-no-warning.js b/test/parallel/test-promise-handled-rejection-no-warning.js
new file mode 100644
index 0000000000..14b06affb7
--- /dev/null
+++ b/test/parallel/test-promise-handled-rejection-no-warning.js
@@ -0,0 +1,8 @@
+'use strict';
+const common = require('../common');
+
+// This test verifies that DEP0018 does not occur when rejections are handled.
+common.disableCrashOnUnhandledRejection();
+process.on('warning', common.mustNotCall());
+process.on('unhandledRejection', common.mustCall());
+Promise.reject(new Error());