Skip to content

Commit

Permalink
Use LCOV combined coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
bengl committed Dec 11, 2023
1 parent 16115e9 commit dd23935
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,25 @@ jobs:
- run: npm test
- run: npm run test:ts
if: (matrix.node-version != '12.x' && matrix.node-version != '14.x' && matrix.node-version != '16.10.0')
- name: Archive code coverage results
if: success()
uses: actions/upload-artifact@v3
with:
name: coverage_${{ matrix.os }}_${{ matrix.node-version}}
if-no-files-found: ignore
path: coverage/lcov.info

coverage:
runs-on: ubuntu-latest
needs: build
steps:
- name: Download reports' artifacts
uses: actions/download-artifact@v3
with:
path: downloaded_artifacts
- name: Install lcov
run: sudo apt install -y lcov
- name: Combine all coverage data
run: find . -type f -name '*.info' -printf '-a\0%f\0' | xargs -J % -0 -- lcov % -o all_lcov.info
- name: Report
run: lcov --summary all_lcov.info --fail-under-lines 90
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"description": "Intercept imports in Node.js",
"main": "index.js",
"scripts": {
"test": "c8 --check-coverage --lines 85 imhotap --runner 'node test/runtest' --files test/{hook,low-level,other,get-esm-exports}/*",
"test:ts": "c8 imhotap --runner 'node test/runtest' --files test/typescript/*.test.mts",
"test": "c8 --reporter lcov --check-coverage --lines 85 imhotap --runner 'node test/runtest' --files test/{hook,low-level,other,get-esm-exports}/*",
"test:ts": "c8 --reporter lcov imhotap --runner 'node test/runtest' --files test/typescript/*.test.mts",
"coverage": "c8 --reporter html imhotap --runner 'node test/runtest' --files test/{hook,low-level,other,get-esm-exports}/* && echo '\nNow open coverage/index.html\n'"
},
"repository": {
Expand Down

0 comments on commit dd23935

Please sign in to comment.