How to separate unit and integration test #4675
-
Hello, I wanted to ask if there's a way to separate unit and integration tests other than by specifying a glob pattern. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
What kind of separation do you need? I would probably just specify two workspace projects and configure integration test related settings there. But this still requires glob patterns to separate tests from each other: import { defineWorkspace } from 'vitest/config';
export default defineWorkspace([
{
test: {
name: 'unit',
include: ['**/*.unit.test.ts'],
},
},
{
test: {
name: 'integration',
include: ['**/*.integration.test.ts'],
// More integration test related setup here...
},
},
]); |
Beta Was this translation helpful? Give feedback.
-
I was also trying to figure it out and pretty good solution turned out to be separating integration tests into dedicated This way the execution via Nx executor runs correctly for both targets and if I run individual tests via IntelliJ Idea or WebStorm, they also get picked up correctly as it prioritizes config closer to the file. |
Beta Was this translation helpful? Give feedback.
What kind of separation do you need? I would probably just specify two workspace projects and configure integration test related settings there. But this still requires glob patterns to separate tests from each other: