File tree Expand file tree Collapse file tree 1 file changed +24
-6
lines changed Expand file tree Collapse file tree 1 file changed +24
-6
lines changed Original file line number Diff line number Diff line change @@ -68,16 +68,34 @@ async function testInvalid() {
6868 await result . catch ( common . mustCall ( ( e ) => {
6969 assert . strictEqual ( e . code , 'ERR_VM_MODULE_NOT_MODULE' ) ;
7070 } ) ) ;
71+
72+ const s = new Script ( 'import("foo")' , {
73+ importModuleDynamically : common . mustCall ( ( specifier , wrap ) => {
74+ return undefined ;
75+ } ) ,
76+ } ) ;
77+ let threw = false ;
78+ try {
79+ await s . runInThisContext ( ) ;
80+ } catch ( e ) {
81+ threw = true ;
82+ assert . strictEqual ( e . code , 'ERR_VM_MODULE_NOT_MODULE' ) ;
83+ }
84+ assert ( threw ) ;
85+ }
86+
87+ async function testInvalidimportModuleDynamically ( ) {
88+ assert . throws (
89+ ( ) => new Script (
90+ 'import("foo")' ,
91+ { importModuleDynamically : false } ) ,
92+ { code : 'ERR_INVALID_ARG_TYPE' }
93+ ) ;
7194}
7295
73- const done = common . mustCallAtLeast ( 3 ) ;
7496( async function ( ) {
7597 await testNoCallback ( ) ;
76- done ( ) ;
77-
7898 await test ( ) ;
79- done ( ) ;
80-
8199 await testInvalid ( ) ;
82- done ( ) ;
100+ await testInvalidimportModuleDynamically ( ) ;
83101} ( ) ) . then ( common . mustCall ( ) ) ;
You can’t perform that action at this time.
0 commit comments