Skip to content

Commit f7ab0e7

Browse files
committed
refactor: Get coverage badge working
1 parent e3b29d6 commit f7ab0e7

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

.github/workflows/node.js.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
strategy:
1111
fail-fast: true
1212
matrix:
13-
node-version: [16.x]
13+
node-version: [14.x, 16.x]
1414
steps:
1515
- uses: actions/checkout@v2
1616
- name: Use Node.js ${{ matrix.node-version }}
@@ -36,7 +36,7 @@ jobs:
3636
# ];
3737
# SUMMARY = SUMMARY.split('\n')[5]; // 'Lines : 31.93% ( 38/119 )'
3838
# SUMMARY = SUMMARY.split(':')[1].split('(')[0].trim(); // '31.93%'
39-
SUMMARY="$(npm test -- --coverageReporters='text-summary' | tail -2 | head -1)"
39+
SUMMARY="$(npm run test-ci | tail -2 | head -1)"
4040
TOKENS=($SUMMARY)
4141
# process.env.COVERAGE = '31.93%';
4242
echo "COVERAGE=$(echo ${TOKENS[2]})" >> $GITHUB_ENV

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"release": "npm login && npm publish",
3636
"test": "vitest run --coverage",
3737
"test-coverage": "vitest run --coverage",
38+
"test-ci": "vitest run --coverage.enabled --coverage.reporter='text-summary'",
3839
"test-dev": "vitest"
3940
},
4041
"dependencies": {

0 commit comments

Comments
 (0)