Skip to content

Commit 97b3c8d

Browse files
branchseerclaude
andcommitted
test(inputs): add test for read but unmatched file with inference off
- Update print-file to accept multiple files - Add positive-globs-reads-unmatched task that reads both src/main.ts and src/utils.ts but only has src/main.ts in its inputs glob - Verify that modifying utils.ts (read but not matched) results in cache hit when inference is disabled Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 5c427ab commit 97b3c8d

18 files changed

Lines changed: 99 additions & 30 deletions

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,20 @@ steps = [
3434
"vite run positive-globs-only",
3535
]
3636

37+
# 1b. Positive globs reads unmatched file: inputs: ["src/main.ts"], command reads src/utils.ts too
38+
# - File read by command but NOT matched by glob should NOT be fingerprinted
39+
# - This tests that inference is truly disabled when only explicit globs are used
40+
[[e2e]]
41+
name = "positive globs - hit on read but unmatched file"
42+
steps = [
43+
# Initial run - reads both src/main.ts and src/utils.ts
44+
"vite run positive-globs-reads-unmatched",
45+
# Modify utils.ts - read by command but NOT in glob
46+
"replace-file-content src/utils.ts initial modified",
47+
# Cache hit: file was read but not matched by glob, inference is off
48+
"vite run positive-globs-reads-unmatched",
49+
]
50+
3751
# 2. Positive + negative globs: inputs: ["src/**", "!src/**/*.test.ts"]
3852
# - Files matching positive but NOT negative trigger invalidation
3953
# - Files matching negative glob are excluded

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ input_file: crates/vite_task_bin/tests/e2e_snapshots/fixtures/inputs-cache-test
55
---
66
> vite run auto-only
77
$ print-file src/main.ts
8-
export const main = "initial";
8+
export const main = 'initial';
99

1010

1111
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -25,7 +25,7 @@ Task Details:
2525

2626
> vite run auto-only
2727
$ print-file src/main.tscache hit, replaying
28-
export const main = "initial";
28+
export const main = 'initial';
2929

3030

3131
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ input_file: crates/vite_task_bin/tests/e2e_snapshots/fixtures/inputs-cache-test
55
---
66
> vite run auto-only
77
$ print-file src/main.ts
8-
export const main = "initial";
8+
export const main = 'initial';
99

1010

1111
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -25,7 +25,7 @@ Task Details:
2525

2626
> vite run auto-only
2727
$ print-file src/main.tscache miss: content of input 'src/main.ts' changed, executing
28-
export const main = "modified";
28+
export const main = 'modified';
2929

3030

3131
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ input_file: crates/vite_task_bin/tests/e2e_snapshots/fixtures/inputs-cache-test
55
---
66
> vite run auto-with-negative
77
$ print-file src/main.ts dist/output.js
8-
export const main = "initial";
8+
export const main = 'initial';
9+
// initial output
910

1011

1112
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -25,7 +26,8 @@ Task Details:
2526

2627
> vite run auto-with-negative
2728
$ print-file src/main.ts dist/output.jscache hit, replaying
28-
export const main = "initial";
29+
export const main = 'initial';
30+
// initial output
2931

3032

3133
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ input_file: crates/vite_task_bin/tests/e2e_snapshots/fixtures/inputs-cache-test
55
---
66
> vite run auto-with-negative
77
$ print-file src/main.ts dist/output.js
8-
export const main = "initial";
8+
export const main = 'initial';
9+
// initial output
910

1011

1112
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -25,7 +26,8 @@ Task Details:
2526

2627
> vite run auto-with-negative
2728
$ print-file src/main.ts dist/output.jscache miss: content of input 'src/main.ts' changed, executing
28-
export const main = "modified";
29+
export const main = 'modified';
30+
// initial output
2931

3032

3133
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ input_file: crates/vite_task_bin/tests/e2e_snapshots/fixtures/inputs-cache-test
55
---
66
> vite run empty-inputs
77
$ print-file src/main.ts
8-
export const main = "initial";
8+
export const main = 'initial';
99

1010

1111
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -25,7 +25,7 @@ Task Details:
2525

2626
> vite run empty-inputs
2727
$ print-file src/main.tscache hit, replaying
28-
export const main = "initial";
28+
export const main = 'initial';
2929

3030

3131
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ input_file: crates/vite_task_bin/tests/e2e_snapshots/fixtures/inputs-cache-test
55
---
66
> vite run empty-inputs
77
$ print-file src/main.ts
8-
export const main = "initial";
8+
export const main = 'initial';
99

1010

1111
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -25,7 +25,7 @@ Task Details:
2525

2626
> vite run empty-inputs
2727
$ print-file src/utils.tscache miss: args changed, executing
28-
export const utils = "initial";
28+
export const utils = 'initial';
2929

3030

3131
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ input_file: crates/vite_task_bin/tests/e2e_snapshots/fixtures/inputs-cache-test
55
---
66
> vite run positive-auto-negative
77
$ print-file src/main.ts
8-
export const main = "initial";
8+
export const main = 'initial';
99

1010

1111
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -25,7 +25,7 @@ Task Details:
2525

2626
> vite run positive-auto-negative
2727
$ print-file src/main.tscache hit, replaying
28-
export const main = "initial";
28+
export const main = 'initial';
2929

3030

3131
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

crates/vite_task_bin/tests/e2e_snapshots/fixtures/inputs-cache-test/snapshots/positive auto negative - miss on explicit glob file.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ input_file: crates/vite_task_bin/tests/e2e_snapshots/fixtures/inputs-cache-test
55
---
66
> vite run positive-auto-negative
77
$ print-file src/main.ts
8-
export const main = "initial";
8+
export const main = 'initial';
99

1010

1111
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -25,7 +25,7 @@ Task Details:
2525

2626
> vite run positive-auto-negative
2727
$ print-file src/main.tscache miss: configuration changed, executing
28-
export const main = "initial";
28+
export const main = 'initial';
2929

3030

3131
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ input_file: crates/vite_task_bin/tests/e2e_snapshots/fixtures/inputs-cache-test
55
---
66
> vite run positive-auto-negative
77
$ print-file src/main.ts
8-
export const main = "initial";
8+
export const main = 'initial';
99

1010

1111
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -25,7 +25,7 @@ Task Details:
2525

2626
> vite run positive-auto-negative
2727
$ print-file src/main.tscache miss: content of input 'src/main.ts' changed, executing
28-
export const main = "modified";
28+
export const main = 'modified';
2929

3030

3131
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

0 commit comments

Comments
 (0)