Skip to content

Commit 995f80c

Browse files
authored
feat: add cwd and args info to snapshot headers (#175)
## Why Snapshot files currently only show `source`, `expression`, and `input_file` in the YAML header. To understand what a snapshot is testing, you have to cross-reference `snapshots.toml`. Adding `cwd` and `args` to the header makes each snapshot self-describing, making human review easier. ## Summary - Add `info` field to plan snapshot headers with `args` (array) and optional `cwd` - Add `info` field to E2E snapshot headers with `cwd` when non-default - Makes snapshots self-describing without cross-referencing `snapshots.toml` ## Test plan - [x] `cargo test -p vite_task_plan --test plan_snapshots` passes - [x] `cargo test -p vite_task_bin --test e2e_snapshots` passes - [x] Verified headers in generated `.snap` files contain correct info 🤖 Generated with [Claude Code](https://claude.com/claude-code)
1 parent 2c07f2a commit 995f80c

File tree

54 files changed

+164
-15
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+164
-15
lines changed

crates/vite_task_bin/tests/e2e_snapshots/fixtures/exec-api/snapshots/exec caching.snap

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
---
22
source: crates/vite_task_bin/tests/e2e_snapshots/main.rs
33
expression: e2e_outputs
4-
input_file: crates/vite_task_bin/tests/e2e_snapshots/fixtures/exec-api
54
---
65
> FOO=bar vp lint # cache miss
76
bar

crates/vite_task_bin/tests/e2e_snapshots/fixtures/summary-output/snapshots/last details after run shows saved summary.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
---
22
source: crates/vite_task_bin/tests/e2e_snapshots/main.rs
33
expression: e2e_outputs
4+
info:
5+
cwd: packages/a
46
---
57
> vp run build # populate summary file
68
~/packages/a$ print built-a

crates/vite_task_bin/tests/e2e_snapshots/fixtures/summary-output/snapshots/single task cache hit shows compact summary.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
---
22
source: crates/vite_task_bin/tests/e2e_snapshots/main.rs
33
expression: e2e_outputs
4+
info:
5+
cwd: packages/a
46
---
57
> vp run build # first run, cache miss
68
~/packages/a$ print built-a

crates/vite_task_bin/tests/e2e_snapshots/fixtures/summary-output/snapshots/single task cache miss shows no summary.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
---
22
source: crates/vite_task_bin/tests/e2e_snapshots/main.rs
33
expression: e2e_outputs
4+
info:
5+
cwd: packages/a
46
---
57
> vp run build
68
~/packages/a$ print built-a

crates/vite_task_bin/tests/e2e_snapshots/fixtures/summary-output/snapshots/single task verbose shows full summary.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
---
22
source: crates/vite_task_bin/tests/e2e_snapshots/main.rs
33
expression: e2e_outputs
4+
info:
5+
cwd: packages/a
46
---
57
> vp run -v build
68
~/packages/a$ print built-a

crates/vite_task_bin/tests/e2e_snapshots/fixtures/task-list/snapshots/list tasks from package dir.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
---
22
source: crates/vite_task_bin/tests/e2e_snapshots/main.rs
33
expression: e2e_outputs
4+
info:
5+
cwd: packages/app
46
---
57
> echo '' | vp run
68
build: echo build app

crates/vite_task_bin/tests/e2e_snapshots/fixtures/task-select-truncate/snapshots/interactive long command truncated.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
---
22
source: crates/vite_task_bin/tests/e2e_snapshots/main.rs
33
expression: e2e_outputs
4+
info:
5+
cwd: packages/app
46
---
57
> vp run
68
@ expect-milestone: task-select::0

crates/vite_task_bin/tests/e2e_snapshots/fixtures/task-select/snapshots/interactive enter with no results does nothing.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
---
22
source: crates/vite_task_bin/tests/e2e_snapshots/main.rs
33
expression: e2e_outputs
4+
info:
5+
cwd: packages/app
46
---
57
> vp run
68
@ expect-milestone: task-select::0

crates/vite_task_bin/tests/e2e_snapshots/fixtures/task-select/snapshots/interactive escape clears query.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
---
22
source: crates/vite_task_bin/tests/e2e_snapshots/main.rs
33
expression: e2e_outputs
4+
info:
5+
cwd: packages/app
46
---
57
> vp run
68
@ expect-milestone: task-select::0

crates/vite_task_bin/tests/e2e_snapshots/fixtures/task-select/snapshots/interactive scroll long list.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
---
22
source: crates/vite_task_bin/tests/e2e_snapshots/main.rs
33
expression: e2e_outputs
4+
info:
5+
cwd: packages/app
46
---
57
> vp run
68
@ expect-milestone: task-select::0

0 commit comments

Comments
 (0)