You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: rfcs/interactive-snapshot-tests.md
+31-31Lines changed: 31 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,12 +40,12 @@ Adding a PTY mode to `snap-test.ts` would keep the no-assertion model, the shell
40
40
41
41
The vite-task repository has a working implementation of exactly this design, used by ~190 snapshot files today, including interactive selector navigation and ctrl-c cancellation cases. Its pieces:
42
42
43
-
| Crate | Role |
44
-
| ----- | ---- |
45
-
|`pty_terminal`| Spawns a child in a PTY (`portable-pty`), feeds output through a `vt100` emulator, answers cursor-position queries, handles resize and ctrl-c. Encodes platform workarounds: ConPTY on Windows, a global lock for musl PTY crashes, macOS slave-fd lifetime for EIO truncation. |
46
-
|`pty_terminal_test`|`TestTerminal` wrapper plus `Reader::expect_milestone(name)`: block until the child emits a named milestone, then return the rendered screen. |
47
-
|`pty_terminal_test_client`| Child-side helper that encodes milestones as OSC 8 hyperlinks (`https://milestone.invalid/<hex(name)>` with a zero-width-space anchor), which survive both Unix PTYs and Windows ConPTY and arrive inline with the output they mark. |
48
-
|`snapshot_test`| Minimal snapshot store: compare or update via `UPDATE_SNAPSHOTS=1`, write `<name>.new` on mismatch, return a unified diff as the failure message. |
|`pty_terminal`| Spawns a child in a PTY (`portable-pty`), feeds output through a `vt100` emulator, answers cursor-position queries, handles resize and ctrl-c. Encodes platform workarounds: ConPTY on Windows, a global lock for musl PTY crashes, macOS slave-fd lifetime for EIO truncation. |
46
+
|`pty_terminal_test`|`TestTerminal` wrapper plus `Reader::expect_milestone(name)`: block until the child emits a named milestone, then return the rendered screen.|
47
+
|`pty_terminal_test_client`| Child-side helper that encodes milestones as OSC 8 hyperlinks (`https://milestone.invalid/<hex(name)>` with a zero-width-space anchor), which survive both Unix PTYs and Windows ConPTY and arrive inline with the output they mark. |
48
+
|`snapshot_test`| Minimal snapshot store: compare or update via `UPDATE_SNAPSHOTS=1`, write `<name>.new` on mismatch, return a unified diff as the failure message.|
49
49
50
50
On top of these, `vite_task_bin/tests/e2e_snapshots` implements a `libtest-mimic` custom test target: fixtures declare cases in `snapshots.toml`, steps are argv arrays (no shell), interactive steps carry an ordered `interactions` list, and each case produces one Markdown snapshot containing the command lines, the interaction log, and fenced terminal screenshots captured at each milestone and at exit.
51
51
@@ -319,22 +319,22 @@ It is deliberately not a new design. vite-task's `vtt` multitool already covers
319
319
320
320
Setup and assertion subcommands (replacing shell built-ins in old cases), all `vtt`-aligned:
|`vpt pipe-stdin <data> -- <argv>...`| piped-stdin scenarios without a shell|
330
330
331
331
Payload subcommands, for cases where the command under test spawns other commands (`vp run` task execution, caching, cancellation, stdio passthrough), same as their `vtt` counterparts:
vp-specific additions with no `vtt` counterpart: `vpt json-edit <file> <dot-path> <value>` (the existing snap-tests `json-edit` helper for fixture manifest edits) and `vpt chmod`.
340
340
@@ -384,20 +384,20 @@ For each old case directory it emits a new fixture under `crates/vite_cli_snapsh
0 commit comments