summaryrefslogtreecommitdiff
path: root/test/parallel/test-domain-nexttick.js
blob: 76cefd519d0bd3586ac016c6862e8cdb2e5883a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
'use strict';

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

const d = new domain.Domain();

d.on('error', common.mustCall((err) => {
  assert.strictEqual(err.message, 'foobar');
  assert.strictEqual(err.domain, d);
  assert.strictEqual(err.domainEmitter, undefined);
  assert.strictEqual(err.domainBound, undefined);
  assert.strictEqual(err.domainThrown, true);
}));

d.run(common.mustCall(() => {
  process.nextTick(common.mustCall(() => {
    throw new Error('foobar');
  }));
}));