Skip to content

Commit

Permalink
fix(vitest): check unhighlighted code for code frame skip limit
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-ogawa committed Apr 1, 2024
1 parent e4e939b commit eb5d680
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/vitest/src/node/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import c from 'picocolors'
import cliTruncate from 'cli-truncate'
import type { StackTraceParserOptions } from '@vitest/utils/source-map'
import { inspect } from '@vitest/utils'
import stripAnsi from 'strip-ansi'
import type { ErrorWithDiff, ParsedStack } from '../types'
import { lineSplitRE, parseErrorStacktrace, positionToOffset } from '../utils/source-map'
import { F_POINTER } from '../utils/figures'
Expand Down Expand Up @@ -290,7 +291,7 @@ export function generateCodeFrame(
const lineLength = lines[j].length

// to long, maybe it's a minified file, skip for codeframe
if (lineLength > 200)
if (stripAnsi(lines[j]).length > 200)
return ''

res.push(lineNo(j + 1) + cliTruncate(lines[j].replace(/\t/g, ' '), columns - 5 - indent))
Expand Down

0 comments on commit eb5d680

Please sign in to comment.