diff --git a/cmd/root_test.go b/cmd/root_test.go index 8ddf32c..2a2b7e0 100644 --- a/cmd/root_test.go +++ b/cmd/root_test.go @@ -220,9 +220,10 @@ func TestRunTest(t *testing.T) { for _, want := range []string{ "RUN a", - "PASS a", + "PASS a in ", + " seconds", "RUN nested/b", - "PASS nested/b", + "PASS nested/b in ", "Summary: total=2 passed=2 failed=0", } { if !strings.Contains(stdout, want) { @@ -265,9 +266,9 @@ func TestRunTestScopedDirectory(t *testing.T) { for _, want := range []string{ "RUN nested/b", - "PASS nested/b", + "PASS nested/b in ", "RUN nested/c", - "PASS nested/c", + "PASS nested/c in ", "Summary: total=2 passed=2 failed=0", } { if !strings.Contains(stdout, want) { @@ -312,7 +313,7 @@ func TestRunTestScopedLeafDirectory(t *testing.T) { for _, want := range []string{ "RUN nested/b", - "PASS nested/b", + "PASS nested/b in ", "Summary: total=1 passed=1 failed=0", } { if !strings.Contains(stdout, want) { @@ -357,9 +358,10 @@ func TestRunTestReturnsZeroWhenScenarioMismatches(t *testing.T) { for _, want := range []string{ "RUN a", - "PASS a", + "PASS a in ", "RUN b", - "FAIL b: output differed", + "FAIL b in ", + "output differed", "Summary: total=2 passed=1 failed=1", } { if !strings.Contains(stdout, want) { @@ -457,7 +459,8 @@ func TestRunTestReturnsZeroWhenCompareMarkerMissing(t *testing.T) { for _, want := range []string{ "RUN some", - "FAIL some: missing compare marker", + "FAIL some in ", + "missing compare marker", "Summary: total=1 passed=0 failed=1", } { if !strings.Contains(stdout, want) { diff --git a/internal/miro/test.go b/internal/miro/test.go index 584648e..073d7b6 100644 --- a/internal/miro/test.go +++ b/internal/miro/test.go @@ -9,6 +9,7 @@ import ( "os/exec" "path/filepath" "sort" + "time" "miro/internal/output" ) @@ -82,14 +83,17 @@ func runTests(path string, tio testIO) error { for _, scenario := range scenarios { output.Fprintf(tio.out, "%s %s\n", output.Label("RUN", output.Info), scenario.relPath) + start := time.Now() if err := replayScenario(scenario, shellPath, tio, cfg.Sandbox); err != nil { + elapsed := time.Since(start).Seconds() summary.failed++ - output.Fprintf(tio.out, "%s %s: %v\n", output.Label("FAIL", output.Fail), scenario.relPath, err) + output.Fprintf(tio.out, "%s %s in %.3f seconds: %v\n", output.Label("FAIL", output.Fail), scenario.relPath, elapsed, err) continue } + elapsed := time.Since(start).Seconds() summary.passed++ - output.Fprintf(tio.out, "%s %s\n", output.Label("PASS", output.Pass), scenario.relPath) + output.Fprintf(tio.out, "%s %s in %.3f seconds\n", output.Label("PASS", output.Pass), scenario.relPath, elapsed) } summaryColor := output.Pass