Skip to content

Commit

Permalink
Show discovery duration
Browse files Browse the repository at this point in the history
  • Loading branch information
maxdeviant committed Apr 21, 2024
1 parent bb521d5 commit 857159f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/startest/internal/runner/core.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ import startest/test_failure
import startest/test_tree

pub fn run_tests(test_files: List(TestFile), ctx: Context) {
// We should probably be storing an explicit time when we start the
// discovery, in case we insert more operations between the time we
// start and when we begin discovering tests, but for now we can just
// assume that the first thing we do after starting is begin discovery.
let discovery_duration =
clock.now(ctx.clock)
|> birl.difference(ctx.started_at)

let tests =
test_files
|> list.flat_map(fn(test_file) {
Expand Down Expand Up @@ -90,6 +98,7 @@ pub fn run_tests(test_files: List(TestFile), ctx: Context) {
test_files,
executed_tests,
failed_tests,
discovery_duration,
execution_duration,
reporting_duration,
)
Expand Down
5 changes: 4 additions & 1 deletion src/startest/reporter.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ pub fn report_summary(
test_files: List(TestFile),
tests: List(ExecutedTest),
failed_tests: List(#(Test, TestFailure)),
discovery_duration: Duration,
execution_duration: Duration,
reporting_duration: Duration,
) {
Expand Down Expand Up @@ -114,7 +115,9 @@ pub fn report_summary(
<> duration_to_string(total_duration)
<> " "
<> label(
"(collect "
"(discover "
<> duration_to_string(discovery_duration)
<> ", collect "
<> duration_to_string(total_collect_duration)
<> ", tests "
<> duration_to_string(execution_duration)
Expand Down

0 comments on commit 857159f

Please sign in to comment.