diff options
| author | Matt Mastracci <matthew@mastracci.com> | 2024-02-05 10:27:17 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-05 17:27:17 +0000 |
| commit | aecad7f3531c76306274d86afb458fcbc08edca2 (patch) | |
| tree | 555bfc6118c3cac2d5847ac803c7adb30026502b /cli/tools/test/mod.rs | |
| parent | cb407bb546aba3e402135a2d6c746ee9c8ddc040 (diff) | |
refactor(cli): Add TestFailureDescription (#22267)
Extract zero-risk changes from #22226
Diffstat (limited to 'cli/tools/test/mod.rs')
| -rw-r--r-- | cli/tools/test/mod.rs | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/cli/tools/test/mod.rs b/cli/tools/test/mod.rs index 7a5d633ec..85c00bb0f 100644 --- a/cli/tools/test/mod.rs +++ b/cli/tools/test/mod.rs @@ -177,6 +177,27 @@ pub struct TestDescription { pub location: TestLocation, } +/// May represent a failure of a test or test step. +#[derive(Debug, Clone, PartialEq, Deserialize, Eq, Hash)] +#[serde(rename_all = "camelCase")] +pub struct TestFailureDescription { + pub id: usize, + pub name: String, + pub origin: String, + pub location: TestLocation, +} + +impl From<&TestDescription> for TestFailureDescription { + fn from(value: &TestDescription) -> Self { + Self { + id: value.id, + name: value.name.clone(), + origin: value.origin.clone(), + location: value.location.clone(), + } + } +} + #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Debug, Clone, PartialEq, Deserialize)] #[serde(rename_all = "camelCase")] @@ -332,7 +353,7 @@ pub struct TestSummary { pub ignored_steps: usize, pub filtered_out: usize, pub measured: usize, - pub failures: Vec<(TestDescription, TestFailure)>, + pub failures: Vec<(TestFailureDescription, TestFailure)>, pub uncaught_errors: Vec<(String, Box<JsError>)>, } |
