fix: run all tests in CI and remap LCOV paths for Sonar
sonar / sonar (push) Skipped
sonar / sonar (pull_request) Canceled after 7m29s
sonar / sonar (push) Skipped
sonar / sonar (pull_request) Canceled after 7m29s
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -34,7 +34,7 @@ jobs:
|
|||||||
npm run test:coverage
|
npm run test:coverage
|
||||||
|
|
||||||
- name: SonarQube Scan + Quality Gate
|
- name: SonarQube Scan + Quality Gate
|
||||||
uses: sonarsource/sonarqube-scan-action@v5
|
uses: sonarsource/sonarqube-scan-action@v6
|
||||||
env:
|
env:
|
||||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||||
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
|
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
|
||||||
|
|||||||
+2
-2
@@ -11,8 +11,8 @@
|
|||||||
"start": "node dist/hello.js",
|
"start": "node dist/hello.js",
|
||||||
"typecheck": "tsc --noEmit",
|
"typecheck": "tsc --noEmit",
|
||||||
"migrate": "npm run build && node dist/db/migrate.js",
|
"migrate": "npm run build && node dist/db/migrate.js",
|
||||||
"test": "npm run build && node --test dist/**/*.test.js",
|
"test": "npm run build && node --test \"dist/**/*.test.js\"",
|
||||||
"test:coverage": "npm run build && node -e \"require('fs').mkdirSync('coverage',{recursive:true})\" && node --experimental-test-coverage --test-reporter=spec --test-reporter-destination=stdout --test-reporter=lcov --test-reporter-destination=coverage/lcov.info --test dist/**/*.test.js"
|
"test:coverage": "npm run build && node -e \"require('fs').mkdirSync('coverage',{recursive:true})\" && node --experimental-test-coverage --test-reporter=spec --test-reporter-destination=stdout --test-reporter=lcov --test-reporter-destination=coverage/lcov.info --test \"dist/**/*.test.js\" && node scripts/remap-lcov.cjs"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@opentelemetry/api": "^1.9.1",
|
"@opentelemetry/api": "^1.9.1",
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
const fs = require("node:fs");
|
||||||
|
const path = require("node:path");
|
||||||
|
|
||||||
|
const file = path.join("coverage", "lcov.info");
|
||||||
|
const remapped = fs.readFileSync(file, "utf8").replace(/^SF:(.+)$/gm, (_, p) => {
|
||||||
|
const norm = String(p).replaceAll("\\", "/");
|
||||||
|
const match = /(?:^|\/)dist\/(.+)\.js$/.exec(norm);
|
||||||
|
return match ? `SF:src/${match[1]}.ts` : `SF:${norm}`;
|
||||||
|
});
|
||||||
|
fs.writeFileSync(file, remapped);
|
||||||
Reference in New Issue
Block a user