mirror of
https://github.com/denoland/deno.git
synced 2024-12-23 15:49:44 -05:00
fix(cli): formatting bench with colors (#19323)
This commit is contained in:
parent
e7468b947b
commit
82c3a56674
4 changed files with 20 additions and 3 deletions
|
@ -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,
|
||||
|
|
8
cli/tests/testdata/bench/bench_formatting.out
vendored
Normal file
8
cli/tests/testdata/bench/bench_formatting.out
vendored
Normal file
|
@ -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]
|
3
cli/tests/testdata/bench/bench_formatting.ts
vendored
Normal file
3
cli/tests/testdata/bench/bench_formatting.ts
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
Deno.bench("Date.now", () => {
|
||||
Date.now();
|
||||
});
|
|
@ -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))
|
||||
|
|
Loading…
Reference in a new issue