Skip to content

Commit 9028001

Browse files
branchseerclaude
andcommitted
test: consolidate e2e input cache tests into sequential flows
Combine hit/miss test pairs that share the same task into single sequential tests (hit first, then modify, then miss). Reduces 22 separate e2e cases to 13 across both fixtures. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 4311180 commit 9028001

25 files changed

+116
-285
lines changed

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

Lines changed: 23 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,21 @@
44
# - Files matching the glob trigger cache invalidation
55
# - Files outside the glob do NOT trigger cache invalidation
66
[[e2e]]
7-
name = "positive globs only - cache hit on second run"
7+
name = "positive globs only"
88
steps = [
9-
# First run - cache miss
109
"vp run positive-globs-only",
11-
# Second run - cache hit
10+
# Cache hit on second run
1211
"vp run positive-globs-only",
13-
]
14-
15-
[[e2e]]
16-
name = "positive globs only - miss on matched file change"
17-
steps = [
18-
# Initial run
12+
# Modify a file that does NOT match the glob (test/ is outside src/)
13+
"replace-file-content test/main.test.ts outside modified",
14+
# Cache hit: file not in inputs
1915
"vp run positive-globs-only",
2016
# Modify a file that matches the glob
2117
"replace-file-content src/main.ts initial modified",
2218
# Cache miss: matched file changed
2319
"vp run positive-globs-only",
2420
]
2521

26-
[[e2e]]
27-
name = "positive globs only - hit on unmatched file change"
28-
steps = [
29-
# Initial run
30-
"vp run positive-globs-only",
31-
# Modify a file that does NOT match the glob (test/ is outside src/)
32-
"replace-file-content test/main.test.ts outside modified",
33-
# Cache hit: file not in inputs
34-
"vp run positive-globs-only",
35-
]
36-
3722
# 1b. Positive globs reads unmatched file: inputs: ["src/main.ts"], command reads src/utils.ts too
3823
# - File read by command but NOT matched by glob should NOT be fingerprinted
3924
# - This tests that inference is truly disabled when only explicit globs are used
@@ -52,71 +37,49 @@ steps = [
5237
# - Files matching positive but NOT negative trigger invalidation
5338
# - Files matching negative glob are excluded
5439
[[e2e]]
55-
name = "positive negative globs - miss on non-excluded file"
40+
name = "positive negative globs"
5641
steps = [
57-
# Initial run
58-
"vp run positive-negative-globs",
59-
# Modify a file that matches positive but NOT negative
60-
"replace-file-content src/main.ts initial modified",
61-
# Cache miss: file changed
62-
"vp run positive-negative-globs",
63-
]
64-
65-
[[e2e]]
66-
name = "positive negative globs - hit on excluded file"
67-
steps = [
68-
# Initial run
6942
"vp run positive-negative-globs",
7043
# Modify a file that matches the negative glob (excluded)
7144
"replace-file-content src/main.test.ts main modified",
7245
# Cache hit: file excluded by negative glob
7346
"vp run positive-negative-globs",
47+
# Modify a file that matches positive but NOT negative
48+
"replace-file-content src/main.ts initial modified",
49+
# Cache miss: file changed
50+
"vp run positive-negative-globs",
7451
]
7552

7653
# 3. Auto only: inputs: [{ "auto": true }]
7754
# - Files read by the command trigger invalidation (fspy inference)
7855
# - Files NOT read by the command do NOT trigger invalidation
7956
[[e2e]]
80-
name = "auto only - miss on inferred file change"
81-
steps = [
82-
# Initial run - reads src/main.ts
83-
"vp run auto-only",
84-
# Modify the file that was read
85-
"replace-file-content src/main.ts initial modified",
86-
# Cache miss: inferred input changed
87-
"vp run auto-only",
88-
]
89-
90-
[[e2e]]
91-
name = "auto only - hit on non-inferred file change"
57+
name = "auto only"
9258
steps = [
9359
# Initial run - reads src/main.ts (NOT utils.ts)
9460
"vp run auto-only",
9561
# Modify a file that was NOT read by the command
9662
"replace-file-content src/utils.ts initial modified",
9763
# Cache hit: file not in inferred inputs
9864
"vp run auto-only",
65+
# Modify the file that was read
66+
"replace-file-content src/main.ts initial modified",
67+
# Cache miss: inferred input changed
68+
"vp run auto-only",
9969
]
10070

10171
# 4. Auto + negative: inputs: [{ "auto": true }, "!dist/**"]
10272
# - Inferred files are tracked, but negative globs filter them out
10373
# - Files in excluded directories don't trigger invalidation even if read
10474
[[e2e]]
105-
name = "auto with negative - hit on excluded inferred file"
75+
name = "auto with negative"
10676
steps = [
10777
# Initial run - reads both src/main.ts and dist/output.js
10878
"vp run auto-with-negative",
10979
# Modify file in excluded directory (dist/)
11080
"replace-file-content dist/output.js initial modified",
11181
# Cache hit: dist/ is excluded by negative glob
11282
"vp run auto-with-negative",
113-
]
114-
115-
[[e2e]]
116-
name = "auto with negative - miss on non-excluded inferred file"
117-
steps = [
118-
# Initial run
119-
"vp run auto-with-negative",
12083
# Modify file NOT in excluded directory
12184
"replace-file-content src/main.ts initial modified",
12285
# Cache miss: inferred input changed
@@ -129,7 +92,6 @@ steps = [
12992
[[e2e]]
13093
name = "positive auto negative - miss on explicit glob file"
13194
steps = [
132-
# Initial run
13395
"vp run positive-auto-negative",
13496
# Modify explicit input file
13597
"replace-file-content package.json inputs-cache-test modified-pkg",
@@ -138,46 +100,30 @@ steps = [
138100
]
139101

140102
[[e2e]]
141-
name = "positive auto negative - miss on inferred file"
142-
steps = [
143-
# Initial run
144-
"vp run positive-auto-negative",
145-
# Modify inferred input file (read by command)
146-
"replace-file-content src/main.ts initial modified",
147-
# Cache miss: inferred input changed
148-
"vp run positive-auto-negative",
149-
]
150-
151-
[[e2e]]
152-
name = "positive auto negative - hit on excluded file"
103+
name = "positive auto negative - hit on excluded then miss on inferred"
153104
steps = [
154-
# Initial run
155105
"vp run positive-auto-negative",
156106
# Modify file excluded by negative glob
157107
"replace-file-content src/main.test.ts main modified",
158108
# Cache hit: file excluded by negative glob
159109
"vp run positive-auto-negative",
110+
# Modify inferred input file (read by command)
111+
"replace-file-content src/main.ts initial modified",
112+
# Cache miss: inferred input changed
113+
"vp run positive-auto-negative",
160114
]
161115

162116
# 6. Empty inputs: inputs: []
163117
# - No file changes affect the cache
164118
# - Only command/env changes trigger cache invalidation
165119
[[e2e]]
166-
name = "empty inputs - hit despite file changes"
120+
name = "empty inputs"
167121
steps = [
168-
# Initial run
169122
"vp run empty-inputs",
170123
# Modify any file - should NOT affect cache
171124
"replace-file-content src/main.ts initial modified",
172125
# Cache hit: no inputs configured
173126
"vp run empty-inputs",
174-
]
175-
176-
[[e2e]]
177-
name = "empty inputs - miss on command change"
178-
steps = [
179-
# Initial run
180-
"vp run empty-inputs",
181127
# Change the command
182128
"json-edit vite-task.json \"_.tasks['empty-inputs'].command = 'print-file src/utils.ts'\"",
183129
# Cache miss: command changed
@@ -188,15 +134,10 @@ steps = [
188134
# - FSPY=1 is set when fspy is enabled (includes_auto is true)
189135
# - FSPY is NOT set when fspy is disabled (explicit globs only)
190136
[[e2e]]
191-
name = "fspy env - set when auto inference enabled"
137+
name = "fspy env"
192138
steps = [
193139
# Run task with auto inference - should see FSPY=1
194140
"vp run check-fspy-env-with-auto",
195-
]
196-
197-
[[e2e]]
198-
name = "fspy env - not set when auto inference disabled"
199-
steps = [
200141
# Run task without auto inference - should see (undefined)
201142
"vp run check-fspy-env-without-auto",
202143
]

crates/vite_task_bin/tests/e2e_snapshots/fixtures/inputs-cache-test/snapshots/auto only - miss on inferred file change.snap

Lines changed: 0 additions & 12 deletions
This file was deleted.

crates/vite_task_bin/tests/e2e_snapshots/fixtures/inputs-cache-test/snapshots/auto only - hit on non-inferred file change.snap renamed to crates/vite_task_bin/tests/e2e_snapshots/fixtures/inputs-cache-test/snapshots/auto only.snap

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,8 @@ export const main = 'initial';
1313

1414
---
1515
[vp run] cache hit, <duration> saved.
16+
> replace-file-content src/main.ts initial modified
17+
18+
> vp run auto-only
19+
$ print-file src/main.ts ✗ cache miss: content of input 'src/main.ts' changed, executing
20+
export const main = 'modified';

crates/vite_task_bin/tests/e2e_snapshots/fixtures/inputs-cache-test/snapshots/auto with negative - miss on non-excluded inferred file.snap

Lines changed: 0 additions & 14 deletions
This file was deleted.

crates/vite_task_bin/tests/e2e_snapshots/fixtures/inputs-cache-test/snapshots/auto with negative - hit on excluded inferred file.snap renamed to crates/vite_task_bin/tests/e2e_snapshots/fixtures/inputs-cache-test/snapshots/auto with negative.snap

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,9 @@ export const main = 'initial';
1515

1616
---
1717
[vp run] cache hit, <duration> saved.
18+
> replace-file-content src/main.ts initial modified
19+
20+
> vp run auto-with-negative
21+
$ print-file src/main.ts dist/output.js ✗ cache miss: content of input 'src/main.ts' changed, executing
22+
export const main = 'modified';
23+
// modified output

crates/vite_task_bin/tests/e2e_snapshots/fixtures/inputs-cache-test/snapshots/empty inputs - hit despite file changes.snap

Lines changed: 0 additions & 15 deletions
This file was deleted.

crates/vite_task_bin/tests/e2e_snapshots/fixtures/inputs-cache-test/snapshots/empty inputs - miss on command change.snap renamed to crates/vite_task_bin/tests/e2e_snapshots/fixtures/inputs-cache-test/snapshots/empty inputs.snap

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ expression: e2e_outputs
55
> vp run empty-inputs
66
$ print-file src/main.ts
77
export const main = 'initial';
8+
> replace-file-content src/main.ts initial modified
9+
10+
> vp run empty-inputs
11+
$ print-file src/main.tscache hit, replaying
12+
export const main = 'initial';
13+
14+
---
15+
[vp run] cache hit, <duration> saved.
816
> json-edit vite-task.json "_.tasks['empty-inputs'].command = 'print-file src/utils.ts'"
917

1018
> vp run empty-inputs

crates/vite_task_bin/tests/e2e_snapshots/fixtures/inputs-cache-test/snapshots/fspy env - set when auto inference enabled.snap

Lines changed: 0 additions & 7 deletions
This file was deleted.

crates/vite_task_bin/tests/e2e_snapshots/fixtures/inputs-cache-test/snapshots/fspy env - not set when auto inference disabled.snap renamed to crates/vite_task_bin/tests/e2e_snapshots/fixtures/inputs-cache-test/snapshots/fspy env.snap

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
source: crates/vite_task_bin/tests/e2e_snapshots/main.rs
33
expression: e2e_outputs
44
---
5+
> vp run check-fspy-env-with-auto
6+
$ print-env FSPY
7+
1
58
> vp run check-fspy-env-without-auto
69
$ print-env FSPY
710
(undefined)

crates/vite_task_bin/tests/e2e_snapshots/fixtures/inputs-cache-test/snapshots/positive auto negative - hit on excluded file.snap renamed to crates/vite_task_bin/tests/e2e_snapshots/fixtures/inputs-cache-test/snapshots/positive auto negative - hit on excluded then miss on inferred.snap

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,8 @@ export const main = 'initial';
1313

1414
---
1515
[vp run] cache hit, <duration> saved.
16+
> replace-file-content src/main.ts initial modified
17+
18+
> vp run positive-auto-negative
19+
$ print-file src/main.ts ✗ cache miss: content of input 'src/main.ts' changed, executing
20+
export const main = 'modified';

0 commit comments

Comments
 (0)