-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Describe the bug
Regression: In v4.1.0-beta.4, the changes from #9552 (fix: don't take failure screenshot if tests have artifacts created by toMatchScreenshot) unintentionally prevent a failure screenshot from being captured and saved in unstable test failures.
Problem:
When a test fails with an unstable screenshot error (e.g., Could not capture a stable screenshot within...), Vitest now only provides a reference screenshot artifact. This makes it impossible to see what was actually rendered at the point of instability, hampering debugging ability. Previously, an 'internal:failureScreenshot' artifact was attached, but after this change, it is missing for these failures if any internal:toMatchScreenshot artifacts exist.
Expected:
When a test fails due to instability or any other reason that doesn't generate regular diff/actual artifacts, the failure screenshot should still be saved and attached, probably in .vitest-attachments folder though and not next to referenced screenshot.
Reproduction
Attaching minimal reproduction case
unstable-reproduction-test.zip
System Info
System:
OS: macOS 26.2
CPU: (12) arm64 Apple M3 Pro
Memory: 384.31 MB / 36.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.15.1 - /Users/smilaite/.nvm/versions/node/v22.15.1/bin/node
Yarn: 1.22.22 - /opt/homebrew/bin/yarn
npm: 10.9.2 - /Users/smilaite/.nvm/versions/node/v22.15.1/bin/npm
pnpm: 9.15.2 - /Users/smilaite/Library/pnpm/pnpm
Browsers:
Chrome: 145.0.7632.76
Chrome Canary: 147.0.7693.0
Firefox: 146.0
Safari: 26.2Used Package Manager
npm
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status