Skip to content

Commit

Permalink
Add coverage and codecov
Browse files Browse the repository at this point in the history
  • Loading branch information
sverhoeven committed Aug 8, 2024
1 parent 9e5c4cf commit 5b0c6b4
Show file tree
Hide file tree
Showing 6 changed files with 136 additions and 2 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
pull_request:
branches: [ "main" ]

permissions:
id-token: write # This is required for requesting the JWT

jobs:
test:
runs-on: ubuntu-latest
Expand All @@ -24,4 +27,9 @@ jobs:
- name: Install Playwright Browsers
run: pnpm exec playwright install --with-deps chromium
- name: Test
run: pnpm test
run: pnpm test -- run --coverage --coverage.reporter=clover
- name: Code coverage upload
uses: codecov/codecov-action@v4
with:
files: ./coverage/clover.xml
use_oidc: true
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@ docs

# Pack
i-vresse-haddock3-ui-*.tgz

# Test
coverage
5 changes: 4 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,13 @@ pnpm format
Testing logic can be done with tests written with [vitest](https://vitest.dev) in [browser mode](https://vitest.dev/guide/browser/).

```bash
pnpm exec playwright install # Only needed once
pnpm exec playwright install # Only needed once per installation
pnpm test
# Or to run headless
CI=1 pnpm test
# Or for coverage
CI=1 pnpm test -- run --coverage --coverage.reporter=html
# Open coverage/index.html in browser
```

Stories and tests can be located next to the code in the `src/` folder.
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"@typescript-eslint/parser": "^7.15.0",
"@vitejs/plugin-react": "^4.3.1",
"@vitest/browser": "^2.0.5",
"@vitest/coverage-istanbul": "^2.0.5",
"autoprefixer": "^10.4.19",
"playwright": "^1.46.0",
"postcss": "^8.4.40",
Expand Down
113 changes: 113 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,11 @@ export default defineConfig({
provider: "playwright",
providerOptions: {},
},
coverage: {
provider: "istanbul",
reporter: ["text"],
include: ["src/**/*"],
exclude: ["**/*.stories.*", "**/*.test.*"],
},
},
});

0 comments on commit 5b0c6b4

Please sign in to comment.