mirror of
https://github.com/nodejs/node.git
synced 2024-11-29 23:16:30 +01:00
a025723e01
Use common.busyLoop() which happens to make the test robust. PR-URL: https://github.com/nodejs/node/pull/18461 Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
24 lines
578 B
JavaScript
24 lines
578 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
|
|
// If a process encounters an uncaughtException, it should schedule
|
|
// processing of nextTicks on the next Immediates cycle but not
|
|
// before all Immediates are handled
|
|
|
|
let stage = 0;
|
|
|
|
process.once('uncaughtException', common.expectsError({
|
|
type: Error,
|
|
message: 'caughtException'
|
|
}));
|
|
|
|
setImmediate(() => {
|
|
stage++;
|
|
process.nextTick(() => assert.strictEqual(stage, 2));
|
|
});
|
|
setTimeout(() => setImmediate(() => stage++), 1);
|
|
common.busyLoop(10);
|
|
throw new Error('caughtException');
|