Skip to content

Commit

Permalink
feat: show file name in suite error
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Dec 23, 2021
1 parent 606ec9c commit faae94d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/ui/client/auto-imports.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ declare global {
const readonly: typeof import('vue')['readonly']
const ref: typeof import('vue')['ref']
const refDefault: typeof import('@vueuse/core')['refDefault']
const resolveComponent: typeof import('vue')['resolveComponent']
const shallowReactive: typeof import('vue')['shallowReactive']
const shallowReadonly: typeof import('vue')['shallowReadonly']
const shallowRef: typeof import('vue')['shallowRef']
Expand Down
5 changes: 3 additions & 2 deletions packages/vitest/src/reporters/console.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { performance } from 'perf_hooks'
import { relative } from 'pathe'
import c from 'picocolors'
import type { Reporter, TaskResultPack, UserConsoleLog } from '../types'
import type { File, Reporter, TaskResultPack, UserConsoleLog } from '../types'
import { getSuites, getTests } from '../utils'
import type { Vitest } from '../node'
import { printError } from './diff'
Expand Down Expand Up @@ -70,7 +70,8 @@ export class ConsoleReporter implements Reporter {
this.ctx.error(c.red(divider(c.bold(c.inverse(` Failed Suites ${failedSuites.length} `)))))
this.ctx.error()
for (const suite of failedSuites) {
this.ctx.error(c.red(`\n- ${getFullName(suite)}`))
const filepath = (suite as File)?.filepath || ''
this.ctx.error(c.red(`\n- ${getFullName(suite)} ${c.dim(`[ ${this.relative(filepath)} ]`)}`))
await printError(suite.result?.error, this.ctx)
errorDivider()
}
Expand Down
1 change: 1 addition & 0 deletions test/vitesse/src/auto-import.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ declare global {
const reactive: typeof import('vue')['reactive']
const readonly: typeof import('vue')['readonly']
const ref: typeof import('vue')['ref']
const resolveComponent: typeof import('vue')['resolveComponent']
const shallowReactive: typeof import('vue')['shallowReactive']
const shallowReadonly: typeof import('vue')['shallowReadonly']
const shallowRef: typeof import('vue')['shallowRef']
Expand Down

0 comments on commit faae94d

Please sign in to comment.