Skip to content

Commit

Permalink
fix: test coverage added
Browse files Browse the repository at this point in the history
  • Loading branch information
vargastat committed Nov 29, 2024
1 parent 5a3dc1d commit 5e26ac3
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 3 deletions.
24 changes: 22 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,40 @@
name: Build

on:
push:
branches:
- fix/sonar_testCoverage
pull_request:
types: [opened, synchronize, reopened]

jobs:
sonarcloud:
name: SonarQube Cloud
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
fetch-depth: 0

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 20.18.2

- name: Install dependencies
run: npm install

- name: Run tests and generate coverage
run: npm run coverage

- name: SonarQube Cloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: >
-Dsonar.projectKey=AntaresSimulatorTeam_antares-datamanager-front
-Dsonar.organization=antaressimulatorteam
-Dsonar.javascript.lcov.reportPaths=coverage/lcov.info
-Dsonar.typescript.lcov.reportPaths=coverage/lcov.info
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,6 @@ dist-ssr
*.njsproj
*.sln
*.sw?

# Coverage couverture
coverage/
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview",
"cy:open": "cypress open",
"prepare": "husky && husky install"
"prepare": "husky && husky install",
"coverage": "vitest run --coverage"
},
"dependencies": {
"@floating-ui/react": "^0.26.28",
Expand Down
3 changes: 3 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ sonar.sources=src
# Encoding of the source code. Default is default system encoding
sonar.sourceEncoding=UTF-8


# Test coverage report
sonar.typescript.lcov.reportPaths=coverage/lcov.info

0 comments on commit 5e26ac3

Please sign in to comment.