Skip to content

Commit 416406a

Browse files
branchseerclaude
andcommitted
feat(vite_task_bin): use vite_pty for e2e snapshot tests
Replace piped stdin/stdout with PTY-based process spawning in e2e tests. Child processes now run in a real terminal, closer to actual user experience. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 09481ab commit 416406a

29 files changed

Lines changed: 60 additions & 135 deletions

File tree

Cargo.lock

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

crates/vite_pty/src/terminal.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,12 @@ impl Terminal {
248248
self.write(&[0x03])
249249
}
250250

251+
/// Clones the child process killer for use from another thread.
252+
#[must_use]
253+
pub fn clone_killer(&self) -> Box<dyn ChildKiller + Send + Sync> {
254+
self.child_killer.clone_killer()
255+
}
256+
251257
#[must_use]
252258
pub fn screen_contents(&self) -> String {
253259
self.parser.screen().contents()

crates/vite_task_bin/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ serde = { workspace = true, features = ["derive", "rc"] }
3232
tempfile = { workspace = true }
3333
toml = { workspace = true }
3434
vite_path = { workspace = true, features = ["absolute-redaction"] }
35+
vite_pty = { workspace = true }
3536
vite_workspace = { workspace = true }
3637

3738
[lints]

crates/vite_task_bin/tests/e2e_snapshots/fixtures/associate-existing-cache/snapshots/associate existing cache.snap

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ Task Details:
2020
[1] script1: $ print hello
2121
Cache miss: no previous cache entry found
2222
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
23-
2423
> vp run script2 # cache hit, same command as script1
2524
$ print hellocache hit, replaying
2625
hello
@@ -38,7 +37,6 @@ Task Details:
3837
[1] script2: $ print hello ✓
3938
→ Cache hit - output replayed - <duration> saved
4039
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
41-
4240
> json-edit package.json '_.scripts.script2 = "print world"' # change script2
4341

4442
> vp run script2 # cache miss

crates/vite_task_bin/tests/e2e_snapshots/fixtures/builtin-different-cwd/snapshots/builtin different cwd.snap

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ Task Details:
3636
[1] lint: $ vp lint ✓
3737
→ Cache miss: no previous cache entry found
3838
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
39-
4039
> cd folder2 && vp run lint # cache miss in folder2
4140
$ vp lint ✓ cache hit, replaying
4241

@@ -70,7 +69,6 @@ Task Details:
7069
[1] lint: $ vp lint ✓
7170
→ Cache hit - output replayed - <duration> saved
7271
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
73-
7472
> echo 'console.log(1);' > folder2/a.js # modify folder2
7573

7674
> cd folder1 && vp run lint # cache hit
@@ -99,7 +97,6 @@ Task Details:
9997
[1] lint: $ vp lint ✓
10098
→ Cache miss: content of input 'folder2/a.js' changed
10199
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
102-
103100
> cd folder2 && vp run lint # cache miss
104101
$ vp lint ✓ cache hit, replaying
105102

crates/vite_task_bin/tests/e2e_snapshots/fixtures/builtin-non-zero-exit/snapshots/builtin command with non-zero exit does not show cache not updated.snap

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ Task Details:
2929
[1] builtin-non-zero-exit-test#lint: $ vp lint -D no-debugger ✗ (exit code: 1)
3030
→ Cache miss: no previous cache entry found
3131
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
32-
3332
[1]> vp run lint -- -D no-debugger
3433
$ vp lint -D no-debugger
3534

crates/vite_task_bin/tests/e2e_snapshots/fixtures/cache-disabled/snapshots/task with cache disabled.snap

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ Task Details:
2020
[1] cache-disabled-test#no-cache-task: $ print-file test.txt
2121
Cache disabled in task configuration
2222
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
23-
2423
> vp run no-cache-task # cache disabled, runs again
2524
$ print-file test.txtcache disabled: no cache config
2625
test content

crates/vite_task_bin/tests/e2e_snapshots/fixtures/cache-disabled/snapshots/task with cache enabled.snap

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ Task Details:
2020
[1] cache-disabled-test#cached-task: $ print-file test.txt
2121
Cache miss: no previous cache entry found
2222
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
23-
2423
> vp run cached-task # cache hit
2524
$ print-file test.txtcache hit, replaying
2625
test content

crates/vite_task_bin/tests/e2e_snapshots/fixtures/cache-miss-command-change/snapshots/cache miss command change.snap

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ Task Details:
2626
[2] task: $ print bar
2727
Cache miss: no previous cache entry found
2828
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
29-
3029
> json-edit package.json '_.scripts.task = "print baz && print bar"' # change first subtask
3130

3231
> vp run task # first: cache miss, second: cache hit
@@ -52,7 +51,6 @@ Task Details:
5251
[2] task: $ print bar ✓
5352
→ Cache hit - output replayed - <duration> saved
5453
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
55-
5654
> json-edit package.json '_.scripts.task = "print bar"' # remove first subtask
5755

5856
> vp run task # cache hit

crates/vite_task_bin/tests/e2e_snapshots/fixtures/cache-miss-reasons/snapshots/cwd changed.snap

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ Task Details:
2020
[1] cache-miss-reasons#test: $ print-file test.txt
2121
Cache miss: no previous cache entry found
2222
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
23-
2423
> mkdir -p subfolder
2524

2625
> cp test.txt subfolder/test.txt

0 commit comments

Comments
 (0)