Skip to content

Commit 956372e

Browse files
committed
fix: print duration with the name, not the error
1 parent e84033c commit 956372e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

packages/vitest/src/node/reporters/base.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,12 @@ export abstract class BaseReporter implements Reporter {
151151
for (const test of tests) {
152152
const duration = test.result?.duration
153153
if (test.result?.state === 'fail') {
154-
logger.log(c.red(` ${taskFail} ${getTestName(test, c.dim(' > '))}`))
155154
const suffix = this.getDurationPrefix(test)
155+
logger.log(c.red(` ${taskFail} ${getTestName(test, c.dim(' > '))}${suffix}`))
156156

157157
test.result?.errors?.forEach((e) => {
158158
// print short errors, full errors will be at the end in summary
159-
logger.log(c.red(` ${F_RIGHT} ${(e as any)?.message}${suffix}`))
159+
logger.log(c.red(` ${F_RIGHT} ${(e as any)?.message}`))
160160
})
161161
}
162162
// also print slow tests

test/reporters/tests/merge-reports.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,13 @@ test('merge reports', async () => {
8989
test 1-2
9090
9191
❯ first.test.ts (2 tests | 1 failed) <time>
92-
× test 1-2
92+
× test 1-2 <time>
9393
→ expected 1 to be 2 // Object.is equality
9494
stdout | second.test.ts > test 2-1
9595
test 2-1
9696
9797
❯ second.test.ts (3 tests | 1 failed) <time>
98-
× test 2-1
98+
× test 2-1 <time>
9999
→ expected 1 to be 2 // Object.is equality
100100
101101
Test Files 2 failed (2)

0 commit comments

Comments
 (0)