diff --git a/backend/package-lock.json b/backend/package-lock.json index c8165b5ea..8e8f260b3 100644 --- a/backend/package-lock.json +++ b/backend/package-lock.json @@ -57,7 +57,8 @@ "tsconfig-paths": "^4.2.0", "typescript": "^5.2.2", "unplugin-swc": "^1.5.1", - "vitest": "^2.1.8" + "vitest": "^2.1.8", + "vitest-sonar-reporter": "^2.0.0" } }, "node_modules/@ampproject/remapping": { @@ -12124,6 +12125,19 @@ } } }, + "node_modules/vitest-sonar-reporter": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/vitest-sonar-reporter/-/vitest-sonar-reporter-2.0.0.tgz", + "integrity": "sha512-LorC3NnmrBrryx4+l3BEsNQjD0Y7wfmrD1y/+tHDuZUuVj7w8nOxRXCBSppDfmgfpToOhwchh0JcL4IGMKUKDA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "peerDependencies": { + "vitest": ">=1" + } + }, "node_modules/vitest/node_modules/magic-string": { "version": "0.30.14", "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.14.tgz", diff --git a/backend/package.json b/backend/package.json index 91ce3b367..a17f14af6 100644 --- a/backend/package.json +++ b/backend/package.json @@ -72,7 +72,8 @@ "tsconfig-paths": "^4.2.0", "typescript": "^5.2.2", "unplugin-swc": "^1.5.1", - "vitest": "^2.1.8" + "vitest": "^2.1.8", + "vitest-sonar-reporter": "^2.0.0" }, "lint-staged": { "*.{js,ts}": "./node_modules/.bin/eslint --cache --fix" diff --git a/backend/vitest.config.mts b/backend/vitest.config.mts index ae8a5e887..d9f486530 100644 --- a/backend/vitest.config.mts +++ b/backend/vitest.config.mts @@ -12,6 +12,9 @@ export default defineConfig({ provider: "v8", reporter: ["text-summary", "text", "json", "html"], }, + reporters: process.env.GITHUB_ACTIONS + ? [["vitest-sonar-reporter", { outputFile: "test-report.xml" }]] + : [], }, plugins: [swc.vite()], });