Skip to content

Commit 4e3fdd5

Browse files
committed
test: add coverage reporting and badge generation to CI workflow
1 parent cb9fb05 commit 4e3fdd5

4 files changed

Lines changed: 328 additions & 5 deletions

File tree

.github/workflows/ci.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,21 @@ jobs:
3333
- run: npm run build
3434
- run: npm run test
3535
- run: cp -rp dist doc
36+
- run: cp -rp coverage/lcov-report doc
37+
38+
- name: Extract coverage percentage
39+
id: coverage
40+
run: |
41+
COVERAGE=$(cat coverage/js-coverage.txt)
42+
echo "coverage=$COVERAGE" >> $GITHUB_OUTPUT
43+
echo "Coverage: $COVERAGE%"
44+
45+
- name: Generate Badges
46+
uses: jaywcjlove/generated-badges@main
47+
with:
48+
label: coverage
49+
status: ${{ steps.coverage.outputs.coverage }}%
50+
output: doc/coverage.svg
3651

3752
- name: Generate Contributors Images
3853
uses: jaywcjlove/github-action-contributors@main

package-lock.json

Lines changed: 158 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,6 @@
5353
"type": "git",
5454
"url": "git+https://github.com/jaywcjlove/hotkeys-js.git"
5555
},
56-
"jest": {
57-
"testEnvironmentOptions": {
58-
"url": "http://localhost/"
59-
}
60-
},
6156
"devDependencies": {
6257
"@eslint/js": "^9.39.1",
6358
"@rollup/plugin-terser": "^0.4.4",

0 commit comments

Comments
 (0)