Skip to content

Commit

Permalink
fix(benchmark): render project name in results
Browse files Browse the repository at this point in the history
  • Loading branch information
AriPerkkio committed Dec 13, 2024
1 parent 9ed93b5 commit 8a19faa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/vitest/src/node/reporters/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ export abstract class BaseReporter implements Reporter {
}

const groupName = getFullName(group, c.dim(' > '))
this.log(` ${bench.name}${c.dim(` - ${groupName}`)}`)
this.log(` ${formatProjectName(bench.file.projectName)}${bench.name}${c.dim(` - ${groupName}`)}`)

const siblings = group.tasks
.filter(i => i.meta.benchmark && i.result?.benchmark && i !== bench)
Expand Down
4 changes: 2 additions & 2 deletions packages/vitest/src/node/reporters/benchmark/reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { getFullName } from '@vitest/runner/utils'
import * as pathe from 'pathe'
import c from 'tinyrainbow'
import { DefaultReporter } from '../default'
import { getStateSymbol } from '../renderers/utils'
import { formatProjectName, getStateSymbol } from '../renderers/utils'
import { createBenchmarkJsonReport, flattenFormattedBenchmarkReport } from './json-formatter'
import { renderTable } from './tableRender'

Expand Down Expand Up @@ -56,7 +56,7 @@ export class BenchmarkReporter extends DefaultReporter {
const duration = task.result.duration

if (benches.length > 0 && benches.every(t => t.result?.state !== 'run')) {
let title = `\n ${getStateSymbol(task)} ${getFullName(task, c.dim(' > '))}`
let title = `\n ${getStateSymbol(task)} ${formatProjectName(task.file.projectName)}${getFullName(task, c.dim(' > '))}`

if (duration != null && duration > this.ctx.config.slowTestThreshold) {
title += c.yellow(` ${Math.round(duration)}${c.dim('ms')}`)
Expand Down

0 comments on commit 8a19faa

Please sign in to comment.