You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The directory name used for storing reference screenshots.
55
+
56
+
This value is passed as `screenshotDirectory` to [`browser.expect.toMatchScreenshot.resolveScreenshotPath`](#browserexpecttomatchscreenshotresolvescreenshotpath) and [`browser.expect.toMatchScreenshot.resolveDiffPath`](#browserexpecttomatchscreenshotresolvediffpath), and used in the default path resolution of `resolveScreenshotPath`.
The value provided to [`browser.expect.toMatchScreenshot.screenshotDirectory`](#browserexpecttomatchscreenshotscreenshotdirectory), if none is provided, its default value (`__screenshots__`).
Copy file name to clipboardExpand all lines: docs/guide/migration.md
+26Lines changed: 26 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -182,6 +182,32 @@ Vitest now uses a single `.vitest` directory at the project root as the shared a
182
182
-**Blob reporter** and `--merge-reports`: `.vitest-reports/blob-*.json` → `.vitest/blob/blob-*.json`
183
183
-**HTML reporter** ([`html`](/guide/reporters#html-reporter)): `html/index.html` → `.vitest/index.html`, and its option changed from `outputFile` (a file) to `outputDir` (a directory)
184
184
185
+
### `toMatchScreenshot` Now Uses a Dedicated Screenshot Directory Config
186
+
187
+
Previously, reference screenshots for `toMatchScreenshot` did not correctly respect `browser.screenshotDirectory`. As a result, screenshots were saved in an unintended location when a custom directory was configured.
188
+
189
+
This has now been fixed by introducing a dedicated option: `browser.expect.toMatchScreenshot.screenshotDirectory`. Its default value is `__screenshots__`.
190
+
191
+
- If you did not set `browser.screenshotDirectory`, no changes are required.
192
+
- If you did set `browser.screenshotDirectory`, you must now explicitly configure the new option:
* The value provided to {@linkcode ToMatchScreenshotOptions.screenshotDirectory|browser.expect.toMatchScreenshot.screenshotDirectory}, if none is provided, its default value (`__screenshots__`).
524
522
*/
525
523
screenshotDirectory: string
526
524
/**
@@ -557,16 +555,24 @@ type ToMatchScreenshotResolvePath = (data: {
557
555
})=>string
558
556
559
557
exportinterfaceToMatchScreenshotOptions{
558
+
/**
559
+
* The directory name used for storing reference screenshots.
560
+
*
561
+
* This value is passed as `screenshotDirectory` to {@linkcode resolveScreenshotPath|browser.expect.toMatchScreenshot.resolveScreenshotPath} and {@linkcode resolveDiffPath|browser.expect.toMatchScreenshot.resolveDiffPath}, and used in the default path resolution of `resolveScreenshotPath`.
0 commit comments