Coverage only modified files #4057
Replies: 3 comments 6 replies
-
|
Beta Was this translation helpful? Give feedback.
-
Sorry, it`s not working. maybe I'm missing something vite.config import react from '@vitejs/plugin-react'
import tsconfigPaths from 'vite-tsconfig-paths'
import { defineConfig } from 'vitest/config'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react(), tsconfigPaths()],
test: {
globals: true,
environment: 'jsdom',
coverage: {
provider: 'v8',
exclude: ['**/style*.ts'],
all: false,
statements: 100,
lines: 100,
branches: 100,
functions: 100,
},
setupFiles: './src/test/setup.ts',
passWithNoTests: true,
},
}) package.json "test:staged": "vitest related --run",
"coverage:staged": "vitest related --coverage --run",
"lint-staged": {
"src/**/*.{ts,tsx}": [
"yarn lint",
"yarn pretty",
"yarn test:staged",
"yarn coverage:staged"
]
} my commit pipeline: Related is indicating only my modified component test but it's throwing error for global coverage not my modified coverage. modified file coverage: Am I missing something ? |
Beta Was this translation helpful? Give feedback.
-
This was my initial question. I only modified FormField files, not entire reported files. In my staged files was only FormField component and I wrote a full test coverage (as printed above) but coverage is throwing an error saying all coverage is 82%, and it's true BUT I would like to consider only for staged files coverage. Even if full coverage is not 100%. Is it possible ? |
Beta Was this translation helpful? Give feedback.
-
Is it possible to run coverage only to modified files, like using lint-staged with regular test ?
Beta Was this translation helpful? Give feedback.
All reactions