diff --git a/cli/tests/integration/bench_tests.rs b/cli/tests/integration/bench_tests.rs index 0fc2680765..0ba297e63b 100644 --- a/cli/tests/integration/bench_tests.rs +++ b/cli/tests/integration/bench_tests.rs @@ -43,6 +43,12 @@ itest!(fail { output: "bench/fail.out", }); +itest!(bench_formatting { + args: "bench bench/bench_formatting.ts", + exit_code: 0, + output: "bench/bench_formatting.out", +}); + itest!(collect { args: "bench --ignore=bench/collect/ignore bench/collect", exit_code: 0, diff --git a/cli/tests/testdata/bench/bench_formatting.out b/cli/tests/testdata/bench/bench_formatting.out new file mode 100644 index 0000000000..9539e712f6 --- /dev/null +++ b/cli/tests/testdata/bench/bench_formatting.out @@ -0,0 +1,8 @@ +Check [WILDCARD]/bench/bench_formatting.ts +cpu: [WILDCARD] +runtime: deno [WILDCARD] ([WILDCARD]) + +[WILDCARD]/bench/bench_formatting.ts +benchmark time (avg) (min … max) p75 p99 p995 +------------------------------------------------- ----------------------------- +[WILDCARD] [WILDCARD] [WILDCARD]/iter[WILDCARD]([WILDCARD] … [WILDCARD]) [WILDCARD] \ No newline at end of file diff --git a/cli/tests/testdata/bench/bench_formatting.ts b/cli/tests/testdata/bench/bench_formatting.ts new file mode 100644 index 0000000000..fdee15abb7 --- /dev/null +++ b/cli/tests/testdata/bench/bench_formatting.ts @@ -0,0 +1,3 @@ +Deno.bench("Date.now", () => { + Date.now(); +}); diff --git a/cli/tools/bench.rs b/cli/tools/bench.rs index 1a5df92bf0..6461e544f3 100644 --- a/cli/tools/bench.rs +++ b/cli/tools/bench.rs @@ -1147,13 +1147,13 @@ mod mitata { } else { if options.avg { s.push_str(&format!( - "{:>23}", + "{:>30}", format!("{}/iter", colors::yellow(fmt_duration(stats.avg))) )); } if options.min_max { s.push_str(&format!( - "{:>42}", + "{:>50}", format!( "({} … {})", colors::cyan(fmt_duration(stats.min)), @@ -1163,7 +1163,7 @@ mod mitata { } if options.percentiles { s.push_str(&format!( - " {:>18} {:>18} {:>18}", + " {:>22} {:>22} {:>22}", colors::magenta(fmt_duration(stats.p75)), colors::magenta(fmt_duration(stats.p99)), colors::magenta(fmt_duration(stats.p995))