Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(coverage): c8 provider to work when isolate:false #2929

Merged
merged 1 commit into from
Feb 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/coverage-c8/src/takeCoverage.ts
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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()
}
}
}