Skip to content

Commit

Permalink
fix(coverage-istanbul): reset coverage map after query
Browse files Browse the repository at this point in the history
  • Loading branch information
AriPerkkio committed Dec 8, 2022
1 parent 2079392 commit c5198a6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/coverage-istanbul/src/index.ts
Expand Up @@ -7,5 +7,11 @@ export async function getProvider() {

export function takeCoverage() {
// @ts-expect-error -- untyped global
return globalThis[COVERAGE_STORE_KEY]
const coverage = globalThis[COVERAGE_STORE_KEY]

// Reset coverage map to prevent duplicate results if this is called twice in row
// @ts-expect-error -- untyped global
globalThis[COVERAGE_STORE_KEY] = {}

return coverage
}

0 comments on commit c5198a6

Please sign in to comment.