@@ -8,22 +8,23 @@ import { describe, it } from 'node:test';
8
8
describe ( 'ESM: ensure initialization happens only once' , { concurrency : true } , ( ) => {
9
9
it ( async ( ) => {
10
10
const { code, stderr, stdout } = await spawnPromisified ( execPath , [
11
+ '--experimental-import-meta-resolve' ,
11
12
'--loader' ,
12
13
fixtures . fileURL ( 'es-module-loaders' , 'loader-resolve-passthru.mjs' ) ,
13
14
'--no-warnings' ,
14
15
fixtures . path ( 'es-modules' , 'runmain.mjs' ) ,
15
16
] ) ;
16
17
17
- // Length minus 1 because the first match is the needle.
18
- const resolveHookRunCount = ( stdout . match ( / r e s o l v e p a s s t h r u / g) ?. length ?? 0 ) - 1 ;
19
-
20
18
assert . strictEqual ( stderr , '' ) ;
21
19
/**
22
20
* resolveHookRunCount = 2:
23
21
* 1. fixtures/…/runmain.mjs
24
22
* 2. node:module (imported by fixtures/…/runmain.mjs)
23
+ * 3. doesnt-matter.mjs (first import.meta.resolve call)
24
+ * 4. fixtures/…/runmain.mjs (entry point)
25
+ * 5. doesnt-matter.mjs (second import.meta.resolve call)
25
26
*/
26
- assert . strictEqual ( resolveHookRunCount , 2 ) ;
27
+ assert . strictEqual ( stdout . match ( / r e s o l v e p a s s t h r u / g ) ?. length , 5 ) ;
27
28
assert . strictEqual ( code , 0 ) ;
28
29
} ) ;
29
30
} ) ;
0 commit comments