vitest icon indicating copy to clipboard operation
vitest copied to clipboard

Cant't pause on uncaught exceptions

Open NullVoxPopuli opened this issue 8 months ago • 3 comments

Describe the bug

An error prints to the web UI (I'm using browser mode (and chrome))

I saw this, https://github.com/vitest-dev/vitest/issues/7940

but I do not think it's resolved (unless a version has not been released since that was closed)

It's not a unhandled rejection though -- just a normal error:

Image

Image

Reproduction

Stackblitz seems to no longer support firefox (138.0.3 (64-bit))? so I can't make a repro on stackblitz (I'm not logged in in chrome).

System Info

❯ pnpm dlx envinfo --system --npmPackages '{vitest*,@vitest/*,vite,@vitejs/*,playwright,webdriverio}'
 --binaries --browsers
Packages: +1
+
Progress: resolved 1, reused 1, downloaded 0, added 1, done

  System:
    OS: Linux 6.11 Ubuntu 24.10 24.10 (Oracular Oriole)
    CPU: (12) x64 AMD Ryzen 5 7640U w/ Radeon 760M Graphics
    Memory: 57.23 GB / 89.89 GB
    Container: Yes
    Shell: 5.2.32 - /bin/bash
  Binaries:
    Node: 23.6.0 - ~/.proto/shims/node
    Yarn: 4.5.1 - ~/.proto/shims/yarn
    npm: 10.9.0 - ~/.proto/shims/npm
    pnpm: 10.11.0 - ~/.proto/shims/pnpm
    bun: 1.1.43 - ~/.proto/shims/bun
  Browsers:
    Chrome: 133.0.6943.141
    Chromium: 137.0.7151.55
  npmPackages:
    @vitest/browser: ^3.0.0 => 3.2.0 
    vite: ^6.3.5 => 6.3.5 
    vitest: ^3.2.0 => 3.2.0 
    webdriverio: ^9.15.0 => 9.15.0

Used Package Manager

pnpm

Validations

NullVoxPopuli avatar Jun 02 '25 15:06 NullVoxPopuli

I saw this, #7940

but I do not think it's resolved (unless a version has not been released since that was closed)

The linked issue doesn't cover the Browser Mode (browser doesn't have process).

Stackblitz seems to no longer support firefox (138.0.3 (64-bit))? so I can't make a repro on stackblitz (I'm not logged in in chrome).

stackblitz doesn't support Browser Mode anyway

sheremet-va avatar Jun 02 '25 15:06 sheremet-va

On the same note, I think it is a good feature that Vitest fails if there is an unhandled error. Not every test runner supports this. But it would also be nice to be able to just debug with "pause on unhandled errors" in DevTools.

sheremet-va avatar Jun 02 '25 16:06 sheremet-va

yea, the way QUnit does this (my favorite browser test tool so far) is it allows you to toggle the test-framework's try/catch.

By default, it does what vitest does, where it captures the error the pretty displaying, etc. But there is UI to be like "don't do that" -- which then lets you use more of the browser's debug tooling.

This is the option that does it:

Image

NullVoxPopuli avatar Jun 02 '25 16:06 NullVoxPopuli