summaryrefslogtreecommitdiff
path: root/test/parallel/test-domain-safe-exit.js
blob: c00aa306f10e7a851f06d5f425a0f984c16ecb29 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
'use strict';
// Make sure the domain stack doesn't get clobbered by un-matched .exit()

require('../common');
const assert = require('assert');
const domain = require('domain');

var a = domain.create();
var b = domain.create();

a.enter(); // push
b.enter(); // push
assert.deepStrictEqual(domain._stack, [a, b], 'b not pushed');

domain.create().exit(); // no-op
assert.deepStrictEqual(domain._stack, [a, b], 'stack mangled!');