Skip to content

Commit 9cd5c0e

Browse files
committed
test: add test for missing dynamic instantiate hook
PR-URL: #21506 Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Gus Caplan <[email protected]>
1 parent e25b102 commit 9cd5c0e

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Flags: --experimental-modules --loader ./test/fixtures/es-module-loaders/missing-dynamic-instantiate-hook.mjs
2+
3+
import {
4+
crashOnUnhandledRejection,
5+
expectsError
6+
} from '../common';
7+
8+
crashOnUnhandledRejection();
9+
10+
import('test').catch(expectsError({
11+
code: 'ERR_MISSING_DYNAMIC_INSTANTIATE_HOOK',
12+
message: 'The ES Module loader may not return a format of \'dynamic\' ' +
13+
'when no dynamicInstantiate function was provided'
14+
}));
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export function resolve(specifier, parentModule, defaultResolver) {
2+
if (specifier !== 'test') {
3+
return defaultResolver(specifier, parentModule);
4+
}
5+
return { url: 'file://', format: 'dynamic' };
6+
}

0 commit comments

Comments
 (0)