From 939e12f1c6bc8831862e94bb2878159816389ba2 Mon Sep 17 00:00:00 2001 From: Shing Rui Date: Sun, 26 May 2024 08:31:33 +0800 Subject: [PATCH 1/2] Fixed sonar scope. --- sonar-project.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sonar-project.properties b/sonar-project.properties index 3a7724b..95afe7a 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1,6 +1,6 @@ sonar.organization=sunquakes sonar.projectKey=sunquakes_electron-kits -sonar.sources=src/db/sqlite3.js sonar.exclusions=src/lang/**.js -sonar.javascript.lcov.reportPaths=coverage/lcov.info \ No newline at end of file +sonar.javascript.lcov.reportPaths=coverage/lcov.info +sonar.test.inclusions=src/db/sqlite3.js \ No newline at end of file From e86035de110b7c2acb68238307f1c111e6feaf2f Mon Sep 17 00:00:00 2001 From: Shing Rui Date: Sun, 26 May 2024 08:44:20 +0800 Subject: [PATCH 2/2] Test coverage scope. --- .github/workflows/sonarcloud-scan.yml | 2 +- jest.config.js | 2 +- sonar-project.properties | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/sonarcloud-scan.yml b/.github/workflows/sonarcloud-scan.yml index dbd4894..779479f 100644 --- a/.github/workflows/sonarcloud-scan.yml +++ b/.github/workflows/sonarcloud-scan.yml @@ -18,7 +18,7 @@ jobs: - name: Install dependencies run: yarn - name: Test and coverage - run: yarn test --coverage + run: yarn test -- --coverage - name: SonarCloud Scan uses: sonarsource/sonarcloud-github-action@master env: diff --git a/jest.config.js b/jest.config.js index 0cca6cd..4fda83f 100644 --- a/jest.config.js +++ b/jest.config.js @@ -3,7 +3,7 @@ module.exports = { '\\.js$': 'babel-jest' }, collectCoverage: true, - collectCoverageFrom: ['./src/db/sqlite3.js'], + collectCoverageFrom: ['src/db/sqlite3.js'], coverageDirectory: 'coverage', coverageReporters: ['text', 'lcov'] } diff --git a/sonar-project.properties b/sonar-project.properties index 95afe7a..f6f0aa0 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -2,5 +2,4 @@ sonar.organization=sunquakes sonar.projectKey=sunquakes_electron-kits sonar.exclusions=src/lang/**.js -sonar.javascript.lcov.reportPaths=coverage/lcov.info -sonar.test.inclusions=src/db/sqlite3.js \ No newline at end of file +sonar.javascript.lcov.reportPaths=coverage/lcov.info \ No newline at end of file