Skip to content

Commit 19092bb

Browse files
branchseerclaude
andcommitted
docs(e2e): move output_cache_test comments into toml fields
Follows the convention introduced in main (#347): per-`[[e2e]]` and per- step descriptions use the TOML `comment` field instead of bare `#` lines, so they render under the snapshot headings and inside each step's block. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 6854967 commit 19092bb

8 files changed

Lines changed: 144 additions & 123 deletions
Lines changed: 63 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -1,157 +1,98 @@
1-
# Test output restoration when cached tasks are replayed
2-
3-
# 1. Auto output detection (default): output files written by the task are restored on cache hit
41
[[e2e]]
52
name = "auto_output___files_restored_on_cache_hit"
3+
comment = """
4+
Auto output detection (default): output files written by the task are
5+
restored on a cache hit.
6+
"""
67
steps = [
7-
# First run - writes dist/out.txt
8-
["vt", "run", "auto-output"],
9-
# Verify output exists
10-
["vtt", "print-file", "dist/out.txt"],
11-
# Delete the output file (keep directory to avoid fspy inferred-input miss on Windows)
12-
["vtt", "rm", "dist/out.txt"],
13-
# Second run - cache hit, should restore dist/out.txt
14-
["vt", "run", "auto-output"],
15-
# Verify output was restored
16-
["vtt", "print-file", "dist/out.txt"],
8+
{ argv = ["vt", "run", "auto-output"], comment = "first run writes dist/out.txt" },
9+
{ argv = ["vtt", "print-file", "dist/out.txt"], comment = "output exists after the build" },
10+
{ argv = ["vtt", "rm", "dist/out.txt"], comment = "delete only the file (keep dir to avoid an fspy inferred-input miss on Windows)" },
11+
{ argv = ["vt", "run", "auto-output"], comment = "cache hit, should restore dist/out.txt" },
12+
{ argv = ["vtt", "print-file", "dist/out.txt"], comment = "output was restored from the archive" },
1713
]
1814

19-
# 2. Glob output: only files matching output globs are restored
2015
[[e2e]]
2116
name = "glob_output___only_matched_files_restored"
17+
comment = """
18+
Glob output: only files matching the configured output globs are restored
19+
on a cache hit; files produced outside those globs are left alone.
20+
"""
2221
steps = [
23-
[
24-
"vt",
25-
"run",
26-
"glob-output",
27-
],
28-
[
29-
"vtt",
30-
"rm",
31-
"dist/out.txt",
32-
],
33-
[
34-
"vtt",
35-
"rm",
36-
"tmp/temp.txt",
37-
],
38-
# Second run - cache hit, should restore dist/out.txt but not tmp/temp.txt
39-
[
40-
"vt",
41-
"run",
42-
"glob-output",
43-
],
44-
[
45-
"vtt",
46-
"print-file",
47-
"dist/out.txt",
48-
],
49-
# tmp/temp.txt should NOT exist (not in output globs)
50-
{ argv = [
51-
"vtt",
52-
"print-file",
53-
"tmp/temp.txt",
54-
], comment = "should fail - tmp not in output globs" },
22+
{ argv = ["vt", "run", "glob-output"], comment = "first run writes dist/out.txt and tmp/temp.txt" },
23+
{ argv = ["vtt", "rm", "dist/out.txt"], comment = "delete the glob-matched output" },
24+
{ argv = ["vtt", "rm", "tmp/temp.txt"], comment = "delete the non-matched output" },
25+
{ argv = ["vt", "run", "glob-output"], comment = "cache hit: should restore dist/out.txt but not tmp/temp.txt" },
26+
{ argv = ["vtt", "print-file", "dist/out.txt"], comment = "dist/out.txt was restored" },
27+
{ argv = ["vtt", "print-file", "tmp/temp.txt"], comment = "should fail - tmp not in output globs" },
5528
]
5629

57-
# 3. Auto output works independently of input auto
5830
[[e2e]]
5931
name = "auto_output_with_non_auto_input"
32+
comment = """
33+
Auto output works even when input tracking is explicit
34+
(`input: [\"src/**\"]`). Output auto-detection and input auto-detection
35+
are independent.
36+
"""
6037
steps = [
61-
# First run - input: ["src/**"] (no auto), output: default (auto)
62-
["vt", "run", "auto-output-no-auto-input"],
63-
["vtt", "rm", "dist/out.txt"],
64-
# Cache hit - output files should still be restored
65-
["vt", "run", "auto-output-no-auto-input"],
66-
["vtt", "print-file", "dist/out.txt"],
38+
{ argv = ["vt", "run", "auto-output-no-auto-input"], comment = "first run: input src/** (no auto), output default (auto)" },
39+
{ argv = ["vtt", "rm", "dist/out.txt"], comment = "delete the output" },
40+
{ argv = ["vt", "run", "auto-output-no-auto-input"], comment = "cache hit - output files should still be restored" },
41+
{ argv = ["vtt", "print-file", "dist/out.txt"], comment = "output was restored" },
6742
]
6843

69-
# 4. Negative output globs exclude files from restoration
7044
[[e2e]]
7145
name = "negative_output___excluded_files_not_restored"
46+
comment = """
47+
Negative output globs exclude matching files from the cache archive, so
48+
they are not restored on a cache hit even though the task produced them.
49+
"""
7250
steps = [
73-
[
74-
"vt",
75-
"run",
76-
"negative-output",
77-
],
78-
[
79-
"vtt",
80-
"rm",
81-
"dist/out.txt",
82-
],
83-
[
84-
"vtt",
85-
"rm",
86-
"dist/cache/tmp.txt",
87-
],
88-
# Cache hit - should restore dist/out.txt but NOT dist/cache/tmp.txt
89-
[
90-
"vt",
91-
"run",
92-
"negative-output",
93-
],
94-
[
95-
"vtt",
96-
"print-file",
97-
"dist/out.txt",
98-
],
99-
# dist/cache/tmp.txt should NOT exist (excluded by !dist/cache/**)
100-
{ argv = [
101-
"vtt",
102-
"print-file",
103-
"dist/cache/tmp.txt",
104-
], comment = "should fail - excluded by negative glob" },
51+
{ argv = ["vt", "run", "negative-output"], comment = "first run writes dist/out.txt and dist/cache/tmp.txt" },
52+
{ argv = ["vtt", "rm", "dist/out.txt"], comment = "delete the archived output" },
53+
{ argv = ["vtt", "rm", "dist/cache/tmp.txt"], comment = "delete the excluded output" },
54+
{ argv = ["vt", "run", "negative-output"], comment = "cache hit: should restore dist/out.txt but NOT dist/cache/tmp.txt" },
55+
{ argv = ["vtt", "print-file", "dist/out.txt"], comment = "dist/out.txt was restored" },
56+
{ argv = ["vtt", "print-file", "dist/cache/tmp.txt"], comment = "should fail - excluded by !dist/cache/**" },
10557
]
10658

107-
# 5. Changing output config invalidates cache
10859
[[e2e]]
10960
name = "output_config_change_invalidates_cache"
61+
comment = """
62+
Changing a task's output configuration invalidates the cache entry —
63+
the next run is a miss, not a hit of the stale archive.
64+
"""
11065
steps = [
111-
["vt", "run", "output-config-change"],
112-
# Change output config
113-
["vtt", "replace-file-content", "vite-task.json", 'REPLACE_ME', 'dist/**'],
114-
# Should be a cache miss due to output config change
66+
{ argv = ["vt", "run", "output-config-change"], comment = "first run populates the cache" },
67+
{ argv = ["vtt", "replace-file-content", "vite-task.json", "REPLACE_ME", "dist/**"], comment = "change the output globs in the task config" },
11568
{ argv = ["vt", "run", "output-config-change"], comment = "cache miss: output config changed" },
11669
]
11770

118-
# 6. Input negative globs must not drop matching writes from the output archive.
119-
# Here the user excludes `dist/**` from inferred inputs (so rewriting dist/ won't
120-
# mark inputs as modified), but default auto output should still capture dist
121-
# writes and restore them on a cache hit.
12271
[[e2e]]
12372
name = "input_negative_does_not_drop_output_writes"
73+
comment = """
74+
Input negative globs must not drop matching writes from the output
75+
archive. Here the user excludes `dist/**` from inferred inputs (so
76+
rewriting dist/ won't mark inputs as modified), but default auto output
77+
should still capture dist writes and restore them on a cache hit.
78+
"""
12479
steps = [
125-
["vt", "run", "input-neg-dist-auto-output"],
126-
["vtt", "rm", "dist/out.txt"],
127-
# Cache hit should restore dist/out.txt
128-
["vt", "run", "input-neg-dist-auto-output"],
129-
["vtt", "print-file", "dist/out.txt"],
80+
{ argv = ["vt", "run", "input-neg-dist-auto-output"], comment = "first run writes dist/out.txt" },
81+
{ argv = ["vtt", "rm", "dist/out.txt"], comment = "delete the output" },
82+
{ argv = ["vt", "run", "input-neg-dist-auto-output"], comment = "cache hit should restore dist/out.txt" },
83+
{ argv = ["vtt", "print-file", "dist/out.txt"], comment = "output was restored despite dist/** being a negative input glob" },
13084
]
13185

132-
# 7. When input auto is disabled (explicit globs only), unrelated reads tracked
133-
# by fspy must NOT become inferred inputs. Default auto output still needs fspy
134-
# for write tracking, but reads outside `input: ["src/**"]` should be ignored.
13586
[[e2e]]
13687
name = "explicit_input_ignores_fspy_reads"
88+
comment = """
89+
When input auto is disabled (explicit globs only), unrelated reads
90+
tracked by fspy must NOT become inferred inputs. Default auto output
91+
still needs fspy for write tracking, but reads outside `input: [\"src/**\"]`
92+
should be ignored.
93+
"""
13794
steps = [
138-
[
139-
"vt",
140-
"run",
141-
"explicit-input-auto-output",
142-
],
143-
# Modify README.md (read by the task, NOT in input globs)
144-
[
145-
"vtt",
146-
"replace-file-content",
147-
"README.md",
148-
"v1",
149-
"v2",
150-
],
151-
# Should be a cache hit: README.md is not an input
152-
{ argv = [
153-
"vt",
154-
"run",
155-
"explicit-input-auto-output",
156-
], comment = "cache hit: README.md not in input globs" },
95+
{ argv = ["vt", "run", "explicit-input-auto-output"], comment = "first run reads README.md (not in input globs) and captures the output" },
96+
{ argv = ["vtt", "replace-file-content", "README.md", "v1", "v2"], comment = "modify README.md — not an input, so it must not invalidate the cache" },
97+
{ argv = ["vt", "run", "explicit-input-auto-output"], comment = "cache hit: README.md not in input globs" },
15798
]

crates/vite_task_bin/tests/e2e_snapshots/fixtures/output_cache_test/snapshots/auto_output___files_restored_on_cache_hit.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,35 @@
11
# auto_output___files_restored_on_cache_hit
22

3+
Auto output detection (default): output files written by the task are
4+
restored on a cache hit.
5+
36
## `vt run auto-output`
47

8+
first run writes dist/out.txt
9+
510
```
611
$ vtt write-file dist/out.txt built
712
```
813

914
## `vtt print-file dist/out.txt`
1015

16+
output exists after the build
17+
1118
```
1219
built
1320
```
1421

1522
## `vtt rm dist/out.txt`
1623

24+
delete only the file (keep dir to avoid an fspy inferred-input miss on Windows)
25+
1726
```
1827
```
1928

2029
## `vt run auto-output`
2130

31+
cache hit, should restore dist/out.txt
32+
2233
```
2334
$ vtt write-file dist/out.txt built ◉ cache hit, replaying
2435
@@ -28,6 +39,8 @@ vt run: cache hit.
2839

2940
## `vtt print-file dist/out.txt`
3041

42+
output was restored from the archive
43+
3144
```
3245
built
3346
```

crates/vite_task_bin/tests/e2e_snapshots/fixtures/output_cache_test/snapshots/auto_output_with_non_auto_input.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,28 @@
11
# auto_output_with_non_auto_input
22

3+
Auto output works even when input tracking is explicit
4+
(`input: ["src/**"]`). Output auto-detection and input auto-detection
5+
are independent.
6+
37
## `vt run auto-output-no-auto-input`
48

9+
first run: input src/** (no auto), output default (auto)
10+
511
```
612
$ vtt write-file dist/out.txt built
713
```
814

915
## `vtt rm dist/out.txt`
1016

17+
delete the output
18+
1119
```
1220
```
1321

1422
## `vt run auto-output-no-auto-input`
1523

24+
cache hit - output files should still be restored
25+
1626
```
1727
$ vtt write-file dist/out.txt built ◉ cache hit, replaying
1828
@@ -22,6 +32,8 @@ vt run: cache hit.
2232

2333
## `vtt print-file dist/out.txt`
2434

35+
output was restored
36+
2537
```
2638
built
2739
```

crates/vite_task_bin/tests/e2e_snapshots/fixtures/output_cache_test/snapshots/explicit_input_ignores_fspy_reads.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
11
# explicit_input_ignores_fspy_reads
22

3+
When input auto is disabled (explicit globs only), unrelated reads
4+
tracked by fspy must NOT become inferred inputs. Default auto output
5+
still needs fspy for write tracking, but reads outside `input: ["src/**"]`
6+
should be ignored.
7+
38
## `vt run explicit-input-auto-output`
49

10+
first run reads README.md (not in input globs) and captures the output
11+
512
```
613
$ vtt print-file README.md
714
v1
815
```
916

1017
## `vtt replace-file-content README.md v1 v2`
1118

19+
modify README.md — not an input, so it must not invalidate the cache
20+
1221
```
1322
```
1423

crates/vite_task_bin/tests/e2e_snapshots/fixtures/output_cache_test/snapshots/glob_output___only_matched_files_restored.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
# glob_output___only_matched_files_restored
22

3+
Glob output: only files matching the configured output globs are restored
4+
on a cache hit; files produced outside those globs are left alone.
5+
36
## `vt run glob-output`
47

8+
first run writes dist/out.txt and tmp/temp.txt
9+
510
```
611
$ vtt write-file dist/out.txt built
712
@@ -13,16 +18,22 @@ vt run: 0/2 cache hit (0%). (Run `vt run --last-details` for full details)
1318

1419
## `vtt rm dist/out.txt`
1520

21+
delete the glob-matched output
22+
1623
```
1724
```
1825

1926
## `vtt rm tmp/temp.txt`
2027

28+
delete the non-matched output
29+
2130
```
2231
```
2332

2433
## `vt run glob-output`
2534

35+
cache hit: should restore dist/out.txt but not tmp/temp.txt
36+
2637
```
2738
$ vtt write-file dist/out.txt built ◉ cache hit, replaying
2839
@@ -34,6 +45,8 @@ vt run: 2/2 cache hit (100%). (Run `vt run --last-details` for full details)
3445

3546
## `vtt print-file dist/out.txt`
3647

48+
dist/out.txt was restored
49+
3750
```
3851
built
3952
```

0 commit comments

Comments
 (0)