Skip to content

Splitting tests based on file suffix or best practice #5557

Answered by AriPerkkio
joaomarcelofm asked this question in Q&A
Discussion options

You must be logged in to vote

I would recommend to use workspaces:

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...
        },
    },
]);

You can also create two separate configuration files and pass it as vitest --config ./path/to/vitest.config.ts.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@joaomarcelofm
Comment options

@sheremet-va
Comment options

Answer selected by joaomarcelofm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants