Skip to content

Commit

Permalink
fix: print duration with the name, not the error
Browse files Browse the repository at this point in the history
  • Loading branch information
sheremet-va committed Oct 15, 2024
1 parent e84033c commit 956372e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/vitest/src/node/reporters/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,12 @@ export abstract class BaseReporter implements Reporter {
for (const test of tests) {
const duration = test.result?.duration
if (test.result?.state === 'fail') {
logger.log(c.red(` ${taskFail} ${getTestName(test, c.dim(' > '))}`))
const suffix = this.getDurationPrefix(test)
logger.log(c.red(` ${taskFail} ${getTestName(test, c.dim(' > '))}${suffix}`))

test.result?.errors?.forEach((e) => {
// print short errors, full errors will be at the end in summary
logger.log(c.red(` ${F_RIGHT} ${(e as any)?.message}${suffix}`))
logger.log(c.red(` ${F_RIGHT} ${(e as any)?.message}`))
})
}
// also print slow tests
Expand Down
4 changes: 2 additions & 2 deletions test/reporters/tests/merge-reports.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,13 @@ test('merge reports', async () => {
test 1-2
❯ first.test.ts (2 tests | 1 failed) <time>
× test 1-2
× test 1-2 <time>
→ expected 1 to be 2 // Object.is equality
stdout | second.test.ts > test 2-1
test 2-1
❯ second.test.ts (3 tests | 1 failed) <time>
× test 2-1
× test 2-1 <time>
→ expected 1 to be 2 // Object.is equality
Test Files 2 failed (2)
Expand Down

0 comments on commit 956372e

Please sign in to comment.