Skip to content

Exclude .vitest/ from the test task's cache inputs - #4256

Merged
nstepien merged 1 commit into
mainfrom
test-cache-vitest-attachments
Oct 27, 2026
Merged

nstepien merged 1 commit into
mainfrom
test-cache-vitest-attachments

Conversation

@nstepien

Copy link
Copy Markdown
Collaborator

vp run test never cached the test task. The it.fails() test in renderEditCell.test.tsx, added in #4250, writes a failure screenshot to .vitest/attachments/ on every run, and Vite Task's automatic tracking saw the task read and write that file:

Not cached: the task read and wrote '.vitest/attachments/failure-screenshots/renderEditCell.test.tsx/Editor---should-open-editor-when-test-runs-userEvent-type---on-unfocused-cell.png'

The test task now excludes .vitest/** from its inputs, like coverage/**. Outputs are still tracked automatically, so a cache hit restores the screenshots.

Checked locally

With vp run -v test --project "browser (chromium)":

  • Before: two runs in a row both ran the tests, and the summary showed the message above.
  • After: the first run was a cache miss ('vite.config.ts' modified), and the second was a cache hit, although the first run had rewritten the screenshot.

🤖 Generated with Claude Code

The `it.fails()` test in `renderEditCell.test.tsx` writes a failure
screenshot to `.vitest/attachments/` on every run. Vite Task saw the
`test` task read and write that file, so it never cached the task.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@nstepien
nstepien marked this pull request as ready for review October 27, 2026 17:52
@nstepien
nstepien merged commit 9b67f86 into main Oct 27, 2026
8 of 10 checks passed
@nstepien
nstepien deleted the test-cache-vitest-attachments branch October 27, 2026 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant