Skip to content

Commit

Permalink
Don't perform V8 instrumenting if !collectCoverage
Browse files Browse the repository at this point in the history
If `coverageProvider: "v8"` is provided in the Jest config, then the
overhead of V8 instrumenting occurs, even if `collectCoverage: false`.

This saves about ~100ms of Jest-invocation-time on my machine.

Signed-off-by: Mitchell Hentges <mhentges@spotify.com>
  • Loading branch information
mitchhentgesspotify committed Oct 3, 2022
1 parent 04dae6c commit a8e5994
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions packages/jest-runner/src/runTest.ts
Expand Up @@ -270,6 +270,7 @@ async function runTestInternal(

// if we don't have `getVmContext` on the env skip coverage
const collectV8Coverage =
globalConfig.collectCoverage &&
globalConfig.coverageProvider === 'v8' &&
typeof environment.getVmContext === 'function';

Expand Down

0 comments on commit a8e5994

Please sign in to comment.