• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2const common = require('../common');
3const assert = require('assert');
4
5(function foobar() {
6  require('domain');
7})();
8
9assert.throws(
10  () => process.setUncaughtExceptionCaptureCallback(common.mustNotCall()),
11  (err) => {
12    common.expectsError(
13      {
14        code: 'ERR_DOMAIN_CANNOT_SET_UNCAUGHT_EXCEPTION_CAPTURE',
15        name: 'Error',
16        message: /^The `domain` module is in use, which is mutually/
17      }
18    )(err);
19
20    assert(err.stack.includes('-'.repeat(40)),
21           `expected ${err.stack} to contain dashes`);
22
23    const location = `at foobar (${__filename}:`;
24    assert(err.stack.includes(location),
25           `expected ${err.stack} to contain ${location}`);
26    return true;
27  }
28);
29