Skip to content

Commit b49617e

Browse files
branchseerclaude
andcommitted
Add e2e snapshot test for ctrl-c propagation to running tasks
Add a `vtt exit-on-ctrlc` subcommand and e2e fixture that verifies SIGINT propagates to concurrent tasks when the user presses Ctrl+C. The test runs two packages with `vt run -r dev`, synchronizes via milestone protocol, then sends ctrl-c and verifies both tasks receive and handle it. Also adds `ctrl-c` as a new `write-key` interaction type for e2e snapshot tests, fixes `expect_milestone` to not drop unmatched milestones, and strips `^C` terminal echo in redaction for cross-platform consistency. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent c100c3b commit b49617e

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

crates/vite_task_bin/tests/e2e_snapshots/fixtures/ctrl-c/snapshots/ctrl-c terminates running tasks.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ expression: e2e_outputs
1212
@ write-key: ctrl-c
1313
~/packages/a$ vtt exit-on-ctrlccache disabled
1414
~/packages/b$ vtt exit-on-ctrlccache disabled
15-
^Cctrl-c receivedctrl-c received
15+
ctrl-c receivedctrl-c received

crates/vite_task_bin/tests/e2e_snapshots/redact.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,15 @@ pub fn redact_e2e_output(mut output: String, workspace_root: &str) -> String {
101101
let mise_warning_regex = regex::Regex::new(r"(?m)^mise WARN\s+.*\n?").unwrap();
102102
output = mise_warning_regex.replace_all(&output, "").into_owned();
103103

104+
// Remove ^C echo that Unix terminal drivers emit when ETX (0x03) is written
105+
// to the PTY. Windows ConPTY does not echo it.
106+
{
107+
use cow_utils::CowUtils as _;
108+
if let Cow::Owned(replaced) = output.as_str().cow_replace("^C", "") {
109+
output = replaced;
110+
}
111+
}
112+
104113
// Sort consecutive diagnostic blocks to handle non-deterministic tool output
105114
// (e.g., oxlint reports warnings in arbitrary order due to multi-threading).
106115
// Each block starts with " ! " and ends at the next empty line.

0 commit comments

Comments
 (0)