diff --git a/crates/forge/src/run_tests/messages/mod.rs b/crates/forge/src/run_tests/messages/mod.rs index 9d28624e83..d0ad3c26e9 100644 --- a/crates/forge/src/run_tests/messages/mod.rs +++ b/crates/forge/src/run_tests/messages/mod.rs @@ -1,6 +1,8 @@ pub mod collected_tests_count; pub mod latest_blocks_numbers; pub mod overall_summary; +pub mod partition_finished; +pub mod partition_started; pub mod tests_failure_summary; pub mod tests_run; pub mod tests_summary; diff --git a/crates/forge/src/run_tests/messages/partition_finished.rs b/crates/forge/src/run_tests/messages/partition_finished.rs new file mode 100644 index 0000000000..7dfea2a448 --- /dev/null +++ b/crates/forge/src/run_tests/messages/partition_finished.rs @@ -0,0 +1,33 @@ +use console::style; +use foundry_ui::{Message, components::labeled::LabeledMessage}; +use serde::Serialize; +use serde_json::{Value, json}; + +use crate::partition::Partition; + +#[derive(Serialize)] +pub struct PartitionFinishedMessage { + partition: Partition, +} + +impl PartitionFinishedMessage { + #[must_use] + pub fn new(partition: Partition) -> Self { + Self { partition } + } +} + +impl Message for PartitionFinishedMessage { + fn text(&self) -> String { + let styled_label = style("Finished partition run").bold().to_string(); + LabeledMessage::new( + &styled_label, + &format!("{}/{}", self.partition.index, self.partition.total), + ) + .text() + } + + fn json(&self) -> Value { + json!(self) + } +} diff --git a/crates/forge/src/run_tests/messages/partition_started.rs b/crates/forge/src/run_tests/messages/partition_started.rs new file mode 100644 index 0000000000..3d023c9d64 --- /dev/null +++ b/crates/forge/src/run_tests/messages/partition_started.rs @@ -0,0 +1,33 @@ +use console::style; +use foundry_ui::{Message, components::labeled::LabeledMessage}; +use serde::Serialize; +use serde_json::{Value, json}; + +use crate::partition::Partition; + +#[derive(Serialize)] +pub struct PartitionStartedMessage { + partition: Partition, +} + +impl PartitionStartedMessage { + #[must_use] + pub fn new(partition: Partition) -> Self { + Self { partition } + } +} + +impl Message for PartitionStartedMessage { + fn text(&self) -> String { + let styled_label = style("Running partition run").bold().to_string(); + LabeledMessage::new( + &styled_label, + &format!("{}/{}", self.partition.index, self.partition.total), + ) + .text() + } + + fn json(&self) -> Value { + json!(self) + } +}