Skip to content

Commit f996030

Browse files
committed
Collect Jest test coverage
Signed-off-by: Florian Hotze <[email protected]>
1 parent ce09186 commit f996030

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

.github/workflows/build.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ jobs:
4343
path: |
4444
dist
4545
!dist/*.txt
46+
- name: Upload test coverage report
47+
uses: actions/upload-artifact@v4
48+
with:
49+
name: test-coverage
50+
path: |
51+
test/coverage/lcov-report
4652
4753
- name: Publish Docs
4854
if: github.ref == 'refs/heads/main'

test/jest.config.js jest.config.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ module.exports = {
2020
collectCoverage: true,
2121

2222
// An array of glob patterns indicating a set of files for which coverage information should be collected
23-
// collectCoverageFrom: undefined,
23+
collectCoverageFrom: ['src/**/*.js'],
2424

2525
// The directory where Jest should output its coverage files
26-
coverageDirectory: 'coverage',
26+
coverageDirectory: 'test/coverage',
2727

2828
// An array of regexp pattern strings used to skip coverage collection
2929
// coveragePathIgnorePatterns: [
@@ -130,7 +130,7 @@ module.exports = {
130130
// runner: "jest-runner",
131131

132132
// The paths to modules that run some code to configure or set up the testing environment before each test
133-
setupFiles: ['./jest.setup.js', './@runtime.mock.js'],
133+
setupFiles: ['./test/jest.setup.js', './test/@runtime.mock.js'],
134134

135135
// A list of paths to modules that run some code to configure or set up the testing framework before each test
136136
// setupFilesAfterEnv: [],

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"lint:fix": "npx eslint --fix src",
2222
"pretest": "npm run lint",
2323
"test:mocha": "mocha test/**/*.test.js",
24-
"test:jest": "jest --config test/jest.config.js",
24+
"test:jest": "jest --config jest.config.js",
2525
"test": "npm run test:mocha && npm run test:jest",
2626
"types": "tsc --project ./build/tsconfig.json",
2727
"types:test": "tsc --project ./build/tsconfig.test.json",

0 commit comments

Comments
 (0)