Skip to content

Commit 8653830

Browse files
authoredFeb 28, 2023
fix(coverage): c8 provider to work when isolate:false (#2929)
1 parent 895103a commit 8653830

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed
 

‎packages/coverage-c8/src/takeCoverage.ts

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export async function takeCoverage() {
3333
export function stopCoverage() {
3434
session.post('Profiler.stopPreciseCoverage')
3535
session.post('Profiler.disable')
36+
session.disconnect()
3637
}
3738

3839
function filterResult(coverage: Profiler.ScriptCoverage): boolean {

‎test/coverage-test/testing.mjs

+13-9
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,19 @@ const configs = [
2323
}],
2424
]
2525

26-
for (const threads of [true, false]) {
27-
for (const [directory, config] of configs) {
28-
await startVitest('test', [directory], {
29-
...config,
30-
update: UPDATE_SNAPSHOTS,
31-
threads,
32-
})
26+
for (const threads of [{ threads: true }, { threads: false }, { singleThread: true }]) {
27+
for (const isolate of [true, false]) {
28+
for (const [directory, config] of configs) {
29+
await startVitest('test', [directory], {
30+
name: `With settings: ${JSON.stringify({ ...threads, isolate, directory })}`,
31+
...config,
32+
update: UPDATE_SNAPSHOTS,
33+
...threads,
34+
isolate,
35+
})
3336

34-
if (process.exitCode)
35-
process.exit()
37+
if (process.exitCode)
38+
process.exit()
39+
}
3640
}
3741
}

0 commit comments

Comments
 (0)
Please sign in to comment.