Closed stavalfi closed 3 years ago
@stavalfi I'll try to find some time this week to resolve this
So I did some preliminary debugging and noticed a couple of things on my end as well as your end:
How are you running the latest version of vscode-jest-runner? Are you installing it via marketplace or installing it from the source?
I get empty jest path (like yours) when I am debugging the source code of the extension but if I install it via marketplace, the path is no longer empty (but still fails due to unescaped $
in the jest path)
@alexkuc Thanks for looking at it.
I'm installing the extensson from the market place.
Additional Info:
node version: v14.15.4
yarn 2 version: 2.4.1
os: macos catalina 10.15.1 (19B2093)
vscode version:
Version: 1.56.2
Commit: 054a9295330880ed74ceaedda236253b4f39a335
Date: 2021-05-12T17:44:30.902Z (3 wks ago)
Electron: 12.0.4
Chrome: 89.0.4389.114
Node.js: 14.16.0
V8: 8.9.255.24-electron.0
OS: Darwin x64 19.0.0
@stavalfi does your coworker use different shell? if yes, could you try with that shell to narrow down the bug?
@alexkuc Ho sorry, I forgot to mention that.
I tested this bug on sh,bash,zsh,fish and they all has the first bug. Two of my coworkers uses zsh and I ensured that my self. I saw he had the first bug.
What else can I help?
@stavalfi so far to me, unfortunately, it is not clear what has changed or why it broke so I am still looking into this but due to my limited availability, the progress is slowly. Possibly on the weekends, I'll have more time.
@alexkuc Please update! Thank you!
Heyo! Just found this issue and I hope I can add some more information to help. The environment the code is running is Yarn 2 with PnP in a monorepo.
When I have 0.4.39 installed I am experiencing the following when running a test via the Run
code lens
I went and tried installing different versions of the extensions and 0.4.34 is latest version that works, so it might be the regression was introduced in 0.4.35.
I verified that both the Run
and Debug
code lens actions work in 0.4.34.
PS Thanks for this great extension!
If I had to guess it feels like it might be this
i changed something about the escaping of the filepath and also updated jest-editor-support to version 29.
can you re-check if that fixed your issue in 0.4.40
ah no it didn't.
but i have a yarn pnp project now and can check whats the issue.
hello i simplified the yarn pnp implementation by simply letting yarn always start jest: https://github.com/firsttris/vscode-jest-runner/commit/ff9a0270a480081319eb20196a7f862ce070be11
only downside its starts 2 debug processes, but apart of that it worked fine for me.
check version 0.4.43
This solution will break if you don't use latest Yarn version:
config.program = '.yarn/releases/yarn-berry.cjs';
If your Yarn points to another version, you will get fatal error file not found
okay, im will research for some more clever vscode debug configuration to do a "yarn jest".
To initialize yarn 2 pnp environment, you need to call .pnp.js
instead of anything else. If you want to avoid having to deal with bootstrap the yarn environment yourself, just do yarn <cmd>
as the documentation says:
use yarn node as interpreter instead of node. This will be enough to register the .pnp.cjs file as runtime dependency.
You can all yarn jest
as a simple shell command i.e. via process.exec()
hello i simplified the yarn pnp implementation by simply letting yarn always start jest: ff9a027
only downside its starts 2 debug processes, but apart of that it worked fine for me.
check version 0.4.43
Thanks @firsttris!
I can confirm that it's working with bash as a default shell, latest yarn stable version: 2.4.2
, node v14.15.4
and jest-runner 0.4.44
.
Also, as you saw, there are 2 debug processes.
thats because 1.) node is starting yarn and 2.) yarn is starting jest
also found other options for the debug config.
type = 'node-terminal' command = 'yarn jest'
but this opens 3 prozesses
1.) user/bin/yarn 2.) starts yarn2 3) starts jest
if you find a better vscode debug config (for yarn pnp with jest) let me know and we change it asap.
best regards tristan
the best solution would be if i could directly start yarn from vscode debug config, not node.
is there any way to add e2e test for yarn2? I never developed any plugin to vscode so im clueless about the possibilities for tests.
maybe yarn2 test case is completely not doable or not worth it. wdyt?
i have no clue what "e2e test for yarn2" means.
i use jest for compenent testing and unit testing, and cypress for FE-integration and e2e testing.
@firsttris I checked in 0.4.44 and the tests run. Love it! Thanks
@firsttris first of all, thank you for fixing this bug! my team productivity is much higher!!
on other topic, I was thinking if there is a way to create a test case such that it involves yarn2 project (because of 2 regressions in the last 2 months). if it's too hard or not worth it, let's leave it.
@stavalfi I just want to make it clear... I did not fix the bug. I just poked around and made a guess. @firsttris is the one responsible.
That was a big typo mistake! I meanted to mention @firsttris in the first place. Thanks for notifing me!
@firsttris Sorry!
bug with 0.4.39:
it seems that node interpeter is opened instead of running jest. I assume it is caused due to the fact the "jest" path is missing in the command.
bug with with version 0.4.34 (and 0.4.33): (when running "run" it's working, when running with debug - it's broken):
@alexkuc it will be very appriciated if you can take a quick look!