test: cfg-gate e2e observer payloads

This commit is contained in:
2026-06-14 00:18:33 +09:00
parent 559adb9a3f
commit b30b43b989
5 changed files with 138 additions and 85 deletions
+5
View File
@@ -4,6 +4,7 @@ mod cache;
mod command;
mod composer_history;
mod composer_keys;
#[cfg(feature = "e2e-test")]
mod e2e_observer;
mod input;
pub mod keys;
@@ -109,6 +110,7 @@ pub async fn launch(options: LaunchOptions) -> ExitCode {
// Always restore the terminal first so any pending eprintln below
// shows up cleanly in scrollback rather than inside an active
// alternate-screen buffer.
#[cfg(feature = "e2e-test")]
e2e_observer::emit("tui", "terminal_cleanup_started", serde_json::json!({}));
let mut stdout = io::stdout();
let _ = execute!(
@@ -119,10 +121,12 @@ pub async fn launch(options: LaunchOptions) -> ExitCode {
);
let _ = disable_raw_mode();
let _ = execute!(stdout, crossterm::cursor::Show);
#[cfg(feature = "e2e-test")]
e2e_observer::emit("tui", "terminal_cleanup_finished", serde_json::json!({}));
match result {
Ok(()) => {
#[cfg(feature = "e2e-test")]
e2e_observer::emit("tui", "exit", serde_json::json!({ "status": "success" }));
ExitCode::SUCCESS
}
@@ -135,6 +139,7 @@ pub async fn launch(options: LaunchOptions) -> ExitCode {
if e.downcast_ref::<spawn::SpawnError>().is_none() {
eprintln!("yoi: {e}");
}
#[cfg(feature = "e2e-test")]
e2e_observer::emit("tui", "exit", serde_json::json!({ "status": "failure" }));
ExitCode::FAILURE
}