node/test/parallel/test-promises-unhandled-proxy-rejections.js
Michaël Zasso 05df701e70
test: remove common.disableCrashOnUnhandledRejection
Use the --unhandled-rejections=none CLI flag instead.

PR-URL: https://github.com/nodejs/node/pull/38210
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2021-04-14 16:42:10 +02:00

29 lines
609 B
JavaScript

// Flags: --unhandled-rejections=none
'use strict';
const common = require('../common');
function throwErr() {
throw new Error('Error from proxy');
}
const thorny = new Proxy({}, {
getPrototypeOf: throwErr,
setPrototypeOf: throwErr,
isExtensible: throwErr,
preventExtensions: throwErr,
getOwnPropertyDescriptor: throwErr,
defineProperty: throwErr,
has: throwErr,
get: throwErr,
set: throwErr,
deleteProperty: throwErr,
ownKeys: throwErr,
apply: throwErr,
construct: throwErr
});
process.on('warning', common.mustNotCall());
// Ensure this doesn't crash
Promise.reject(thorny);