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
265 stars 124 forks source link

Fix path for yarn 2 release file #197

Closed RobTheFiveNine closed 3 years ago

RobTheFiveNine commented 3 years ago

When clicking Debug in a test suite of a project that is using yarn 2 PNP, the extension currently fails to launch the debug process as it is attempting to launch yarn using the path .yarn/releases/yarn-*.cjs. The release file that yarn creates, however, uses the pattern yarn-*.js, as can be seen below:

▶ ls -lah .yarn/releases 
total 1.6M
drwxrwxr-x 2 rob rob 4.0K Jun 22 21:37 .
drwxrwxr-x 7 rob rob 4.0K Jun 22 21:37 ..
-rwxrwxr-x 1 rob rob 1.6M Jun 22 21:37 yarn-berry.js

This pull request changes the path to be inline with the file extension that yarn creates the release file with, which fixes launching debug sessions.

firsttris commented 3 years ago

hey,

why is my release file .cjs?

image

can we make it work for both?

maybe

'.yarn/releases/yarn-*.*'

would that work?

RobTheFiveNine commented 3 years ago

That's odd - I've not seen that format before. I'll push the change momentarily to make it work for both.

How did you initialise your project? (Asking more for my own reference / curiosity, as mine has always been named yarn-berry.js rather than a version number).

When I'm setting up v2, I run yarn set version berry

RobTheFiveNine commented 3 years ago

I've changed the pattern to be .yarn/releases/yarn-*.*js as this will match both .js and .cjs, but won't pickup any extensions which don't end in "js". There shouldn't ever be any other files in the releases folder, to my knowledge, but I thought it may be best to keep the pattern as specific as can be, just in case that does change in the future

firsttris commented 3 years ago

thx!