Skip to content

Commit

Permalink
fix(coverage): c8 provider to work when isolate:false (#2929)
Browse files Browse the repository at this point in the history
  • Loading branch information
AriPerkkio committed Feb 28, 2023
1 parent 895103a commit 8653830
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
1 change: 1 addition & 0 deletions packages/coverage-c8/src/takeCoverage.ts
Expand Up @@ -33,6 +33,7 @@ export async function takeCoverage() {
export function stopCoverage() {
session.post('Profiler.stopPreciseCoverage')
session.post('Profiler.disable')
session.disconnect()
}

function filterResult(coverage: Profiler.ScriptCoverage): boolean {
Expand Down
22 changes: 13 additions & 9 deletions test/coverage-test/testing.mjs
Expand Up @@ -23,15 +23,19 @@ const configs = [
}],
]

for (const threads of [true, false]) {
for (const [directory, config] of configs) {
await startVitest('test', [directory], {
...config,
update: UPDATE_SNAPSHOTS,
threads,
})
for (const threads of [{ threads: true }, { threads: false }, { singleThread: true }]) {
for (const isolate of [true, false]) {
for (const [directory, config] of configs) {
await startVitest('test', [directory], {
name: `With settings: ${JSON.stringify({ ...threads, isolate, directory })}`,
...config,
update: UPDATE_SNAPSHOTS,
...threads,
isolate,
})

if (process.exitCode)
process.exit()
if (process.exitCode)
process.exit()
}
}
}

0 comments on commit 8653830

Please sign in to comment.