firsttris / vscode-jest-runner

Simple way to run or debug one or more tests from context menu, codelens or command plalette
https://marketplace.visualstudio.com/items?itemName=firsttris.vscode-jest-runner
MIT License
264 stars 124 forks source link

Debugger does not stop at breakpoint #285

Closed jpilgrim closed 1 year ago

jpilgrim commented 1 year ago

I debug my tests by simple running "debug" via the code lens or the debug-icon in the test overview. I have no launch configuration. My project uses TypeScript, and I use ts-jest. So no code is compiled upfront.

When I set a breakpoint, I expect the debugger to stop at the given line. And this works -- usually. However, in some projects, after a while this stops working. That is, instead of stopping at the breakpoint, the debugger stops somewhere in the file. Actually, not in the original source code file, but the virtual compilation output. In other cases, the debugger doesn't stop at all. So something seems to get odd with the source maps.

I would add a project for reproducing that error, unfortunately it is not that easy to reproduce. I copied a project with that bug -- and in the copy everything worked. However, this does not seem to be a super exotic issue. Actually I'm teaching a TypeScript class, and this happens on several student machines (Mac, Linux, Windows) as well. Sometimes, restarting VSCode helps. Uninstalling the Jest-Extension does not help though.

Is there anything the Jest extension caches somewhere? This would help to make this problem reproducible (or find a work around). Or does ts-jest cache anything?

What can I do to improve the error description? Is there a log somewhere?

jpilgrim commented 1 year ago

I close this issue. It seems that vscode-jest has the same problem. Hence I assume that it is neither a jest-runner nor a vscode-jest problem, but something else. I 'solved' the issue by removing VSCode's settings folder (on macos in ~/Library/Application Support/Code. I assume that some Typescript component caches some data there which becomes corrupt.