node/test/es-module/test-loaders-hidden-from-users.js
Antoine du Hamel 41adb54a37
tools: enforce trailing commas in test/es-module
PR-URL: https://github.com/nodejs/node/pull/60891
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
2026-01-20 14:26:59 +01:00

28 lines
629 B
JavaScript

// Flags: --expose-internals
'use strict';
require('../common');
const assert = require('assert');
assert.throws(
() => {
require('internal/bootstrap/realm');
}, {
code: 'MODULE_NOT_FOUND',
message: /Cannot find module 'internal\/bootstrap\/realm'/,
}
);
assert.throws(
() => {
const source = 'module.exports = require("internal/bootstrap/realm")';
// This needs to be process.binding() to mimic what's normally available
// in the user land.
process.binding('natives').owo = source;
require('owo');
}, {
code: 'MODULE_NOT_FOUND',
message: /Cannot find module 'owo'/,
}
);