Skip to content
Open
2 changes: 2 additions & 0 deletions crates/forge/src/run_tests/messages/mod.rs
Original file line number Diff line number Diff line change
@@ -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;
33 changes: 33 additions & 0 deletions crates/forge/src/run_tests/messages/partition_finished.rs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could also have a message at the top of the forge run, saying "Running partition X/Y"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

Original file line number Diff line number Diff line change
@@ -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)
}
}
33 changes: 33 additions & 0 deletions crates/forge/src/run_tests/messages/partition_started.rs
Original file line number Diff line number Diff line change
@@ -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)
}
}
Loading