Skip to content

Commit 16cc028

Browse files
committed
chore: configure code coverage
1 parent b5dce21 commit 16cc028

File tree

4 files changed

+90
-3
lines changed

4 files changed

+90
-3
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
name: Continuous integration
22

3-
on: push
3+
on:
4+
pull_request:
5+
branches:
6+
- main
47

58
jobs:
69
build:
@@ -31,7 +34,11 @@ jobs:
3134
run: npm run check:types
3235

3336
- name: Run tests
34-
run: npm run test
37+
run: npm run test:coverage
38+
39+
- name: Submit coverage
40+
uses: codecov/codecov-action@v3
41+
if: matrix.os == 'ubuntu-latest' && matrix.node == '18.x'
3542

3643
- name: Build
3744
run: npm run build

package-lock.json

Lines changed: 76 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: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"start": "storybook dev -p 6007 --ci",
4747
"storybook": "storybook dev -p 6007 --ci",
4848
"test": "vitest",
49-
"coverage": "vitest --coverage",
49+
"test:coverage": "vitest --coverage",
5050
"upgrade-interactive": "npm-check -u"
5151
},
5252
"peerDependencies": {
@@ -71,6 +71,7 @@
7171
"@typescript-eslint/eslint-plugin": "^5.52.0",
7272
"@typescript-eslint/parser": "^5.52.0",
7373
"@vitejs/plugin-react": "^3.0.0",
74+
"@vitest/coverage-istanbul": "^0.28.5",
7475
"babel-loader": "^9.1.0",
7576
"date-fns": "^2.29.3",
7677
"eslint": "^8.34.0",

vite.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ export default defineConfig({
3535
test: {
3636
environment: 'jsdom',
3737
setupFiles: ['testSetup.ts'],
38+
coverage: {
39+
provider: 'istanbul',
40+
},
3841
},
3942
plugins: [
4043
react({

0 commit comments

Comments
 (0)