node/test/parallel/test-domain-set-uncaught-exception-capture-after-load.js
RafaelGSS fbdfe9399c lib: add diagnostics_channel events to module loading
This commit adds a tracing channel for module loading
through `import()` and `require()`.

Co-Authored-By: Stephen Belanger <admin@stephenbelanger.com>
PR-URL: https://github.com/nodejs/node/pull/44340
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
2024-06-20 21:25:04 -03:00

31 lines
763 B
JavaScript

'use strict';
const common = require('../common');
const assert = require('assert');
Error.stackTraceLimit = Infinity;
(function foobar() {
require('domain');
})();
assert.throws(
() => process.setUncaughtExceptionCaptureCallback(common.mustNotCall()),
(err) => {
common.expectsError(
{
code: 'ERR_DOMAIN_CANNOT_SET_UNCAUGHT_EXCEPTION_CAPTURE',
name: 'Error',
message: /^The `domain` module is in use, which is mutually/
}
)(err);
assert(err.stack.includes('-'.repeat(40)),
`expected ${err.stack} to contain dashes`);
const location = `at foobar (${__filename}:`;
assert(err.stack.includes(location),
`expected ${err.stack} to contain ${location}`);
return true;
}
);