diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml index 5c171e4..f1c63b8 100644 --- a/.github/workflows/sonar.yml +++ b/.github/workflows/sonar.yml @@ -10,9 +10,21 @@ jobs: name: SonarQube runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - name: Checkout code + uses: actions/checkout@v4 with: fetch-depth: 0 + - name: Setup pnpm + uses: pnpm/action-setup@v4 + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + cache: 'pnpm' + - name: Install deps + run: pnpm install + - name: Run tests with coverage (LCOV) + run: pnpm test:coverage - name: SonarQube Scan uses: SonarSource/sonarqube-scan-action@v5 env: diff --git a/package.json b/package.json index 6e0bb29..decf7ea 100644 --- a/package.json +++ b/package.json @@ -100,7 +100,8 @@ "vitest": "^3.2.4" }, "engines": { - "node": ">=20" + "node": ">=20", + "pnpm": ">=9" }, "repository": { "type": "git", diff --git a/sonar-project.properties b/sonar-project.properties index 65e0dcc..274ec5d 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1,2 +1,6 @@ sonar.projectKey=dorixdev_react-dual-scroll-sync sonar.organization=dorixdev +sonar.sources=lib +sonar.tests=lib +sonar.test.inclusions=**/*.{test,spec}.{ts,tsx} +sonar.javascript.lcov.reportPaths=coverage/lcov.info diff --git a/vite.config.ts b/vite.config.ts index 28e55e9..948e67e 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -53,7 +53,7 @@ export default defineConfig({ '**/lib/**/*.types.{js,ts,jsx,tsx}' ], provider: 'v8', - reporter: ['html', 'clover', 'json', 'text', 'text-summary'] + reporter: ['html', 'text', 'text-summary', 'lcov'] } }, resolve: {