pub struct TestRunner { /* private fields */ }Expand description
Top-level test runner.
Implementations§
Source§impl TestRunner
impl TestRunner
Sourcepub fn new(config: TestConfig, overrides: CliOverrides) -> Self
pub fn new(config: TestConfig, overrides: CliOverrides) -> Self
Build a runner with no programmatic suite hooks. For runners that need
before_all / after_all closures, use TestRunner::with_hooks.
Sourcepub fn with_hooks(
config: TestConfig,
hooks: TestHooks,
overrides: CliOverrides,
) -> Self
pub fn with_hooks( config: TestConfig, hooks: TestHooks, overrides: CliOverrides, ) -> Self
Build a runner with programmatic suite hooks supplied at construction.
Sourcepub fn add_reporter(&mut self, reporter: Box<dyn Reporter>)
pub fn add_reporter(&mut self, reporter: Box<dyn Reporter>)
Append an additional reporter after construction (e.g., NAPI ResultCollector).
Sourcepub async fn run(&mut self, plan: TestPlan) -> i32
pub async fn run(&mut self, plan: TestPlan) -> i32
Run the full test plan. Returns exit code (0 = all passed).
When config.projects is non-empty, topologically sorts projects by
dependencies and runs each with a merged config. Otherwise runs the
plan directly (single-project path).
Convenience wrapper: creates an EventBus, subscribes a ReporterDriver,
and delegates to execute(). For real-time external observation (TUI, WebSocket),
use execute() directly with a custom bus.
Sourcepub async fn execute(&self, plan: TestPlan, event_bus: EventBus) -> i32
pub async fn execute(&self, plan: TestPlan, event_bus: EventBus) -> i32
Core execution engine. Emits events on the provided EventBus.
Takes &self — no reporter ownership, no mutable state. The caller
controls who subscribes to the bus (reporters, TUI, external consumers).
The bus is consumed by value and dropped when execution completes, closing all subscriber channels and signaling consumers to finalize.
Sourcepub async fn run_watch<F>(
&mut self,
plan_factory: F,
watch_root: PathBuf,
) -> i32
pub async fn run_watch<F>( &mut self, plan_factory: F, watch_root: PathBuf, ) -> i32
Run in watch mode: re-run tests on file changes with interactive keyboard controls.
Launches a browser once and reuses it across all runs. Watches the project directory for file changes and dispatches re-runs based on change type.
§Arguments
plan_factory— Closure that generates aTestPlan. Receives an optional slice of changed file paths — whenSome, the factory should only re-process those files (e.g., re-parse only changed.featurefiles). WhenNone, generate the full plan.watch_root— Root directory to watch for file changes.
Auto Trait Implementations§
impl Freeze for TestRunner
impl !RefUnwindSafe for TestRunner
impl Send for TestRunner
impl Sync for TestRunner
impl Unpin for TestRunner
impl UnsafeUnpin for TestRunner
impl !UnwindSafe for TestRunner
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more