From 0f558b8b559615a21a6f1f8b02b758ecff00b388 Mon Sep 17 00:00:00 2001 From: Mitchell Hentges Date: Mon, 19 Sep 2022 17:56:22 +0200 Subject: [PATCH] Don't perform V8 instrumenting if !collectCoverage 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 --- packages/jest-runner/src/runTest.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/jest-runner/src/runTest.ts b/packages/jest-runner/src/runTest.ts index 40b69f771207..1fcb193430c8 100644 --- a/packages/jest-runner/src/runTest.ts +++ b/packages/jest-runner/src/runTest.ts @@ -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';