summaryrefslogtreecommitdiff
path: root/test/parallel/test-domain-safe-exit.js
blob: bbc3b2fe22cae861d5be6a94e03c7e802d82886f (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');

const a = domain.create();
const 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!');