Closed stavalfi closed 3 years ago
have you activated the following options for yarn 2 pnp in vscode settings ?
| jestrunner.enableYarnPnpSupport | Enable if you are using Yarn 2 with Plug'n'Play | | jestrunner.detectYarnPnpJestBin | Auto-detect path on Linux/Unix systems to Jest bin (Yarn 2 Pnp) |
after settings them:
it seems broken:
p/another-nodejs-test-runner (main) $ node --require '/Users/stavalfi/projects/another-nodejs-test-runner/.pnp.js' "`yarn bin jest`" '/Users/stavalfi/projects/another-ndejs-test-runner/packages/another-nodejs-test-runner/__tests__/test1.spec.ts' -t 'test1'
/Users/stavalfi/projects/another-nodejs-test-runner/.pnp.js:15100
throw firstError;
^
Error: Qualified path resolution failed - none of the candidates can be found on the disk.
Source path: /Users/stavalfi/projects/another-nodejs-test-runner/`yarn bin jest`
Rejected candidate: /Users/stavalfi/projects/another-nodejs-test-runner/`yarn bin jest`
Rejected candidate: /Users/stavalfi/projects/another-nodejs-test-runner/`yarn bin jest`.js
Rejected candidate: /Users/stavalfi/projects/another-nodejs-test-runner/`yarn bin jest`.json
Rejected candidate: /Users/stavalfi/projects/another-nodejs-test-runner/`yarn bin jest`.node
at internalTools_makeError (/Users/stavalfi/projects/another-nodejs-test-runner/.pnp.js:14844:34)
at resolveUnqualified (/Users/stavalfi/projects/another-nodejs-test-runner/.pnp.js:15883:13)
at resolveRequest (/Users/stavalfi/projects/another-nodejs-test-runner/.pnp.js:15907:14)
at Object.resolveRequest (/Users/stavalfi/projects/another-nodejs-test-runner/.pnp.js:15979:26)
at Function.external_module_.Module._resolveFilename (/Users/stavalfi/projects/another-nodejs-test-runner/.pnp.js:15077:34)
at Function.external_module_.Module._load (/Users/stavalfi/projects/another-nodejs-test-runner/.pnp.js:14942:48)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47
when I try to run: "echo /Users/stavalfi/projects/another-nodejs-test-runner/yarn bin jest
":
/Users/stavalfi/projects/another-nodejs-test-runner//Users/stavalfi/projects/era-ci/node_modules/.bin/jest
it took me some time to find the actual bug:
for some reason, this extension changes the folder names:
look:
node --require '/Users/stavalfi/projects/another-nodejs-test-runner/.pnp.js' "`yarn bin jest`" '/Users/stavalfi/projects/another-ndejs-test-runner/packages/another-nodejs-test-runner/__tests__/test1.spec.ts' -t 'test1'
look closer:
/Users/stavalfi/projects/another-nodejs-test-runner/.pnp.js
/Users/stavalfi/projects/another-ndejs-test-runner/packages/another-nodejs-test-runner/__tests__/test1.spec.ts
the change:
another-nodejs-test-runner/
another-ndejs-test-runner
weird...
When changing the project name to something else ("another-test-runner"), this bug was reproduced on the "packages" word: "packages" -> "pacages"
more info:
I'm using fish as the default terminal in Vscode.
--
When changing to zsh, it's working. you should add it to the docs as the supported terminals.
also using fish btw :+1:
we are changing directory to workspace root.
means
vscode.workspace.getConfiguration().get('jestrunner.projectPath') || vscode.workspace.getWorkspaceFolder(editor.document.uri).uri.fsPath;
why does it do that?
https://github.com/firsttris/vscode-jest-runner/blob/master/src/jestRunner.ts#L49
you can try to reproduce it: https://github.com/stavalfi/another-nodejs-test-runner
install your extention and: (with nodejs v14.16.0 (yarn2 is having hard time with node15))
yarn
yarn dlx @yarnpkg/pnpify --sdk
yarn
try to run a test with fish as a default terminal in vscode.
works like a charm ;)
in version 34 is now also an option to disable changing directory to workspace root
a wait on this computer i have not installed fish... will test tomorrow on my main computer
with fish shell:
with bash:
some other tests:
do you know whats the problem with the command for fish shell? i don't see any path problems on my side.
not sure. but at least something is reproducable at your machine.
i think the way we concat the command together is not compatibel for fish.
@alexkuc
The issue here is the use of backticks. Fish does not support backticks (docs). This needs to use subshell instead of backticks:
Unfortunately, when writing the PR I wasn't too familiar with VSCode and couldn't get it to stop escaping the dollar sign, e.g. $(subshell)
.
@stavalfi @firsttris https://github.com/firsttris/vscode-jest-runner/pull/158
Thanks @alexkuc !
Using yarn 2.4.0 without node_modules, this plugin fails to start a debugger.
logs from vscode: