Skip to content

Commit

Permalink
test: add test for missing dynamic instantiate hook
Browse files Browse the repository at this point in the history
PR-URL: #21506
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
  • Loading branch information
targos committed Jul 4, 2018
1 parent e25b102 commit 9cd5c0e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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'
}));
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export function resolve(specifier, parentModule, defaultResolver) {
if (specifier !== 'test') {
return defaultResolver(specifier, parentModule);
}
return { url: 'file://', format: 'dynamic' };
}

0 comments on commit 9cd5c0e

Please sign in to comment.