mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
This commit makes it possible to add new core modules that can only be require()'ed and imported when the 'node:' scheme is used. The 'test' module is the first such module. These 'node:'-only modules are not included in the list returned by module.builtinModules. PR-URL: https://github.com/nodejs/node/pull/42325 Refs: https://github.com/nodejs/node/issues/40954 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
16 lines
364 B
JavaScript
16 lines
364 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
|
|
assert.throws(
|
|
() => require('test'),
|
|
common.expectsError({ code: 'ERR_UNKNOWN_BUILTIN_MODULE' }),
|
|
);
|
|
|
|
(async () => {
|
|
await assert.rejects(
|
|
async () => import('test'),
|
|
common.expectsError({ code: 'ERR_UNKNOWN_BUILTIN_MODULE' }),
|
|
);
|
|
})().then(common.mustCall());
|