Skip to content

Commit 536f436

Browse files
committed
fix: print milliseconds
1 parent 4101153 commit 536f436

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

test/test.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ if (flavor.match(/^test/)) {
9292
const files = globSync(list, { ignore });
9393

9494
function msToHumanDuration(ms) {
95+
if (ms < 1000) return `${ms}ms`;
9596
const seconds = Math.floor(ms / 1000);
9697
const minutes = Math.floor(seconds / 60);
9798
const hours = Math.floor(minutes / 60);
@@ -174,17 +175,27 @@ async function run() {
174175

175176
const promises = files.sort().map(async (file) => {
176177
file = path.resolve(file);
178+
const startTest = Date.now();
177179
try {
178180
await runTest(file);
179181
ok++;
180-
addLog(pc.green(`✔ ${file} ok`));
182+
addLog(
183+
pc.green(
184+
`✔ ${file} ok - ${msToHumanDuration(Date.now() - startTest)}`,
185+
),
186+
);
181187
} catch (error) {
182188
failed.push({
183189
file,
184190
error: error.message,
185191
output: error.logOutput,
186192
});
187-
addLog(pc.red(`✖ ${file} FAILED (in ${target})`), true);
193+
addLog(
194+
pc.red(
195+
`✖ ${file} FAILED (in ${target}) - ${msToHumanDuration(Date.now() - startTest)}`,
196+
),
197+
true,
198+
);
188199
addLog(pc.red(error.message), true);
189200
}
190201

0 commit comments

Comments
 (0)