Skip to content

Commit 362614d

Browse files
committed
feat(workflows): improve test workflow with coverage and artifact upload
- Revised workflow to include: - Coverage report generation with `npm run coverage`. - Artifact upload for coverage reports (only for Node.js 20.x). - Updated dependencies in `package.json` to include `@vitest/coverage-v8` for enhanced coverage support. - Enhanced vitest configuration to use additional coverage reporters: `json-summary`, `html`, and `lcov`. This change improves CI test coverage tracking and aligns workflows with best practices. <!-- ps-id: 117158f7-3c26-4834-8e08-6c2842186ad9 -->
1 parent 9986c76 commit 362614d

File tree

4 files changed

+555
-23
lines changed

4 files changed

+555
-23
lines changed

.github/workflows/nodejs.yml

+20-6
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ on:
1010
branches: [ main ]
1111

1212
jobs:
13-
build:
14-
13+
test:
1514
runs-on: ubuntu-latest
1615

1716
strategy:
@@ -23,11 +22,26 @@ jobs:
2322
uses: actions/checkout@v3
2423
with:
2524
submodules: 'true'
25+
2626
- name: 🟢 node ${{ matrix.node-version }}
2727
uses: actions/setup-node@v3
2828
with:
2929
node-version: ${{ matrix.node-version }}
30-
- run: npm install
31-
- run: npm run build --if-present
32-
- name: ☢ tests
33-
run: npm test
30+
31+
- name: 📦 Install dependencies
32+
run: npm install
33+
34+
- name: 🏗️ Build
35+
run: npm run build --if-present
36+
37+
- name: ☢ Run tests with coverage
38+
run: npm run coverage
39+
40+
- name: 📊 Upload coverage reports
41+
if: matrix.node-version == '20.x' # only upload coverage for one Node version
42+
uses: actions/upload-artifact@v4
43+
with:
44+
name: coverage-report
45+
path: coverage/
46+
retention-days: 30
47+
if-no-files-found: error

0 commit comments

Comments
 (0)