Skip to content

Commit e8c36d4

Browse files
committed
style(rfcs): format interactive-snapshot-tests.md with vp fmt
The e2e job's repo-wide vp check flagged the markdown table alignment. Claude-Session: https://claude.ai/code/session_01NRgjMi2Vus3iJctudGEWPT
1 parent e2cd155 commit e8c36d4

1 file changed

Lines changed: 31 additions & 31 deletions

File tree

rfcs/interactive-snapshot-tests.md

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ Adding a PTY mode to `snap-test.ts` would keep the no-assertion model, the shell
4040

4141
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:
4242

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. |
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. |
4949

5050
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.
5151

@@ -319,22 +319,22 @@ It is deliberately not a new design. vite-task's `vtt` multitool already covers
319319

320320
Setup and assertion subcommands (replacing shell built-ins in old cases), all `vtt`-aligned:
321321

322-
| Subcommand | Replaces |
323-
| ---------- | -------- |
324-
| `vpt print-file <file>` | `cat` (snapshot file contents) |
325-
| `vpt stat-file <path>` | `test -f x && echo ...` existence checks |
322+
| Subcommand | Replaces |
323+
| ---------------------------------------------------------------- | ------------------------------------------------- |
324+
| `vpt print-file <file>` | `cat` (snapshot file contents) |
325+
| `vpt stat-file <path>` | `test -f x && echo ...` existence checks |
326326
| `vpt write-file` / `vpt touch-file` / `vpt replace-file-content` | `echo`/`printf` redirects, in-place fixture edits |
327-
| `vpt list-dir` / `vpt mkdir` / `vpt rm` / `vpt cp` | coreutils usage |
328-
| `vpt grep-file <pattern> <file>` | content assertions |
329-
| `vpt pipe-stdin <data> -- <argv>...` | piped-stdin scenarios without a shell |
327+
| `vpt list-dir` / `vpt mkdir` / `vpt rm` / `vpt cp` | coreutils usage |
328+
| `vpt grep-file <pattern> <file>` | content assertions |
329+
| `vpt pipe-stdin <data> -- <argv>...` | piped-stdin scenarios without a shell |
330330

331331
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:
332332

333-
| Subcommand | Purpose |
334-
| ---------- | ------- |
333+
| Subcommand | Purpose |
334+
| ------------------------------------------------------------------- | --------------------------------------------------------------------- |
335335
| `vpt print` / `vpt print-color` / `vpt print-env` / `vpt print-cwd` | deterministic task output; color, env, and cwd propagation into tasks |
336-
| `vpt check-tty` / `vpt read-stdin` | stdio wiring of spawned tasks |
337-
| `vpt exit <code>` / `vpt exit-on-ctrlc` / `vpt barrier` | exit-code handling, cancellation, concurrency synchronization |
336+
| `vpt check-tty` / `vpt read-stdin` | stdio wiring of spawned tasks |
337+
| `vpt exit <code>` / `vpt exit-on-ctrlc` / `vpt barrier` | exit-code handling, cancellation, concurrency synchronization |
338338

339339
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`.
340340

@@ -384,20 +384,20 @@ For each old case directory it emits a new fixture under `crates/vite_cli_snapsh
384384

385385
### Field mapping
386386

387-
| Old (`steps.json`) | New (`snapshots.toml`) |
388-
| ------------------ | ---------------------- |
389-
| tree location (`snap-tests` / `snap-tests-global`) | `vp = "local"` / `vp = "global"` (from `--vp`) |
390-
| `commands: [...]` | `steps = [...]` via command translation (below) |
391-
| `env` (value `""`) | `env` table (`unset-env` entry) |
392-
| `ignoredPlatforms: ["win32", {os, libc}]` | `skip-platforms` (`win32` to `windows`, `darwin` to `macos`) |
393-
| `ignoreOutput: true` | `snapshot = false` |
394-
| `timeout` | `timeout` |
395-
| `serial: true` | dropped, reported (isolation replaces it) |
396-
| `localVitePlusPackages: true` | `local-registry = true` |
397-
| `linkCheckoutPackages: true` | case flag, carried over |
398-
| `after: [...]` | `after` steps |
399-
| fixture files, `mock-manifest.json`, `tarballs/` | copied verbatim |
400-
| ` # trailing comment` on a command | step `comment` |
387+
| Old (`steps.json`) | New (`snapshots.toml`) |
388+
| -------------------------------------------------- | ------------------------------------------------------------ |
389+
| tree location (`snap-tests` / `snap-tests-global`) | `vp = "local"` / `vp = "global"` (from `--vp`) |
390+
| `commands: [...]` | `steps = [...]` via command translation (below) |
391+
| `env` (value `""`) | `env` table (`unset-env` entry) |
392+
| `ignoredPlatforms: ["win32", {os, libc}]` | `skip-platforms` (`win32` to `windows`, `darwin` to `macos`) |
393+
| `ignoreOutput: true` | `snapshot = false` |
394+
| `timeout` | `timeout` |
395+
| `serial: true` | dropped, reported (isolation replaces it) |
396+
| `localVitePlusPackages: true` | `local-registry = true` |
397+
| `linkCheckoutPackages: true` | case flag, carried over |
398+
| `after: [...]` | `after` steps |
399+
| fixture files, `mock-manifest.json`, `tarballs/` | copied verbatim |
400+
| ` # trailing comment` on a command | step `comment` |
401401

402402
### Command translation
403403

0 commit comments

Comments
 (0)