Skip to content

Commit

Permalink
fix(node): guard error info
Browse files Browse the repository at this point in the history
  • Loading branch information
btea authored and sheremet-va committed Jul 11, 2023
1 parent ed4e042 commit 88b3975
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/vitest/src/node/error.ts
Expand Up @@ -191,6 +191,10 @@ export function displayDiff(diff: string | null, console: Console) {

function printErrorMessage(error: ErrorWithDiff, logger: Logger) {
const errorName = error.name || error.nameStr || 'Unknown Error'
if (!(error instanceof Error)) {
logger.error(error)
return
}
if (error.message.length > 5000) {
// Protect against infinite stack trace in picocolors
logger.error(`${c.red(c.bold(errorName))}: ${error.message}`)
Expand Down

0 comments on commit 88b3975

Please sign in to comment.