@@ -11,13 +11,17 @@ import runJest from '../runJest';
1111
1212const DIR = path . resolve ( __dirname , '../coverage-provider-v8' ) ;
1313
14+ // https://github.com/nodejs/node/issues/42638
15+ const nodeOptions =
16+ typeof fetch === 'undefined' ? '' : '--no-experimental-fetch' ;
17+
1418test ( 'prints coverage with missing sourcemaps' , ( ) => {
1519 const sourcemapDir = path . join ( DIR , 'no-sourcemap' ) ;
1620
1721 const { stdout, exitCode} = runJest (
1822 sourcemapDir ,
1923 [ '--coverage' , '--coverage-provider' , 'v8' ] ,
20- { stripAnsi : true } ,
24+ { nodeOptions , stripAnsi : true } ,
2125 ) ;
2226
2327 expect ( exitCode ) . toBe ( 0 ) ;
@@ -30,7 +34,7 @@ test('prints coverage with empty sourcemaps', () => {
3034 const { stdout, exitCode} = runJest (
3135 sourcemapDir ,
3236 [ '--coverage' , '--coverage-provider' , 'v8' ] ,
33- { stripAnsi : true } ,
37+ { nodeOptions , stripAnsi : true } ,
3438 ) ;
3539
3640 expect ( exitCode ) . toBe ( 0 ) ;
@@ -43,7 +47,7 @@ test('prints correct coverage report, if a CJS module is put under test without
4347 const { stdout, exitCode} = runJest (
4448 sourcemapDir ,
4549 [ '--coverage' , '--coverage-provider' , 'v8' , '--no-cache' ] ,
46- { stripAnsi : true } ,
50+ { nodeOptions , stripAnsi : true } ,
4751 ) ;
4852
4953 expect ( exitCode ) . toBe ( 0 ) ;
@@ -56,7 +60,7 @@ test('prints correct coverage report, if a TS module is transpiled by Babel to C
5660 const { stdout, exitCode} = runJest (
5761 sourcemapDir ,
5862 [ '--coverage' , '--coverage-provider' , 'v8' , '--no-cache' ] ,
59- { stripAnsi : true } ,
63+ { nodeOptions , stripAnsi : true } ,
6064 ) ;
6165
6266 expect ( exitCode ) . toBe ( 0 ) ;
@@ -72,7 +76,7 @@ onNodeVersions('>=12.16.0', () => {
7276 sourcemapDir ,
7377 [ '--coverage' , '--coverage-provider' , 'v8' , '--no-cache' ] ,
7478 {
75- nodeOptions : ' --experimental-vm-modules --no-warnings' ,
79+ nodeOptions : ` ${ nodeOptions } --experimental-vm-modules --no-warnings` ,
7680 stripAnsi : true ,
7781 } ,
7882 ) ;
@@ -88,7 +92,7 @@ onNodeVersions('>=12.16.0', () => {
8892 sourcemapDir ,
8993 [ '--coverage' , '--coverage-provider' , 'v8' , '--no-cache' ] ,
9094 {
91- nodeOptions : ' --experimental-vm-modules --no-warnings' ,
95+ nodeOptions : ` ${ nodeOptions } --experimental-vm-modules --no-warnings` ,
9296 stripAnsi : true ,
9397 } ,
9498 ) ;
0 commit comments