mirror of
https://github.com/nodejs/node.git
synced 2024-11-29 23:16:30 +01:00
5d6693fc07
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>
19 lines
431 B
JavaScript
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());
|
|
}));
|