2015-05-19 13:00:06 +02:00
|
|
|
'use strict';
|
2013-03-25 22:32:41 -07:00
|
|
|
// Simple tests of most basic domain functionality.
|
|
|
|
|
2015-12-23 16:02:12 -08:00
|
|
|
require('../common');
|
2016-12-01 10:02:15 -06:00
|
|
|
const assert = require('assert');
|
2013-03-25 22:32:41 -07:00
|
|
|
|
|
|
|
// timeouts call the callback directly from cc, so need to make sure the
|
|
|
|
// domain will be used regardless
|
|
|
|
setTimeout(function() {
|
2016-12-01 10:02:15 -06:00
|
|
|
const domain = require('domain');
|
|
|
|
const d = domain.create();
|
2013-03-25 22:32:41 -07:00
|
|
|
d.run(function() {
|
|
|
|
process.nextTick(function() {
|
2015-05-19 13:00:06 +02:00
|
|
|
console.trace('in nexttick', process.domain === d);
|
2016-12-01 10:02:15 -06:00
|
|
|
assert.strictEqual(process.domain, d);
|
2013-03-25 22:32:41 -07:00
|
|
|
});
|
|
|
|
});
|
2016-12-01 10:02:15 -06:00
|
|
|
}, 1);
|