mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
9dac165160
PR-URL: https://github.com/nodejs/node/pull/10522 Fixes: https://github.com/nodejs/node/issues/1271 Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
26 lines
673 B
JavaScript
26 lines
673 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
|
|
// This test ensures that the timer callbacks are called in the order in which
|
|
// they were created in the event of an unhandled exception in the domain.
|
|
|
|
const domain = require('domain').create();
|
|
const assert = require('assert');
|
|
|
|
let first = false;
|
|
|
|
domain.run(function() {
|
|
setTimeout(() => { throw new Error('FAIL'); }, 1);
|
|
setTimeout(() => { first = true; }, 1);
|
|
setTimeout(() => { assert.strictEqual(first, true); }, 2);
|
|
|
|
// Ensure that 2 ms have really passed
|
|
let i = 1e6;
|
|
while (i--);
|
|
});
|
|
|
|
domain.once('error', common.mustCall((err) => {
|
|
assert(err);
|
|
assert.strictEqual(err.message, 'FAIL');
|
|
}));
|