File tree 1 file changed +24
-6
lines changed
1 file changed +24
-6
lines changed Original file line number Diff line number Diff line change @@ -68,16 +68,34 @@ async function testInvalid() {
68
68
await result . catch ( common . mustCall ( ( e ) => {
69
69
assert . strictEqual ( e . code , 'ERR_VM_MODULE_NOT_MODULE' ) ;
70
70
} ) ) ;
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
+ ) ;
71
94
}
72
95
73
- const done = common . mustCallAtLeast ( 3 ) ;
74
96
( async function ( ) {
75
97
await testNoCallback ( ) ;
76
- done ( ) ;
77
-
78
98
await test ( ) ;
79
- done ( ) ;
80
-
81
99
await testInvalid ( ) ;
82
- done ( ) ;
100
+ await testInvalidimportModuleDynamically ( ) ;
83
101
} ( ) ) . then ( common . mustCall ( ) ) ;
You can’t perform that action at this time.
0 commit comments