1'use strict'; 2 3const common = require('../common'); 4const domain = require('domain'); 5const assert = require('assert'); 6 7const d = domain.create(); 8 9process.once('uncaughtException', common.mustCall(function onUncaught() { 10 assert.strictEqual( 11 process.domain, null, 12 'Domains stack should be empty in uncaughtException handler ' + 13 `but the value of process.domain is ${JSON.stringify(process.domain)}`); 14})); 15 16process.on('beforeExit', common.mustCall(function onBeforeExit() { 17 assert.strictEqual( 18 process.domain, null, 19 'Domains stack should be empty in beforeExit handler ' + 20 `but the value of process.domain is ${JSON.stringify(process.domain)}`); 21})); 22 23d.run(function() { 24 throw new Error('boom'); 25}); 26