Skip to content
Discussion options

You must be logged in to vote

In Vitest, JsonAssertionResult intentionally does not expose any “browser name” because Vitest itself is runner-agnostic. From Vitest’s point of view, tests are executed in a JS runtime, not in a browser identity like “Chrome” or “Firefox”.

So the short answer is:
you can’t reliably access the browser name from JsonAssertionResult, because that information is not part of Vitest’s core result model.

But here are the correct ways to approach this depending on what you actually need.

  1. Vitest doesn’t know the browser unless you provide it
    Vitest only knows about:
  • the environment (node, jsdom, happy-dom, etc.)
  • the test context you define

Even when running browser tests (via @vitest/browser

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by meeshan-dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants