Skip to content

Commit

Permalink
upload coverage reports to sonarcloud
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewtan2000 committed Aug 7, 2024
1 parent 5e50a3a commit bab964f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,17 @@ jobs:
- name: Clean Install dependencies
run: npm ci

- name: Run unit tests
run: npm test
- name: Run tests and generate coverage report
run: npm test -- --coverage

#Run sonar cloud scan
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

with:
args: -Dsonar.javascript.lcov.reportPaths=coverage/lcov.info
- name: Build
run: npm run build
env:
Expand Down
6 changes: 6 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
module.exports = {
testEnvironment: 'jest-environment-jsdom',
collectCoverage: true,
collectCoverageFrom: [
'src/**/*.{js,jsx,ts,tsx}',
'!src/**/*.d.ts',
],
coverageDirectory: 'coverage',
};

0 comments on commit bab964f

Please sign in to comment.