vitest-dev / vitest

Next generation testing framework powered by Vite.

Home Page:https://vitest.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unhandled uncaught error fails test run, no stack trace present

Kanishk-Anand opened this issue · comments

Describe the bug

Vitest fails with a error message of Vitest caught X unhandled errors during the test run. but there is no meaningful error trace. Moreover, the test run failure in intermittent. It passes if the test suite is triggered multiple times. We do have error handling in most of the cases, but the chance where there isn't, Vitest should atleast be able to pinpoint to the problematic test case(s).

Attaching the screenshot of the error.

Screenshot 2024-05-09 at 8 16 44 PM

Reproduction

There is no definitive way to reproduce the issue, since, vitest itself isn't consistent in the report. It often fails, but then succeeds when ran multiple times. It causes unnecessary dev effort to check whether there is a meaningful test failure or this "unhandled errors" getting reported.

System Info

System:
    OS: macOS 14.0
    CPU: (10) arm64 Apple M1 Pro
    Memory: 80.78 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.18.0 - ~/.nvm/versions/node/v18.18.0/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 9.8.1 - ~/.nvm/versions/node/v18.18.0/bin/npm
  Browsers:
    Brave Browser: 122.1.63.174
    Chrome: 124.0.6367.119
    Safari: 17.0
  npmPackages:
    @vitejs/plugin-react: ~4.0.0 => 4.0.4
    @vitest/coverage-v8: ^0.32.0 => 0.32.0
    @vitest/ui: ~0.32.0 => 0.32.4
    vite: ~4.3.9 => 4.3.9
    vitest: ~0.32.0 => 0.32.4

Used Package Manager

npm

Validations

Please, try the latest version first. 0.32.4 is quite old, and the error from your stack trace was already fixed.

Hello @Kanishk-Anand. Please provide a minimal reproduction using a GitHub repository or StackBlitz (you can also use examples). Issues marked with needs reproduction will be closed if they have no activity within 3 days.