Skip to content

Commit

Permalink
chore: generate coverage report when deploying site (#11110)
Browse files Browse the repository at this point in the history
* chore: generate coverage report when deploying site

* always generate report
  • Loading branch information
Rich-Harris authored Apr 10, 2024
1 parent 710c8f4 commit a531625
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
"check": "cd packages/svelte && pnpm build && cd ../../ && pnpm -r check",
"format": "prettier --write .",
"lint": "prettier --check . && eslint ./",
"test": "vitest run --coverage",
"test-output": "vitest run --reporter=json --outputFile=sites/svelte-5-preview/src/routes/status/results.json",
"test": "vitest run",
"test-output": "vitest run --coverage --reporter=json --outputFile=sites/svelte-5-preview/src/routes/status/results.json",
"changeset:version": "changeset version && pnpm -r generate:version && git add --all",
"changeset:publish": "changeset publish"
},
Expand Down
3 changes: 2 additions & 1 deletion sites/svelte-5-preview/src/routes/status/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
<p class="details">
{data.results.total} tests ({data.results.suites.length} suites) – {data.results.passed} passed,
{data.results.failed}
failed, {data.results.skipped} skipped
failed, {data.results.skipped} skipped.
<a href="/coverage/index.html">See coverage report.</a>
</p>
</div>

Expand Down
5 changes: 4 additions & 1 deletion vitest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,10 @@ export default defineConfig({
exclude: [...configDefaults.exclude, '**/samples/**'],
coverage: {
provider: 'v8',
reporter: ['lcov', 'html']
reporter: ['lcov', 'html'],
include: ['packages/svelte/src/**'],
reportsDirectory: 'sites/svelte-5-preview/static/coverage',
reportOnFailure: true
}
}
});

0 comments on commit a531625

Please sign in to comment.