-
Notifications
You must be signed in to change notification settings - Fork 30k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
console: display timeEnd with suitable time unit
When timeEnd function is called, display result with a suitable time unit instead of a big amount of milliseconds. Refs: #29099 PR-URL: #29251 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
- Loading branch information
Showing
3 changed files
with
60 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
'use strict'; | ||
// Flags: --expose-internals | ||
require('../common'); | ||
const { formatTime } = require('internal/console/constructor'); | ||
const assert = require('assert'); | ||
|
||
const test1 = formatTime(100); | ||
const test2 = formatTime(1500); | ||
const test3 = formatTime(60300); | ||
const test4 = formatTime(4000000); | ||
|
||
assert.strictEqual(test1, '100.000ms'); | ||
assert.strictEqual(test2, '1.500s'); | ||
assert.strictEqual(test3, '1.005min'); | ||
assert.strictEqual(test4, '1.111h'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters