Skip to content

Commit

Permalink
feat: show active test name pattern on CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
AriPerkkio authored and sheremet-va committed Jan 27, 2023
1 parent a045591 commit df7c410
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/vitest/src/node/reporters/base.ts
Expand Up @@ -156,16 +156,17 @@ export abstract class BaseReporter implements Reporter {
const BADGE = c.inverse(c.bold(c.blue(' RERUN ')))
const TRIGGER = trigger ? c.dim(` ${this.relative(trigger)}`) : ''
const FILENAME_PATTERN = this.ctx.filenamePattern ? `${BADGE_PADDING} ${c.dim('Filename pattern: ')}${c.blue(this.ctx.filenamePattern)}\n` : ''
const TESTNAME_PATTERN = this.ctx.config.testNamePattern ? `${BADGE_PADDING} ${c.dim('Test name pattern: ')}${c.blue(String(this.ctx.config.testNamePattern))}\n` : ''

if (files.length > 1) {
// we need to figure out how to handle rerun all from stdin
this.ctx.logger.clearFullScreen(`\n${BADGE}${TRIGGER}\n${FILENAME_PATTERN}`)
this.ctx.logger.clearFullScreen(`\n${BADGE}${TRIGGER}\n${FILENAME_PATTERN}${TESTNAME_PATTERN}`)
this._lastRunCount = 0
}
else if (files.length === 1) {
const rerun = this._filesInWatchMode.get(files[0]) ?? 1
this._lastRunCount = rerun
this.ctx.logger.clearFullScreen(`\n${BADGE}${TRIGGER} ${c.blue(`x${rerun}`)}\n${FILENAME_PATTERN}`)
this.ctx.logger.clearFullScreen(`\n${BADGE}${TRIGGER} ${c.blue(`x${rerun}`)}\n${FILENAME_PATTERN}${TESTNAME_PATTERN}`)
}

this._timeStart = new Date()
Expand Down

0 comments on commit df7c410

Please sign in to comment.