Skip to content

Commit 2b60991

Browse files
committed
adds duration
1 parent d2717dc commit 2b60991

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Plugin.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ public function handleOriginalArguments(array $arguments): void
6969
$this->cache->flush();
7070
}
7171

72+
$startTime = microtime(true);
73+
7274
foreach ($arguments as $argument) {
7375
if (str_starts_with($argument, '--min')) {
7476
// grab the value of the --min argument
@@ -237,6 +239,9 @@ function (Result $result) use ($terminalWidth): void {
237239

238240
$exitCode = (int) ($coverage < $this->coverageMin);
239241

242+
// in seconds, with 2 decimal places
243+
$duration = number_format(microtime(true) - $startTime, 2, '.', '');
244+
240245
if ($exitCode === 1) {
241246
View::render('components.badge', [
242247
'type' => 'ERROR',
@@ -251,7 +256,7 @@ function (Result $result) use ($terminalWidth): void {
251256
<div class="mx-2">
252257
<hr class="text-gray" />
253258
<div class="w-full text-right">
254-
<span class="ml-1 font-bold">Total: {$totalCoverageAsString} %</span>
259+
<span class="ml-1 font-bold"><span class="text-gray">({$duration}s)</span> Total: {$totalCoverageAsString} %</span>
255260
</div>
256261
</div>
257262
HTML);

0 commit comments

Comments
 (0)