-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Description
Clear and concise description of the problem
Currently, the retry option in vitest.config.ts applies globally to all test environments. It would be valuable to have different retry configurations for browser tests versus jsdom tests.
Use Case:
Browser tests (via Playwright/WebDriver) are often more prone to flakiness due to:
- Timing issues with real DOM rendering
- Network requests
- Animation/transition delays
- Browser-specific rendering differences
Meanwhile, jsdom tests are typically more stable and deterministic. Having the ability to retry browser tests while keeping jsdom tests strict would improve CI reliability without masking issues in unit tests.
Suggested solution
This would probably be the best and easiest option:
export default defineConfig({
test: {
retry: 0, // Default for jsdom
browser: {
provider: playwright(),
enabled: true,
retry: 1, // Specific to browser tests
instances: [{ browser: 'chromium' }],
},
},
});
Alternative
An alternative setup could be an environment-specific retry:
export default defineConfig({
test: {
retry: {
browser: 1,
jsdom: 0,
},
},
});
Additional context
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that request the same feature to avoid creating a duplicate.