@@ -68,6 +68,7 @@ it('supports both CJS and ESM (js, mjs, cjs) configuration files in node CJS mod
6868 expect ( context . testResult . stdout ) . toBe ( 'first success' ) ;
6969 } ,
7070 {
71+ // ! In this test, we give Black Flag a file:// URL instead of a path
7172 initialVirtualFiles : {
7273 'src/index.cjs' : `require('@black-flag/core').runProgram('${ pathToFileURL (
7374 toPath ( __dirname , '..' , 'fixtures' , 'several-files-cjs-esm' )
@@ -95,9 +96,12 @@ if(typeof module !== 'undefined' || typeof require !== 'undefined') {
9596 throw new Error('expected ESM runtime but detected CJS');
9697}
9798
98- export default runProgram('${ pathToFileURL (
99- toPath ( __dirname , '..' , 'fixtures' , 'several-files-cjs-esm' )
100- ) . toString ( ) } ', 'js mjs');`
99+ export default runProgram('${ toPath (
100+ __dirname ,
101+ '..' ,
102+ 'fixtures' ,
103+ 'several-files-cjs-esm'
104+ ) . replaceAll ( '\\' , '\\\\' ) } ', 'js mjs');`
101105 }
102106 }
103107 ) ;
@@ -117,9 +121,12 @@ it('supports both CJS and ESM (js, mjs, cjs) configuration files in node CJS mod
117121 args : [ '--no-warnings' ]
118122 } ,
119123 initialVirtualFiles : {
120- 'src/index.cjs' : `require('@black-flag/core').runProgram('${ pathToFileURL (
121- toPath ( __dirname , '..' , 'fixtures' , 'several-files-cjs-esm' )
122- ) . toString ( ) } ', 'js cjs');`
124+ 'src/index.cjs' : `require('@black-flag/core').runProgram('${ toPath (
125+ __dirname ,
126+ '..' ,
127+ 'fixtures' ,
128+ 'several-files-cjs-esm'
129+ ) . replaceAll ( '\\' , '\\\\' ) } ', 'js cjs');`
123130 }
124131 }
125132 ) ;
@@ -146,9 +153,12 @@ if(typeof module !== 'undefined' || typeof require !== 'undefined') {
146153 throw new Error('expected ESM runtime but detected CJS');
147154}
148155
149- export default runProgram('${ pathToFileURL (
150- toPath ( __dirname , '..' , 'fixtures' , 'several-files-cjs-esm' )
151- ) . toString ( ) } ', 'js mjs');`
156+ export default runProgram('${ toPath (
157+ __dirname ,
158+ '..' ,
159+ 'fixtures' ,
160+ 'several-files-cjs-esm'
161+ ) . replaceAll ( '\\' , '\\\\' ) } ', 'js mjs');`
152162 }
153163 }
154164 ) ;
0 commit comments