From a531625896b5b05cebc21114bf2a03f6a619594b Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Wed, 10 Apr 2024 16:07:38 -0400 Subject: [PATCH] chore: generate coverage report when deploying site (#11110) * chore: generate coverage report when deploying site * always generate report --- package.json | 4 ++-- sites/svelte-5-preview/src/routes/status/+page.svelte | 3 ++- vitest.config.js | 5 ++++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 0b5d4cac7e6a..116d0ce98ce3 100644 --- a/package.json +++ b/package.json @@ -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" }, diff --git a/sites/svelte-5-preview/src/routes/status/+page.svelte b/sites/svelte-5-preview/src/routes/status/+page.svelte index bdbbd9fe808b..8ca850ba99ba 100644 --- a/sites/svelte-5-preview/src/routes/status/+page.svelte +++ b/sites/svelte-5-preview/src/routes/status/+page.svelte @@ -11,7 +11,8 @@

{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. + See coverage report.

diff --git a/vitest.config.js b/vitest.config.js index df5654131fca..caeda27e3065 100644 --- a/vitest.config.js +++ b/vitest.config.js @@ -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 } } });