Skip to content

Commit

Permalink
chore: fix v8 coverage test (#12644)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB authored Apr 7, 2022
1 parent 5247e1f commit c6902a0
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions e2e/__tests__/coverageProviderV8.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,17 @@ import runJest from '../runJest';

const DIR = path.resolve(__dirname, '../coverage-provider-v8');

// https://github.com/nodejs/node/issues/42638
const nodeOptions =
typeof fetch === 'undefined' ? '' : '--no-experimental-fetch';

test('prints coverage with missing sourcemaps', () => {
const sourcemapDir = path.join(DIR, 'no-sourcemap');

const {stdout, exitCode} = runJest(
sourcemapDir,
['--coverage', '--coverage-provider', 'v8'],
{stripAnsi: true},
{nodeOptions, stripAnsi: true},
);

expect(exitCode).toBe(0);
Expand All @@ -30,7 +34,7 @@ test('prints coverage with empty sourcemaps', () => {
const {stdout, exitCode} = runJest(
sourcemapDir,
['--coverage', '--coverage-provider', 'v8'],
{stripAnsi: true},
{nodeOptions, stripAnsi: true},
);

expect(exitCode).toBe(0);
Expand All @@ -43,7 +47,7 @@ test('prints correct coverage report, if a CJS module is put under test without
const {stdout, exitCode} = runJest(
sourcemapDir,
['--coverage', '--coverage-provider', 'v8', '--no-cache'],
{stripAnsi: true},
{nodeOptions, stripAnsi: true},
);

expect(exitCode).toBe(0);
Expand All @@ -56,7 +60,7 @@ test('prints correct coverage report, if a TS module is transpiled by Babel to C
const {stdout, exitCode} = runJest(
sourcemapDir,
['--coverage', '--coverage-provider', 'v8', '--no-cache'],
{stripAnsi: true},
{nodeOptions, stripAnsi: true},
);

expect(exitCode).toBe(0);
Expand All @@ -72,7 +76,7 @@ onNodeVersions('>=12.16.0', () => {
sourcemapDir,
['--coverage', '--coverage-provider', 'v8', '--no-cache'],
{
nodeOptions: '--experimental-vm-modules --no-warnings',
nodeOptions: `${nodeOptions} --experimental-vm-modules --no-warnings`,
stripAnsi: true,
},
);
Expand All @@ -88,7 +92,7 @@ onNodeVersions('>=12.16.0', () => {
sourcemapDir,
['--coverage', '--coverage-provider', 'v8', '--no-cache'],
{
nodeOptions: '--experimental-vm-modules --no-warnings',
nodeOptions: `${nodeOptions} --experimental-vm-modules --no-warnings`,
stripAnsi: true,
},
);
Expand Down

0 comments on commit c6902a0

Please sign in to comment.