mirror of
https://github.com/nodejs/node.git
synced 2025-05-06 21:25:20 +00:00

Manually fix issues that eslint --fix couldn't do automatically. PR-URL: https://github.com/nodejs/node/pull/10685 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
33 lines
1.0 KiB
JavaScript
33 lines
1.0 KiB
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
let allsGood = false;
|
|
let cntr = 0;
|
|
|
|
process.on('exit', () => {
|
|
assert.ok(cntr > 0, '_tickDomainCallback was never called');
|
|
});
|
|
|
|
/**
|
|
* This test relies upon the following internals to work as specified:
|
|
* - require('domain') causes node::Environment::set_tick_callback_function()
|
|
* to use process._tickDomainCallback() to process the nextTickQueue;
|
|
* replacing process._tickCallback().
|
|
* - setImmediate() uses node::MakeCallback() instead of
|
|
* node::AsyncWrap::MakeCallback(). Otherwise the test will always pass.
|
|
* Have not found a way to verify that node::MakeCallback() is used.
|
|
*/
|
|
process._tickDomainCallback = function _tickDomainCallback() {
|
|
assert.ok(allsGood, '_tickDomainCallback should not have been called');
|
|
cntr++;
|
|
};
|
|
|
|
setImmediate(common.mustCall(() => {
|
|
require('domain');
|
|
setImmediate(common.mustCall(() => setImmediate(common.mustCall(() => {
|
|
allsGood = true;
|
|
process.nextTick(() => {});
|
|
}))));
|
|
}));
|