Created
April 7, 2025 11:54
-
-
Save cyyynthia/055c66d6e6c3f81d4aa647d002498979 to your computer and use it in GitHub Desktop.
Isolate Vitest snapshots per-browser in browser tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { defineConfig } from 'vitest/config' | |
| export default defineConfig({ | |
| test: { | |
| browser: { | |
| enabled: true, | |
| provider: 'playwright', | |
| instances: [ | |
| { browser: 'chromium', context: { locale: 'en-US', timezoneId: 'Europe/Paris' } }, | |
| { browser: 'firefox', context: { locale: 'en-US', timezoneId: 'Europe/Paris' } }, | |
| { browser: 'webkit', context: { locale: 'en-US', timezoneId: 'Europe/Paris' } }, | |
| ], | |
| }, | |
| resolveSnapshotPath: (testfile, ext, { config }) => { | |
| return config.browser.name | |
| ? join(dirname(testfile), '__snapshots__', config.browser.name, basename(testfile) + ext) | |
| : join(dirname(testfile), '__snapshots__', basename(testfile) + ext) | |
| }, | |
| } | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment