@@ -8,22 +8,23 @@ import{describe, it } from 'node:test'
88describe ( 'ESM: ensure initialization happens only once' , { concurrency : true } , ( ) => {
99it ( async ( ) => {
1010const { code, stderr, stdout } = await spawnPromisified ( execPath , [
11+ '--experimental-import-meta-resolve' ,
1112'--loader' ,
1213fixtures . fileURL ( 'es-module-loaders' , 'loader-resolve-passthru.mjs' ) ,
1314'--no-warnings' ,
1415fixtures . path ( 'es-modules' , 'runmain.mjs' ) ,
1516] ) ;
1617
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-
2018assert . strictEqual ( stderr , '' ) ;
2119/**
2220 * resolveHookRunCount = 2:
2321 * 1. fixtures/…/runmain.mjs
2422 * 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)
2526 */
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 ) ;
2728assert . strictEqual ( code , 0 ) ;
2829} ) ;
2930} ) ;
0 commit comments