mirror of
https://github.com/nodejs/node.git
synced 2025-05-20 17:41:40 +00:00

Include the require stack in the reported error message. PR-URL: https://github.com/nodejs/node/pull/25690 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
26 lines
524 B
JavaScript
26 lines
524 B
JavaScript
// Flags: --expose-internals
|
|
|
|
'use strict';
|
|
|
|
const common = require('../common');
|
|
|
|
common.expectsError(
|
|
() => {
|
|
require('internal/bootstrap/loaders');
|
|
}, {
|
|
code: 'MODULE_NOT_FOUND',
|
|
message: /Cannot find module 'internal\/bootstrap\/loaders'/
|
|
}
|
|
);
|
|
|
|
common.expectsError(
|
|
() => {
|
|
const source = 'module.exports = require("internal/bootstrap/loaders")';
|
|
process.binding('natives').owo = source;
|
|
require('owo');
|
|
}, {
|
|
code: 'MODULE_NOT_FOUND',
|
|
message: /Cannot find module 'owo'/
|
|
}
|
|
);
|