Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/commands/scanner.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@
i18n.getTokenSync("cli.stat",
kleur.blue().bold("verbose"),
stat.name,
kleur.cyan().bold(formatMs(stat.executionTime))
colorExecutionTime(stat.executionTime)
)));
startSpinners();
});
Expand Down Expand Up @@ -247,6 +247,20 @@
return ms(Number(time.toFixed(2)));
}

function colorExecutionTime(timeMs) {
const formatted = formatMs(timeMs);
if (timeMs <= 1_000) {
return kleur.green().bold(formatted);
}
else if (timeMs <= 5_000) {
return kleur.cyan().bold(formatted);
}
else if (timeMs <= 30_000) {
return kleur.yellow().bold(formatted);
}
return kleur.red().bold(formatted);

Check failure on line 261 in src/commands/scanner.js

View workflow job for this annotation

GitHub Actions / test (24.x, ubuntu-latest)

Expected blank line before this statement

Check failure on line 261 in src/commands/scanner.js

View workflow job for this annotation

GitHub Actions / test (24.x, macos-latest)

Expected blank line before this statement

Check failure on line 261 in src/commands/scanner.js

View workflow job for this annotation

GitHub Actions / test (24.x, windows-latest)

Expected blank line before this statement
}

function stopSpinners() {
spinners.forEach((spinner) => {
if (!spinner.succeeded) {
Expand Down
Loading