vitest
vitest copied to clipboard
Unable to debug Vitest test in the browser or webstorm
Describe the bug
It's almost impossible to write unit tests been able to debug.
I already failed in webstorm: https://youtrack.jetbrains.com/issue/WEB-56836/Vitest-debugging
And failed in the browser? I tried node --inspect ./node_modules/vitest/vitest.mjs
If I try the above and have brave://inspect/#devices open the test runs but no breakpoints (via debugger statement) are hit.
I can't find any tutorials on this either
Reproduction
This issue can also be found in a new vite react project: https://github.com/quantuminformation/vite-project:
System Info
System:
OS: macOS 12.5
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Memory: 43.16 MB / 16.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.13.2 - ~/.nvm/versions/node/v16.13.2/bin/node
Yarn: 1.19.2 - /usr/local/bin/yarn
npm: 8.1.2 - ~/.nvm/versions/node/v16.13.2/bin/npm
Browsers:
Brave Browser: 103.1.41.100
Firefox: 103.0.1
Safari: 15.6
npmPackages:
@vitejs/plugin-react: ^2.0.0 => 2.0.0
vite: ^3.0.0 => 3.0.3
vitest: ^0.16.0 => 0.16.0
Used Package Manager
npm
Validations
- [X] Follow our Code of Conduct
- [X] Read the Contributing Guidelines.
- [X] Read the docs.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- [X] The provided reproduction is a minimal reproducible example of the bug.