Fix coverage reporting

This commit is contained in:
David Langley
2026-03-06 16:20:40 +00:00
parent c2da26542e
commit 7d183ed15b
2 changed files with 15 additions and 2 deletions
@@ -9,14 +9,16 @@
"prepare": "vite build",
"lint:types": "tsc --noEmit",
"lint:codestyle": "echo 'handled by lint:eslint'",
"test": "vitest"
"test": "vitest run --coverage"
},
"devDependencies": {
"@element-hq/element-web-module-api": "^1.0.0",
"@types/node": "^22.10.7",
"@vitest/coverage-v8": "^4.0.0",
"typescript": "^5.7.3",
"vite": "^7.1.11",
"vitest": "^4.0.0"
"vitest": "^4.0.0",
"vitest-sonar-reporter": "^2.0.0"
},
"dependencies": {
"zod": "^4.0.0"
@@ -6,10 +6,21 @@ Please see LICENSE files in the repository root for full details.
*/
import { defineConfig } from "vitest/config";
import { env } from "node:process";
const isGHA = env["GITHUB_ACTIONS"] !== undefined;
export default defineConfig({
test: {
include: ["tests/**/*.test.ts"],
exclude: ["./e2e/**/*", "./node_modules/**/*"],
reporters: isGHA
? ["default", ["vitest-sonar-reporter", { outputFile: "coverage/sonar-report.xml" }]]
: ["default"],
coverage: {
provider: "v8",
include: ["src/**/*.ts"],
reporter: ["lcov", "text"],
},
},
});