Skip to content

Commit f9a4f39

Browse files
branchseerclaude
andcommitted
fix(test): delete output files instead of directories in output-cache-test
On Windows, `create_dir_all` causes fspy to track parent directories as inferred inputs. Deleting the directory then triggers a cache miss on the next run. Fix by deleting only the output files, keeping directories intact. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 20bf309 commit f9a4f39

File tree

5 files changed

+22
-18
lines changed

5 files changed

+22
-18
lines changed

crates/vite_task_bin/tests/e2e_snapshots/fixtures/output-cache-test/snapshots.toml

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ steps = [
88
["vt", "run", "auto-output"],
99
# Verify output exists
1010
["vtt", "print-file", "dist/out.txt"],
11-
# Delete the output file
12-
["vtt", "rm", "-rf", "dist"],
11+
# Delete the output file (keep directory to avoid fspy inferred-input miss on Windows)
12+
["vtt", "rm", "dist/out.txt"],
1313
# Second run - cache hit, should restore dist/out.txt
1414
["vt", "run", "auto-output"],
1515
# Verify output was restored
@@ -26,20 +26,18 @@ steps = [
2626
"run",
2727
"glob-output",
2828
],
29-
# Delete both output directories
29+
# Delete output files (keep directories)
3030
[
3131
"vtt",
3232
"rm",
33-
"-rf",
34-
"dist",
33+
"dist/out.txt",
3534
],
3635
[
3736
"vtt",
3837
"rm",
39-
"-rf",
40-
"tmp",
38+
"tmp/temp.txt",
4139
],
42-
# Second run - cache hit, should restore dist/ but not tmp/
40+
# Second run - cache hit, should restore dist/out.txt but not tmp/temp.txt
4341
[
4442
"vt",
4543
"run",
@@ -65,8 +63,8 @@ name = "auto output with non-auto input"
6563
steps = [
6664
# First run - input: ["src/**"] (no auto), output: default (auto)
6765
["vt", "run", "auto-output-no-auto-input"],
68-
# Delete output
69-
["vtt", "rm", "-rf", "dist"],
66+
# Delete output file
67+
["vtt", "rm", "dist/out.txt"],
7068
# Cache hit - output files should still be restored
7169
["vt", "run", "auto-output-no-auto-input"],
7270
# Verify output was restored
@@ -83,12 +81,16 @@ steps = [
8381
"run",
8482
"negative-output",
8583
],
86-
# Delete all outputs
84+
# Delete output files
85+
[
86+
"vtt",
87+
"rm",
88+
"dist/out.txt",
89+
],
8790
[
8891
"vtt",
8992
"rm",
90-
"-rf",
91-
"dist",
93+
"dist/cache/tmp.txt",
9294
],
9395
# Cache hit - should restore dist/out.txt but NOT dist/cache/tmp.txt
9496
[

crates/vite_task_bin/tests/e2e_snapshots/fixtures/output-cache-test/snapshots/auto output - files restored on cache hit.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ done
1212
vt run: 0/2 cache hit (0%). (Run `vt run --last-details` for full details)
1313
> vtt print-file dist/out.txt
1414
built
15-
> vtt rm -rf dist
15+
> vtt rm dist/out.txt
1616

1717
> vt run auto-output
1818
$ vtt write-file dist/out.txt builtcache hit, replaying

crates/vite_task_bin/tests/e2e_snapshots/fixtures/output-cache-test/snapshots/auto output with non-auto input.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ done
1010

1111
---
1212
vt run: 0/2 cache hit (0%). (Run `vt run --last-details` for full details)
13-
> vtt rm -rf dist
13+
> vtt rm dist/out.txt
1414

1515
> vt run auto-output-no-auto-input
1616
$ vtt write-file dist/out.txt builtcache hit, replaying

crates/vite_task_bin/tests/e2e_snapshots/fixtures/output-cache-test/snapshots/glob output - only matched files restored.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ done
1212

1313
---
1414
vt run: 0/3 cache hit (0%). (Run `vt run --last-details` for full details)
15-
> vtt rm -rf dist
15+
> vtt rm dist/out.txt
1616

17-
> vtt rm -rf tmp
17+
> vtt rm tmp/temp.txt
1818

1919
> vt run glob-output
2020
$ vtt write-file dist/out.txt builtcache hit, replaying

crates/vite_task_bin/tests/e2e_snapshots/fixtures/output-cache-test/snapshots/negative output - excluded files not restored.snap

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ done
1212

1313
---
1414
vt run: 0/3 cache hit (0%). (Run `vt run --last-details` for full details)
15-
> vtt rm -rf dist
15+
> vtt rm dist/out.txt
16+
17+
> vtt rm dist/cache/tmp.txt
1618

1719
> vt run negative-output
1820
$ vtt write-file dist/out.txt builtcache hit, replaying

0 commit comments

Comments
 (0)