0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-21 21:19:50 +01:00
nodejs/test/parallel/test-console-formatTime.js
Vinicius Lourenço f88386561c
module: print amount of load time of a cjs module
PR-URL: https://github.com/nodejs/node/pull/52213
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2024-05-30 16:58:59 +00:00

15 lines
655 B
JavaScript

'use strict';
// Flags: --expose-internals
require('../common');
const { formatTime } = require('internal/util/debuglog');
const assert = require('assert');
assert.strictEqual(formatTime(100.0096), '100.01ms');
assert.strictEqual(formatTime(100.0115), '100.011ms');
assert.strictEqual(formatTime(1500.04), '1.500s');
assert.strictEqual(formatTime(1000.056), '1.000s');
assert.strictEqual(formatTime(60300.3), '1:00.300 (m:ss.mmm)');
assert.strictEqual(formatTime(4000457.4), '1:06:40.457 (h:mm:ss.mmm)');
assert.strictEqual(formatTime(3601310.4), '1:00:01.310 (h:mm:ss.mmm)');
assert.strictEqual(formatTime(3213601017.6), '892:40:01.018 (h:mm:ss.mmm)');