Welcome to mirror list, hosted at ThFree Co, Russian Federation.

test-domain-error-types.js « parallel « test - github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: cfd4fa801e3d95e7d716d3d99fd80bf81758f0d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Flags: --gc-interval=100 --stress-compaction
'use strict';

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

// This test is similar to test-domain-multiple-errors, but uses a new domain
// for each errors.
// The test flags are not essential, but serve as a way to verify that
// https://github.com/nodejs/node/issues/28275 is fixed in debug mode.

for (const something of [
  42, null, undefined, false, () => {}, 'string', Symbol('foo'),
]) {
  const d = new domain.Domain();
  d.run(common.mustCall(() => {
    process.nextTick(common.mustCall(() => {
      throw something;
    }));
  }));

  d.on('error', common.mustCall((err) => {
    assert.strictEqual(something, err);
  }));
}