Closed sgranade closed 4 years ago
I'm guessing it is due to TypeStrong/ts-node#1055 for which they already have a fix, but it hasn't been published yet.
In the meantime you could try adding "mochaExplorer.monkeyPatch": false
to your settings: this will switch to a more primitive mechanism for detecting the test locations. The standard mechanism uses stack traces to find the locations and those stack traces seem to have wrong line numbers due to the ts-node bug.
The issue was fixed in ts-node 8.10.2.
Just want to note that this issue also happens in later versions (mine is 9.1.1) if you happen to be using the ts-node/esm
loader.
Setting "mochaExplorer.monkeyPatch": false
still serves as a workaround in this case.
I got this issue too but it is linked to the my node.js version
node.js : v18.18.2 -> v20.13.1
the problem appears with v20 (maybe ts-node/esm acts differently depending on the node.js version)
I use ts-node 10.9.2
As previously noted "mochaExplorer.monkeyPatch": false
may serve as workaround.
I recently upgraded
ts-node
from 8.9.1 to 8.10.0 in my project. When I did that, CodeLens started putting the run commands in the entirely wrong places.With
ts-node
8.9.1, the CodeLens run locations are correct:However, if I upgrade
ts-node
to 8.10.0 or 8.10.1, then the CodeLens run locations are wrong.The tests appear to run correctly, but I can't tell what CodeLens "run" command goes with which test, and test failures are attached to the entirely wrong line.
Any idea what might be going on?