mirror of
https://github.com/vitest-dev/vitest.git
synced 2026-02-01 17:36:51 +00:00
fix: always display serialized error, even if it doesn't have stack (#2829)
This commit is contained in:
parent
570c639e4e
commit
ab5f892706
@ -188,9 +188,6 @@ function printStack(
|
||||
errorProperties: Record<string, unknown>,
|
||||
onStack?: ((stack: ParsedStack) => void),
|
||||
) {
|
||||
if (!stack.length)
|
||||
return
|
||||
|
||||
const logger = ctx.logger
|
||||
|
||||
for (const frame of stack) {
|
||||
@ -200,7 +197,8 @@ function printStack(
|
||||
logger.error(color(` ${c.dim(F_POINTER)} ${[frame.method, c.dim(`${path}:${frame.line}:${frame.column}`)].filter(Boolean).join(' ')}`))
|
||||
onStack?.(frame)
|
||||
}
|
||||
logger.error()
|
||||
if (stack.length)
|
||||
logger.error()
|
||||
const hasProperties = Object.keys(errorProperties).length > 0
|
||||
if (hasProperties) {
|
||||
logger.error(c.red(c.dim(divider())))
|
||||
|
||||
@ -10,7 +10,7 @@ export function hasBenchmark(suite: Arrayable<Suite>): boolean {
|
||||
|
||||
export function hasFailedSnapshot(suite: Arrayable<Task>): boolean {
|
||||
return getTests(suite).some((s) => {
|
||||
return s.result?.errors?.some(e => e.message.match(/Snapshot .* mismatched/))
|
||||
return s.result?.errors?.some(e => e && e.message && e.message.match(/Snapshot .* mismatched/))
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user