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

Use node_modules to find the project path #143

Closed cac04 closed 3 years ago

cac04 commented 3 years ago

If you have a monorepo containing multiple projects, you may still have the entire repo open as a single VS Code workspace. In that case, you may have multiple node_modules, jest.config.js, babel.config.js, etc. all within the same VS Code workspace.

Previously, this extension would find the correct jest.config.js but would then run jest from the top-level workspace folder, which would cause it to miss the correct babel.config.js (and possibly to miss the jest binary altogether, if it is not also present in a top-level node_modules).

This commit causes the extension to use the same logic to find the project path as it already uses to find the jest config. If there is no node_modules folder at the same level as the jest config, then it falls back to the previous behaviour of just using the VS Code workspace folder.

firsttris commented 3 years ago

thx! will test and report back

firsttris commented 3 years ago

i think you should look for the jest binrary in the node_modules folder