Skip to content

Commit

Permalink
feat: test coverage (#406)
Browse files Browse the repository at this point in the history
  • Loading branch information
JBR90 authored Dec 3, 2024
1 parent 701ff65 commit 00767a0
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 2 deletions.
13 changes: 12 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,15 @@ jobs:
inject-env-vars: true

- name: Run tests
run: pnpm turbo test --cache-dir=".turbo" -- --maxWorkers=33%
run: pnpm turbo test --cache-dir=".turbo" -- --maxWorkers=33% --coverage

# Run only on production branch
- name: Report coverage to SonarCloud
if: ${{ github.event.pull_request.merged == true && github.base_ref == 'production' }}
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: >
-Dsonar.javascript.lcov.reportPaths=packages/**/coverage/lcov.info,apps/nextjs/coverage/lcov.info
2 changes: 2 additions & 0 deletions apps/nextjs/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const config = {
{
tsconfig: "tsconfig.test.json",
useESM: true,
isolatedModules: true,
},
],
"^.+\\.svg$": "<rootDir>/jest.svgTransform.js",
Expand All @@ -30,6 +31,7 @@ const config = {
rootDir: ".",
resetMocks: true,
setupFilesAfterEnv: ["<rootDir>/jest.setup.js"],
collectCoverageFrom: ["src/**/*.{ts,tsx,js,jsx}"],
collectCoverage:
process.env.CI === "true" || process.env.COLLECT_TEST_COVERAGE === "true",
coverageReporters: ["lcov", "text"],
Expand Down
2 changes: 2 additions & 0 deletions packages/aila/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const config = {
{
tsconfig: "tsconfig.test.json",
useESM: true,
isolatedModules: true,
},
],
},
Expand All @@ -26,6 +27,7 @@ const config = {
collectCoverage:
process.env.CI === "true" || process.env.COLLECT_TEST_COVERAGE === "true",
coverageReporters: ["lcov", "text"],
collectCoverageFrom: ["src/**/*.{ts,tsx,js,jsx}"],
coverageDirectory: "coverage",
};

Expand Down
2 changes: 2 additions & 0 deletions packages/ingest/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const config = {
{
tsconfig: "tsconfig.test.json",
useESM: true,
isolatedModules: true,
},
],
},
Expand All @@ -26,6 +27,7 @@ const config = {
collectCoverage:
process.env.CI === "true" || process.env.COLLECT_TEST_COVERAGE === "true",
coverageReporters: ["lcov", "text"],
collectCoverageFrom: ["src/**/*.{ts,tsx,js,jsx}"],
coverageDirectory: "coverage",
};

Expand Down
3 changes: 2 additions & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ sonar.cpd.exclusions=\
sonar.tests=.
sonar.test.inclusions=**/*.test.ts
sonar.javascript.lcov.reportPaths=packages/**/coverage/lcov.info,apps/nextjs/coverage/lcov.info
sonar.language=ts,tsx,js,jsx,html,css

sonar.language=ts,tsx,js,jsx,html,css

0 comments on commit 00767a0

Please sign in to comment.