Skip to content

Commit

Permalink
perf: unnecessary rpc call when coverage is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
AriPerkkio committed May 2, 2024
1 parent bdce0a2 commit cc543bc
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions packages/vitest/src/runtime/runners/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,14 @@ export async function resolveTestRunner(config: ResolvedConfig, executor: Vitest
testRunner.onAfterRunFiles = async (files) => {
const state = getWorkerState()
const coverage = await takeCoverageInsideWorker(config.coverage, executor)
rpc().onAfterSuiteRun({
coverage,
transformMode: state.environment.transformMode,
projectName: state.ctx.projectName,
})

if (coverage) {
rpc().onAfterSuiteRun({
coverage,
transformMode: state.environment.transformMode,
projectName: state.ctx.projectName,
})
}

await originalOnAfterRun?.call(testRunner, files)
}
Expand Down

0 comments on commit cc543bc

Please sign in to comment.