Skip to content

Commit

Permalink
fix: Vitest coverage configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
riipandi committed Sep 4, 2024
1 parent 3b72a24 commit aa84de3
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 16 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
"@types/node": "^22.5.3",
"@types/react-dom": "^18.3.0",
"@types/react": "^18.3.5",
"@vitest/coverage-v8": "^2.0.5",
"@vitest/coverage-istanbul": "^2.0.5",
"@vitest/ui": "^2.0.5",
"autoprefixer": "^10.4.20",
"dotenv-cli": "^7.4.2",
Expand Down
33 changes: 20 additions & 13 deletions pnpm-lock.yaml

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

3 changes: 2 additions & 1 deletion tests/setup-test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// @reference: https://dev.to/codeparrot/test-your-react-apps-with-vitest-2llb
// @ref: https://dev.to/codeparrot/test-your-react-apps-with-vitest-2llb
// @ref: https://www.machinet.net/tutorial-eng/vitest-coverage-comprehensive-guide

import { installGlobals } from '@remix-run/node'
import '@testing-library/jest-dom/vitest'
Expand Down
10 changes: 9 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,20 @@ export default defineConfig({
html: './tests-results/index.html',
},
coverage: {
provider: 'v8',
provider: 'istanbul',
reporter: process.env.CI ? ['json'] : ['html-spa'],
reportsDirectory: './tests-results/coverage',
include: ['app/**/*.{js,jsx,ts,tsx}'],
cleanOnRerun: true,
clean: true,
thresholds: {
global: {
statements: 80,
branches: 70,
functions: 75,
lines: 80,
},
},
},
dir: './tests',
globals: true,
Expand Down

0 comments on commit aa84de3

Please sign in to comment.