Skip to content

Commit eb5e267

Browse files
branchseerclaude
andcommitted
docs(e2e): move ipc_client_test + vite_build_cache 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 8429188 commit eb5e267

8 files changed

Lines changed: 110 additions & 57 deletions

File tree

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,54 @@
1-
# E2E tests for @voidzero-dev/vite-task-client. Each case exercises one IPC
2-
# method by running a Node script inside a real cached task and observing the
3-
# runner's cache behaviour.
4-
5-
# ignoreInput: the runner treats cache_like/ as non-input, so mutations to it
6-
# between runs do not invalidate the cache.
71
[[e2e]]
82
name = "ignore_input_keeps_cache_valid"
3+
comment = """
4+
Exercises `ignoreInput` through `@voidzero-dev/vite-task-client`.
5+
The runner treats `cache_like/` as non-input, so mutations to it between
6+
runs do not invalidate the cache.
7+
"""
98
ignore = true
109
steps = [
11-
# First run populates the cache.
12-
["vt", "run", "ignore-input"],
13-
# Mutate the ignored directory between runs; this would invalidate the cache
14-
# if the runner had tracked it as an input.
15-
["vtt", "write-file", "cache_like/other.txt", "after"],
16-
# Second run must still be a cache hit.
10+
{ argv = ["vt", "run", "ignore-input"], comment = "populate the cache" },
11+
{ argv = ["vtt", "write-file", "cache_like/other.txt", "after"], comment = "mutate the ignored directory — would invalidate if tracked" },
1712
{ argv = ["vt", "run", "ignore-input"], comment = "cache hit: cache_like/ was ignored via ignoreInput" },
1813
]
1914

20-
# ignoreOutput: the task reads and writes sidecar/tmp.txt. If the runner
21-
# didn't honour ignoreOutput, the read-write overlap check would refuse to
22-
# cache the run ("read and wrote 'sidecar/tmp.txt'").
2315
[[e2e]]
2416
name = "ignore_output_allows_read_write_overlap"
17+
comment = """
18+
Exercises `ignoreOutput`. The task reads and writes `sidecar/tmp.txt`;
19+
without the ignore the runner's read-write overlap check would refuse to
20+
cache the run ("read and wrote 'sidecar/tmp.txt'").
21+
"""
2522
ignore = true
2623
steps = [
27-
["vt", "run", "ignore-output"],
28-
["vtt", "rm", "dist/out.txt"],
29-
# Cache hit proves ignoreOutput suppressed the overlap error.
24+
{ argv = ["vt", "run", "ignore-output"], comment = "first run populates the cache" },
25+
{ argv = ["vtt", "rm", "dist/out.txt"], comment = "remove the real output so the cache-hit restore is observable" },
3026
{ argv = ["vt", "run", "ignore-output"], comment = "cache hit: sidecar/ writes were ignored" },
31-
["vtt", "print-file", "dist/out.txt"],
27+
{ argv = ["vtt", "print-file", "dist/out.txt"], comment = "restored from the cache archive" },
3228
]
3329

34-
# disableCache: the tool asks the runner not to cache this run, so the next
35-
# invocation re-executes.
3630
[[e2e]]
3731
name = "disable_cache_forces_reexecution"
32+
comment = """
33+
Exercises `disableCache`. The tool asks the runner not to cache this run,
34+
so the next invocation re-executes instead of hitting a prior entry.
35+
"""
3836
ignore = true
3937
steps = [
40-
["vt", "run", "disable-cache"],
41-
# Second run is a cache miss (NotFound) because nothing was cached.
42-
{ argv = ["vt", "run", "disable-cache"], comment = "cache miss: tool called disableCache" },
38+
{ argv = ["vt", "run", "disable-cache"], comment = "first run — tool calls disableCache" },
39+
{ argv = ["vt", "run", "disable-cache"], comment = "cache miss (NotFound) because nothing was cached" },
4340
]
4441

45-
# fetchEnv (tracked: true) — the env value becomes part of the post-run
46-
# fingerprint. Same value → cache hit; different value → cache miss.
4742
[[e2e]]
4843
name = "fetch_env_tracked_invalidates_on_change"
44+
comment = """
45+
Exercises `fetchEnv(name, { tracked: true })`. The env value becomes part
46+
of the post-run fingerprint: the same value still hits, a different value
47+
misses with `tracked env 'PROBE_ENV' changed`.
48+
"""
4949
ignore = true
5050
steps = [
51-
{ argv = ["vt", "run", "fetch-env"], envs = [["PROBE_ENV", "first"]] },
52-
# Same value → cache hit.
51+
{ argv = ["vt", "run", "fetch-env"], envs = [["PROBE_ENV", "first"]], comment = "first run captures PROBE_ENV=first in the fingerprint" },
5352
{ argv = ["vt", "run", "fetch-env"], envs = [["PROBE_ENV", "first"]], comment = "cache hit: PROBE_ENV unchanged" },
54-
# Different value → cache miss (tracked env changed).
5553
{ argv = ["vt", "run", "fetch-env"], envs = [["PROBE_ENV", "second"]], comment = "cache miss: tracked env changed" },
5654
]

crates/vite_task_bin/tests/e2e_snapshots/fixtures/ipc_client_test/snapshots/disable_cache_forces_reexecution.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
# disable_cache_forces_reexecution
22

3+
Exercises `disableCache`. The tool asks the runner not to cache this run,
4+
so the next invocation re-executes instead of hitting a prior entry.
5+
36
## `vt run disable-cache`
47

8+
first run — tool calls disableCache
9+
510
```
611
$ node scripts/disable_cache.mjs
712
```
813

914
## `vt run disable-cache`
1015

11-
cache miss: tool called disableCache
16+
cache miss (NotFound) because nothing was cached
1217

1318
```
1419
$ node scripts/disable_cache.mjs

crates/vite_task_bin/tests/e2e_snapshots/fixtures/ipc_client_test/snapshots/fetch_env_tracked_invalidates_on_change.md

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

3+
Exercises `fetchEnv(name, { tracked: true })`. The env value becomes part
4+
of the post-run fingerprint: the same value still hits, a different value
5+
misses with `tracked env 'PROBE_ENV' changed`.
6+
37
## `PROBE_ENV=first vt run fetch-env`
48

9+
first run captures PROBE_ENV=first in the fingerprint
10+
511
```
612
$ node scripts/fetch_env.mjs
713
```

crates/vite_task_bin/tests/e2e_snapshots/fixtures/ipc_client_test/snapshots/ignore_input_keeps_cache_valid.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
# ignore_input_keeps_cache_valid
22

3+
Exercises `ignoreInput` through `@voidzero-dev/vite-task-client`.
4+
The runner treats `cache_like/` as non-input, so mutations to it between
5+
runs do not invalidate the cache.
6+
37
## `vt run ignore-input`
48

9+
populate the cache
10+
511
```
612
$ node scripts/ignore_input.mjs
713
```
814

915
## `vtt write-file cache_like/other.txt after`
1016

17+
mutate the ignored directory — would invalidate if tracked
18+
1119
```
1220
```
1321

crates/vite_task_bin/tests/e2e_snapshots/fixtures/ipc_client_test/snapshots/ignore_output_allows_read_write_overlap.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
# ignore_output_allows_read_write_overlap
22

3+
Exercises `ignoreOutput`. The task reads and writes `sidecar/tmp.txt`;
4+
without the ignore the runner's read-write overlap check would refuse to
5+
cache the run ("read and wrote 'sidecar/tmp.txt'").
6+
37
## `vt run ignore-output`
48

9+
first run populates the cache
10+
511
```
612
$ node scripts/ignore_output.mjs
713
```
814

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

17+
remove the real output so the cache-hit restore is observable
18+
1119
```
1220
```
1321

@@ -24,6 +32,8 @@ vt run: cache hit.
2432

2533
## `vtt print-file dist/out.txt`
2634

35+
restored from the cache archive
36+
2737
```
2838
ok
2939
```
Lines changed: 23 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,37 @@
1-
# Vite build end-to-end: `vt run --cache build` must produce a cache hit on
2-
# the second run without any manual input/output configuration. The patched
3-
# vite (see patches/vite.patch) reports ignoreInputs/ignoreOutputs on its
4-
# cacheDir/outDir so fspy-detected reads of `dist/` and writes to
5-
# `node_modules/.vite/` don't poison the cache.
6-
71
[[e2e]]
82
name = "vite_build_caches_and_restores_outputs"
3+
comment = """
4+
`vt run --cache build` must produce a cache hit on the second run without
5+
any manual input/output configuration. Vite reports
6+
`ignoreInput(outDir)` + `ignoreInput/Output(cacheDir)` via
7+
`@voidzero-dev/vite-task-client`, so fspy-detected reads of `dist/` and
8+
writes to `node_modules/.vite/` don't poison the cache.
9+
"""
910
ignore = true
1011
steps = [
11-
["vt", "run", "--cache", "build"],
12-
# Verify the build emitted output (existence check; content is Vite's
13-
# minified JS and would make the snapshot brittle across Vite versions).
14-
["vtt", "stat-file", "dist/assets/main.js"],
15-
# Delete the output artefact and re-run — the cache hit should restore it.
16-
["vtt", "rm", "dist/assets/main.js"],
12+
{ argv = ["vt", "run", "--cache", "build"], comment = "first run: cache miss, emits dist/" },
13+
{ argv = ["vtt", "stat-file", "dist/assets/main.js"], comment = "existence check — content would drift across Vite versions" },
14+
{ argv = ["vtt", "rm", "dist/assets/main.js"], comment = "remove the artefact so the cache-hit restore is observable" },
1715
{ argv = ["vt", "run", "--cache", "build"], comment = "cache hit: outputs restored without manual config" },
18-
["vtt", "stat-file", "dist/assets/main.js"],
16+
{ argv = ["vtt", "stat-file", "dist/assets/main.js"], comment = "restored from the cache archive" },
1917
]
2018

21-
# NODE_ENV is picked up by Vite via `fetchEnv("NODE_ENV", { tracked: true })`
22-
# in the patched `resolveConfig`. Flipping its value between runs must both
23-
# invalidate the cache AND change the build output — Vite's `define` plugin
24-
# substitutes `process.env.NODE_ENV` at build time, so dead-code elimination
25-
# leaves only the branch matching the current mode.
2619
[[e2e]]
2720
name = "node_env_change_invalidates_cache"
21+
comment = """
22+
NODE_ENV is picked up by Vite via `fetchEnv("NODE_ENV", { tracked: true })`
23+
in `resolveConfig`. Flipping its value between runs must both invalidate
24+
the cache AND change the build output — Vite's `define` plugin substitutes
25+
`process.env.NODE_ENV` at build time, so dead-code elimination leaves only
26+
the branch matching the current mode.
27+
"""
2828
ignore = true
2929
steps = [
30-
{ argv = ["vt", "run", "--cache", "build"], envs = [["NODE_ENV", "production"]] },
31-
# Production build: only the PROD marker survives DCE.
32-
["vtt", "grep-file", "dist/assets/main.js", "BUILD_MODE_PROD"],
33-
["vtt", "grep-file", "dist/assets/main.js", "BUILD_MODE_DEV"],
34-
# Same NODE_ENV — cache hit, output unchanged.
30+
{ argv = ["vt", "run", "--cache", "build"], envs = [["NODE_ENV", "production"]], comment = "first run: production build" },
31+
{ argv = ["vtt", "grep-file", "dist/assets/main.js", "BUILD_MODE_PROD"], comment = "production build: PROD marker survived DCE" },
32+
{ argv = ["vtt", "grep-file", "dist/assets/main.js", "BUILD_MODE_DEV"], comment = "dev branch is gone" },
3533
{ argv = ["vt", "run", "--cache", "build"], envs = [["NODE_ENV", "production"]], comment = "cache hit: NODE_ENV unchanged" },
36-
# Different NODE_ENV — cache miss via tracked env reported by Vite.
3734
{ argv = ["vt", "run", "--cache", "build"], envs = [["NODE_ENV", "development"]], comment = "cache miss: Vite's fetchEnv marked NODE_ENV as tracked" },
38-
# Development build: PROD marker gone, DEV marker in.
39-
["vtt", "grep-file", "dist/assets/main.js", "BUILD_MODE_PROD"],
40-
["vtt", "grep-file", "dist/assets/main.js", "BUILD_MODE_DEV"],
35+
{ argv = ["vtt", "grep-file", "dist/assets/main.js", "BUILD_MODE_PROD"], comment = "PROD marker gone after the dev rebuild" },
36+
{ argv = ["vtt", "grep-file", "dist/assets/main.js", "BUILD_MODE_DEV"], comment = "DEV marker now in the bundle" },
4137
]

crates/vite_task_bin/tests/e2e_snapshots/fixtures/vite_build_cache/snapshots/node_env_change_invalidates_cache.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,31 @@
11
# node_env_change_invalidates_cache
22

3+
NODE_ENV is picked up by Vite via `fetchEnv("NODE_ENV", { tracked: true })`
4+
in `resolveConfig`. Flipping its value between runs must both invalidate
5+
the cache AND change the build output — Vite's `define` plugin substitutes
6+
`process.env.NODE_ENV` at build time, so dead-code elimination leaves only
7+
the branch matching the current mode.
8+
39
## `NODE_ENV=production vt run --cache build`
410

11+
first run: production build
12+
513
```
614
$ vite build
715
```
816

917
## `vtt grep-file dist/assets/main.js BUILD_MODE_PROD`
1018

19+
production build: PROD marker survived DCE
20+
1121
```
1222
dist/assets/main.js: found "BUILD_MODE_PROD"
1323
```
1424

1525
## `vtt grep-file dist/assets/main.js BUILD_MODE_DEV`
1626

27+
dev branch is gone
28+
1729
```
1830
dist/assets/main.js: missing "BUILD_MODE_DEV"
1931
```
@@ -39,12 +51,16 @@ $ vite build ○ cache miss: tracked env 'NODE_ENV' changed, executing
3951

4052
## `vtt grep-file dist/assets/main.js BUILD_MODE_PROD`
4153

54+
PROD marker gone after the dev rebuild
55+
4256
```
4357
dist/assets/main.js: missing "BUILD_MODE_PROD"
4458
```
4559

4660
## `vtt grep-file dist/assets/main.js BUILD_MODE_DEV`
4761

62+
DEV marker now in the bundle
63+
4864
```
4965
dist/assets/main.js: found "BUILD_MODE_DEV"
5066
```

crates/vite_task_bin/tests/e2e_snapshots/fixtures/vite_build_cache/snapshots/vite_build_caches_and_restores_outputs.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,31 @@
11
# vite_build_caches_and_restores_outputs
22

3+
`vt run --cache build` must produce a cache hit on the second run without
4+
any manual input/output configuration. Vite reports
5+
`ignoreInput(outDir)` + `ignoreInput/Output(cacheDir)` via
6+
`@voidzero-dev/vite-task-client`, so fspy-detected reads of `dist/` and
7+
writes to `node_modules/.vite/` don't poison the cache.
8+
39
## `vt run --cache build`
410

11+
first run: cache miss, emits dist/
12+
513
```
614
$ vite build
715
```
816

917
## `vtt stat-file dist/assets/main.js`
1018

19+
existence check — content would drift across Vite versions
20+
1121
```
1222
dist/assets/main.js: exists
1323
```
1424

1525
## `vtt rm dist/assets/main.js`
1626

27+
remove the artefact so the cache-hit restore is observable
28+
1729
```
1830
```
1931

@@ -30,6 +42,8 @@ vt run: cache hit.
3042

3143
## `vtt stat-file dist/assets/main.js`
3244

45+
restored from the cache archive
46+
3347
```
3448
dist/assets/main.js: exists
3549
```

0 commit comments

Comments
 (0)