test: add test for missing dynamic instantiate hook
PR-URL: https://github.com/nodejs/node/pull/21506 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gus Caplan <me@gus.host>
This commit is contained in:
parent
f85962fe4d
commit
908518d9e3
@ -0,0 +1,14 @@
|
|||||||
|
// Flags: --experimental-modules --loader ./test/fixtures/es-module-loaders/missing-dynamic-instantiate-hook.mjs
|
||||||
|
|
||||||
|
import {
|
||||||
|
crashOnUnhandledRejection,
|
||||||
|
expectsError
|
||||||
|
} from '../common';
|
||||||
|
|
||||||
|
crashOnUnhandledRejection();
|
||||||
|
|
||||||
|
import('test').catch(expectsError({
|
||||||
|
code: 'ERR_MISSING_DYNAMIC_INSTANTIATE_HOOK',
|
||||||
|
message: 'The ES Module loader may not return a format of \'dynamic\' ' +
|
||||||
|
'when no dynamicInstantiate function was provided'
|
||||||
|
}));
|
6
test/fixtures/es-module-loaders/missing-dynamic-instantiate-hook.mjs
vendored
Normal file
6
test/fixtures/es-module-loaders/missing-dynamic-instantiate-hook.mjs
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
export function resolve(specifier, parentModule, defaultResolver) {
|
||||||
|
if (specifier !== 'test') {
|
||||||
|
return defaultResolver(specifier, parentModule);
|
||||||
|
}
|
||||||
|
return { url: 'file://', format: 'dynamic' };
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user