Skip to content

fix(ui): fix duplicate colored error message#10258

Merged
sheremet-va merged 8 commits into
vitest-dev:mainfrom
hi-ogawa:fix-ui-ansi-error-rendering
May 11, 2026
Merged

fix(ui): fix duplicate colored error message#10258
sheremet-va merged 8 commits into
vitest-dev:mainfrom
hi-ogawa:fix-ui-ansi-error-rendering

Conversation

@hi-ogawa

@hi-ogawa hi-ogawa commented May 4, 2026

Copy link
Copy Markdown
Collaborator

Description

There was a buggy code path for colored error.message handling. As I didn't see the need of involved logic around htmlError, I simplified it and let ViewReportError format the error uniformly even though we could patch up buggy htmlError.

Here is a before and after of the change:

  • Before
image
  • After
image

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. If the feature is substantial or introduces breaking changes without a discussion, PR might be closed.
  • Ideally, include a test that fails without this PR but passes with it.
  • Please, don't make changes to pnpm-lock.yaml unless you introduce a new test example.
  • Please check Allow edits by maintainers to make review process faster. Note that this option is not available for repositories that are owned by Github organizations.

Tests

  • Run the tests with pnpm test:ci.

Documentation

  • If you introduce new functionality, document it. You can run documentation with pnpm run docs command.

Changesets

  • Changes in changelog are generated from PR name. Please, make sure that it explains your changes in an understandable manner. Please, prefix changeset messages with feat:, fix:, perf:, docs:, or chore:.

hi-ogawa and others added 3 commits May 4, 2026 12:07
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
@netlify

netlify Bot commented May 4, 2026

Copy link
Copy Markdown

Deploy Preview for vitest-dev ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit b5c02af
🔍 Latest deploy log https://app.netlify.com/projects/vitest-dev/deploys/6a0199e67476fa0008ccc8b2
😎 Deploy Preview https://deploy-preview-10258--vitest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Comment on lines -64 to -78
function createHtmlError(filter: Convert, error: TestError) {
let htmlError = ''
if (error.message?.includes('\x1B')) {
htmlError = `<b>${error.name}</b>: ${filter.toHtml(
escapeHtml(error.message),
)}`
}

const startStrWithX1B = error.stack?.includes('\x1B')
if (startStrWithX1B) {
if (htmlError.length > 0) {
htmlError += filter.toHtml(
escapeHtml((error.stack) as string),
)
}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this code was duplicating error.message since error.stack normally includes error.message.

@hi-ogawa hi-ogawa marked this pull request as ready for review May 11, 2026 10:59
@sheremet-va sheremet-va merged commit 035e3bb into vitest-dev:main May 11, 2026
17 of 19 checks passed
@hi-ogawa hi-ogawa deleted the fix-ui-ansi-error-rendering branch May 11, 2026 23:00
@github-actions github-actions Bot locked and limited conversation to collaborators May 28, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Some error messages are duplicated in UI

2 participants