node/test/es-module/test-loaders-unknown-builtin-module.mjs
Geoffrey Booth 9e840deecc
esm: misc test refactors
- add test specific to the event loop
- move parallel tests into es-module folder
- refactor fixture to add braces for if blocks
- use 'os' instead of 'fs' as placeholder
- spelling

PR-URL: https://github.com/nodejs/node/pull/46631
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2023-02-18 14:26:36 +00:00

13 lines
439 B
JavaScript

// Flags: --experimental-loader ./test/fixtures/es-module-loaders/loader-unknown-builtin-module.mjs
import { expectsError, mustCall } from '../common/index.mjs';
import assert from 'assert';
const unknownBuiltinModule = 'node:unknown-builtin-module';
import(unknownBuiltinModule)
.then(assert.fail, expectsError({
code: 'ERR_UNKNOWN_BUILTIN_MODULE',
message: `No such built-in module: ${unknownBuiltinModule}`
}))
.then(mustCall());