Skip to main content

vibe_tests/base/
alias.rs

1//! Type aliases for VibeTests callbacks.
2//! Keeps struct definitions clean and readable.
3
4use std::collections::HashMap;
5use std::pin::Pin;
6
7use crate::base::error::TestsResult;
8use crate::env::env_log::EnvLog;
9use crate::env::env_run::EnvRun;
10use crate::env::env_start::EnvStart;
11use crate::env::env_stop::EnvStop;
12
13/// Startup callback: runs once after compose up and before MCP health check.
14pub type OnStart = Box<
15    dyn FnOnce(
16            EnvStart,
17        )
18            -> Pin<Box<dyn Future<Output = TestsResult<Option<HashMap<String, String>>>> + Send>>
19        + Send,
20>;
21
22/// Per-test callback: runs before each test() call.
23pub type OnRun =
24    Box<dyn Fn(EnvRun) -> Pin<Box<dyn Future<Output = TestsResult<()>> + Send>> + Send + Sync>;
25
26/// Shutdown callback: runs before compose down and home cleanup.
27pub type OnStop = Box<dyn FnOnce(EnvStop) + Send>;
28
29/// Log event handler: receives structured events during test execution.
30pub type OnLog = Box<dyn Fn(EnvLog) + Send + Sync>;