Skip to content

Commit

Permalink
fix: sonar coverage path (#7187)
Browse files Browse the repository at this point in the history
* update coverage path

* added step to generate lcov file

* update lcov generation command

* updated lcovinstruction

* updated coverage path for upload

* removed locv command merged it into merge command

* Update package.json yarn test:merge-coverage

* add exclusion for ppom lib file

---------

Co-authored-by: Mark Stacey <markjstacey@gmail.com>
  • Loading branch information
sethkfman and Gudahtt authored Sep 15, 2023
1 parent 98199ab commit 31744a1
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ jobs:
- uses: actions/upload-artifact@v3
with:
name: coverage
path: ./tests/merged-coverage/coverage.json
path: ./tests/merged-coverage/lcov.info
if-no-files-found: error
- name: Require clean working directory
shell: bash
Expand All @@ -133,7 +133,7 @@ jobs:
- uses: actions/download-artifact@v3
with:
name: coverage
path: tests/coverage/
path: coverage/
- name: Upload coverage reports to Codecov
if: ${{ always() }}
uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70
Expand Down
1 change: 1 addition & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const config = {
'__mocks__/',
'<rootDir>/app/util/test/',
'<rootDir>/app/util/testUtils/',
'<rootDir>/app/lib/ppom/ppom.html.js',
],
coverageReporters: ['text-summary', 'lcov'],
coverageDirectory: '<rootDir>/tests/coverage',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"test:depcheck": "yarn depcheck",
"test:tgz-check": "./scripts/tgz-check.sh",
"test:attribution-check": "./scripts/attributions-check.sh",
"test:merge-coverage": "nyc merge ./tests/coverage ./tests/merged-coverage/coverage.json",
"test:merge-coverage": "nyc report --temp-dir ./tests/coverage --report-dir ./tests/merged-coverage/ --reporter json --reporter text --reporter lcovonly",
"test:validate-coverage": "nyc check-coverage --nycrc-path ./coverage-thresholds.json -t ./tests/merged-coverage/",
"sourcemaps:android": "node_modules/.bin/react-native bundle --platform android --entry-file index.js --dev false --reset-cache --bundle-output /tmp/bundle.android.js --assets-dest /tmp/ --sourcemap-output sourcemaps/android/index.js.map",
"sourcemaps:ios": "node_modules/.bin/react-native bundle --platform ios --entry-file index.js --dev false --reset-cache --bundle-output /tmp/bundle.ios.js --assets-dest /tmp/ --sourcemap-output sourcemaps/ios/index.js.map",
Expand Down
4 changes: 2 additions & 2 deletions sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ sonar.sources=app/
# Inclusions for test files.
sonar.test.inclusions=**.test.**

# Test coverage path
sonar.javascript.lcov.reportPaths=/tests/coverage/lcov.info
# Test coverage path in GitHub action
sonar.javascript.lcov.reportPaths=/coverage/lcov.info

# Encoding of the source code. Default is default system encoding
#sonar.sourceEncoding=UTF-8

0 comments on commit 31744a1

Please sign in to comment.