Skip to content

Commit 661ef64

Browse files
committed
Use cp_r for e2e fixture staging and remap vp path
1 parent db8b58a commit 661ef64

File tree

7 files changed

+149
-273
lines changed

7 files changed

+149
-273
lines changed

Cargo.lock

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ const_format = "0.2.34"
5959
constcat = "0.6.1"
6060
copy_dir = "0.1.3"
6161
cow-utils = "0.1.3"
62+
cp_r = "0.5.2"
6263
crossterm = { version = "0.29.0", features = ["event-stream"] }
6364
csv-async = { version = "1.3.1", features = ["tokio"] }
6465
ctor = "0.6"

crates/vite_task_bin/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ which = { workspace = true }
2727

2828
[dev-dependencies]
2929
cow-utils = { workspace = true }
30+
cp_r = { workspace = true }
3031
insta = { workspace = true, features = ["glob", "json", "redactions", "filters", "ron"] }
3132
pty_terminal = { workspace = true }
3233
pty_terminal_test = { workspace = true }

crates/vite_task_bin/tests/e2e_snapshots/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,29 +22,29 @@ steps = [
2222
]
2323
```
2424

25-
Steps also support an object form with PTY and interactions:
25+
Steps also support an object form with interactions:
2626

2727
```toml
2828
[[e2e]]
2929
name = "interactive step"
3030
steps = [
3131
{ command = "vp interact", interactions = [{ expect-milestone = "ready" }, { write = "hello" }, { write-line = "world" }, { write-key = "up" }, { write-key = "down" }, { write-key = "enter" }] },
32-
{ command = "node check-stdin.js", pty = false },
32+
"echo -n | node check-stdin.js",
3333
]
3434
```
3535

3636
Notes:
3737

38-
- String steps are shorthand for `{ command = "...", pty = true }`.
39-
- `interactions` are only valid when `pty = true`.
38+
- String steps are shorthand for `{ command = "..." }`.
4039
- `write-key` accepts `up`, `down`, and `enter`.
4140
- Snapshots include every interaction line, and each `expect-milestone` records the screen at that point.
41+
- For stdin pipe scenarios, write the step command with shell piping, for example: `echo -n | command`.
4242

4343
The test runner:
4444

4545
1. Copies the fixture to a temp directory
4646
2. Executes each step using `/bin/sh` (Unix) or `bash` (Windows)
47-
3. Runs each step in PTY mode by default (`TestTerminal`) unless `pty = false` (pipe stdio)
47+
3. Runs each step in PTY mode (`TestTerminal`)
4848
4. Applies configured interactions in order for PTY steps
4949
5. Captures output and exit codes
5050
6. Compares against snapshot in `fixtures/<name>/snapshots/`

crates/vite_task_bin/tests/e2e_snapshots/fixtures/interactions-no-vp/snapshots.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
name = "interactions without vp"
33
steps = [
44
{ command = "vp interact", interactions = [{ "expect-milestone" = "ready" }, { "write" = "hello" }, { "write-line" = "hello" }, { "expect-milestone" = "after-line" }, { "write-key" = "up" }, { "write-key" = "down" }, { "write" = "x" }, { "write-key" = "enter" }, { "expect-milestone" = "after-line" }, { "write-key" = "enter" }, { "expect-milestone" = "after-enter" }] },
5-
{ command = "node -e \"console.log('PIPE_STDIN_IS_TTY:' + String(Boolean(process.stdin.isTTY)))\"", pty = false },
5+
"echo -n | node -e \"console.log('PIPE_STDIN_IS_TTY:' + String(Boolean(process.stdin.isTTY)))\"",
66
]

crates/vite_task_bin/tests/e2e_snapshots/fixtures/interactions-no-vp/snapshots/interactions without vp.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,5 +73,5 @@ CHAR:x
7373
LINE:x
7474
KEY:ENTER
7575
DONE
76-
> node -e "console.log('PIPE_STDIN_IS_TTY:' + String(Boolean(process.stdin.isTTY)))"
76+
> echo -n | node -e "console.log('PIPE_STDIN_IS_TTY:' + String(Boolean(process.stdin.isTTY)))"
7777
PIPE_STDIN_IS_TTY:false

0 commit comments

Comments
 (0)