mirror of
https://github.com/denoland/deno.git
synced 2025-09-28 21:24:48 +00:00
feat(unstable/test): include test step pass/fail/ignore counts in final report (#12432)
This commit is contained in:
parent
58e7b290dc
commit
ec9f5d5af2
5 changed files with 40 additions and 5 deletions
|
@ -48,6 +48,6 @@ failures:
|
||||||
multiple test step failures
|
multiple test step failures
|
||||||
failing step in failing test
|
failing step in failing test
|
||||||
|
|
||||||
test result: FAILED. 0 passed; 3 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD])
|
test result: FAILED. 0 passed (1 step); 3 failed (5 steps); 0 ignored; 0 measured; 0 filtered out ([WILDCARD])
|
||||||
|
|
||||||
error: Test failed
|
error: Test failed
|
||||||
|
|
|
@ -5,4 +5,4 @@ test ignored step ...
|
||||||
test step 2 ... ok ([WILDCARD])
|
test step 2 ... ok ([WILDCARD])
|
||||||
ok ([WILDCARD])
|
ok ([WILDCARD])
|
||||||
|
|
||||||
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out [WILDCARD]
|
test result: ok. 1 passed (1 step); 0 failed; 0 ignored (1 step); 0 measured; 0 filtered out [WILDCARD]
|
||||||
|
|
|
@ -107,6 +107,6 @@ failures:
|
||||||
parallel steps when second has sanitizer
|
parallel steps when second has sanitizer
|
||||||
parallel steps where only inner tests have sanitizers
|
parallel steps where only inner tests have sanitizers
|
||||||
|
|
||||||
test result: FAILED. 0 passed; 7 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD])
|
test result: FAILED. 0 passed (4 steps); 7 failed (10 steps); 0 ignored; 0 measured; 0 filtered out ([WILDCARD])
|
||||||
|
|
||||||
error: Test failed
|
error: Test failed
|
||||||
|
|
|
@ -35,4 +35,4 @@ test steps buffered then streaming reporting ...
|
||||||
test step 2 ... ok ([WILDCARD])
|
test step 2 ... ok ([WILDCARD])
|
||||||
ok ([WILDCARD])
|
ok ([WILDCARD])
|
||||||
|
|
||||||
test result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out [WILDCARD]
|
test result: ok. 5 passed (18 steps); 0 failed; 0 ignored; 0 measured; 0 filtered out [WILDCARD]
|
||||||
|
|
|
@ -138,6 +138,10 @@ pub struct TestSummary {
|
||||||
pub passed: usize,
|
pub passed: usize,
|
||||||
pub failed: usize,
|
pub failed: usize,
|
||||||
pub ignored: usize,
|
pub ignored: usize,
|
||||||
|
pub passed_steps: usize,
|
||||||
|
pub failed_steps: usize,
|
||||||
|
pub pending_steps: usize,
|
||||||
|
pub ignored_steps: usize,
|
||||||
pub filtered_out: usize,
|
pub filtered_out: usize,
|
||||||
pub measured: usize,
|
pub measured: usize,
|
||||||
pub failures: Vec<(TestDescription, String)>,
|
pub failures: Vec<(TestDescription, String)>,
|
||||||
|
@ -150,6 +154,10 @@ impl TestSummary {
|
||||||
passed: 0,
|
passed: 0,
|
||||||
failed: 0,
|
failed: 0,
|
||||||
ignored: 0,
|
ignored: 0,
|
||||||
|
passed_steps: 0,
|
||||||
|
failed_steps: 0,
|
||||||
|
pending_steps: 0,
|
||||||
|
ignored_steps: 0,
|
||||||
filtered_out: 0,
|
filtered_out: 0,
|
||||||
measured: 0,
|
measured: 0,
|
||||||
failures: Vec::new(),
|
failures: Vec::new(),
|
||||||
|
@ -398,12 +406,24 @@ impl TestReporter for PrettyTestReporter {
|
||||||
colors::green("ok").to_string()
|
colors::green("ok").to_string()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let get_steps_text = |count: usize| -> String {
|
||||||
|
if count == 0 {
|
||||||
|
String::new()
|
||||||
|
} else if count == 1 {
|
||||||
|
" (1 step)".to_string()
|
||||||
|
} else {
|
||||||
|
format!(" ({} steps)", count)
|
||||||
|
}
|
||||||
|
};
|
||||||
println!(
|
println!(
|
||||||
"\ntest result: {}. {} passed; {} failed; {} ignored; {} measured; {} filtered out {}\n",
|
"\ntest result: {}. {} passed{}; {} failed{}; {} ignored{}; {} measured; {} filtered out {}\n",
|
||||||
status,
|
status,
|
||||||
summary.passed,
|
summary.passed,
|
||||||
|
get_steps_text(summary.passed_steps),
|
||||||
summary.failed,
|
summary.failed,
|
||||||
|
get_steps_text(summary.failed_steps + summary.pending_steps),
|
||||||
summary.ignored,
|
summary.ignored,
|
||||||
|
get_steps_text(summary.ignored_steps),
|
||||||
summary.measured,
|
summary.measured,
|
||||||
summary.filtered_out,
|
summary.filtered_out,
|
||||||
colors::gray(human_elapsed(elapsed.as_millis())),
|
colors::gray(human_elapsed(elapsed.as_millis())),
|
||||||
|
@ -846,6 +866,21 @@ async fn test_specifiers(
|
||||||
}
|
}
|
||||||
|
|
||||||
TestEvent::StepResult(description, result, duration) => {
|
TestEvent::StepResult(description, result, duration) => {
|
||||||
|
match &result {
|
||||||
|
TestStepResult::Ok => {
|
||||||
|
summary.passed_steps += 1;
|
||||||
|
}
|
||||||
|
TestStepResult::Ignored => {
|
||||||
|
summary.ignored_steps += 1;
|
||||||
|
}
|
||||||
|
TestStepResult::Failed(_) => {
|
||||||
|
summary.failed_steps += 1;
|
||||||
|
}
|
||||||
|
TestStepResult::Pending(_) => {
|
||||||
|
summary.pending_steps += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
reporter.report_step_result(&description, &result, duration);
|
reporter.report_step_result(&description, &result, duration);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue