Switch to using diff-cover for the Coverage gate (#33673)

* Switch to using diff-cover for the Coverage gate

Enabling developers to check their PR coverage without waiting for CI

* Remove sonar-project.properties - in automatic mode Sonar will not read this file

* Add note to CONTRIBUTING.md

* Skip sonar in MQ
This commit is contained in:
Michael Telatynski
2026-06-01 12:26:03 +00:00
committed by GitHub
parent dd2ae6e36c
commit 35484e5183
16 changed files with 83 additions and 194 deletions
+4 -3
View File
@@ -27,7 +27,9 @@
"scripts": {
"prepack": "nx build",
"lint:types": "nx lint:types",
"test:unit": "vitest"
"test:unit": "vitest",
"coverage": "pnpm test:unit --coverage",
"coverage:diff": "diff-cover --config-file ../../diff-cover.toml coverage/lcov.info"
},
"devDependencies": {
"@element-hq/vite-common": "workspace:*",
@@ -44,8 +46,7 @@
"typescript": "^6.0.0",
"unplugin-dts": "1.0.1",
"vite": "catalog:",
"vitest": "catalog:",
"vitest-sonar-reporter": "catalog:"
"vitest": "catalog:"
},
"peerDependencies": {
"@matrix-org/react-sdk-module-api": "*",
+3 -2
View File
@@ -51,6 +51,8 @@
"test:unit": "nx test:unit",
"test:storybook": "nx test:storybook",
"test:storybook:update": "nx test:storybook:update",
"coverage": "pnpm test:unit --coverage",
"coverage:diff": "diff-cover --config-file ../../diff-cover.toml coverage/lcov.info",
"build": "nx build",
"prepack": "pnpm run build",
"storybook": "storybook dev -p 6007",
@@ -132,8 +134,7 @@
"unplugin-dts": "1.0.1",
"vite": "catalog:",
"vite-plugin-node-polyfills": "^0.28.0",
"vitest": "catalog:",
"vitest-sonar-reporter": "catalog:"
"vitest": "catalog:"
},
"engines": {
"node": ">=20.0.0"
+1 -2
View File
@@ -13,7 +13,6 @@
"typescript": "catalog:"
},
"peerDependencies": {
"@vitest/coverage-v8": "catalog:",
"vitest-sonar-reporter": "catalog:"
"@vitest/coverage-v8": "catalog:"
}
}
-7
View File
@@ -31,13 +31,6 @@ const slowTestReporter: Reporter = {
// if we're running under GHA, enable the GHA & Sonar reporters
if (env["GITHUB_ACTIONS"] !== undefined) {
reporters.push(["github-actions", { silent: false }]);
reporters.push([
"vitest-sonar-reporter",
{
outputFile: "coverage/sonar-report.xml",
onWritePath: (path): string => `${process.cwd()}/${path}`,
},
]);
// if we're running against the develop branch, also enable the slow test reporter
if (env["GITHUB_REF"] == "refs/heads/develop") {