0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-29 23:16:30 +01:00
nodejs/test/parallel/test-async-hooks-disable-during-promise.js
YuLun Shih 5d6693fc07 test: use crashOnUnhandledRejection
Add common.crashOnUnhandledRejection to
test/parallel/test-async-hooks-disable-during-promise.js

PR-URL: https://github.com/nodejs/node/pull/17220
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-11-22 07:56:15 -08:00

19 lines
431 B
JavaScript

'use strict';
const common = require('../common');
const async_hooks = require('async_hooks');
common.crashOnUnhandledRejection();
const hook = async_hooks.createHook({
init: common.mustCall(2),
before: common.mustCall(1),
after: common.mustNotCall()
}).enable();
Promise.resolve(1).then(common.mustCall(() => {
hook.disable();
Promise.resolve(42).then(common.mustCall());
process.nextTick(common.mustCall());
}));