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

Allow to use global jest #320

Closed IegorShumov closed 8 months ago

IegorShumov commented 1 year ago
  1. In all my cases, no need to use jest through node, I have jest globally, so cmd can be - $ jest bla/bla.test.js.
  2. Jest-runner has setting jestrunner.projectPath. I defined it according to my path, eg c:/projects/prj1, path to some test - c:/projects/prj1/src/component1/container.test.js Why runner used node "node_modules/jest/bin/jest.js" "c:/projects/prj1/src/component1/container.test.js"? It can be just jest src/component1/container.test.js
domsleee commented 1 year ago

I think you can specify jestrunner.jestCommand as jest for this purpose?

You can see the default here is node "node_modules/jest/bin/jest.js", but the user can override it with jestCommand https://github.com/firsttris/vscode-jest-runner/blob/a03839fd49a0efc01d28131d7269a5406bc0cb93/src/jestRunnerConfig.ts#L11C1-L23C4

IegorShumov commented 1 year ago

I think you can specify jestrunner.jestCommand as jest for this purpose?

You can see the default here is node "node_modules/jest/bin/jest.js", but the user can override it with jestCommand https://github.com/firsttris/vscode-jest-runner/blob/a03839fd49a0efc01d28131d7269a5406bc0cb93/src/jestRunnerConfig.ts#L11C1-L23C4

Thanks, it works. What about path relative to jestrunner.projectPath or something similar?

PascalEmond commented 1 year ago

Thanks, this helped me to find how to use global jest to debug test :

        "jestrunner.debugOptions": {
            "program" : "${env:node_path}/jest/bin/jest.js"
        }
cdaringe commented 8 months ago

Solutions demonstrated with existing APIs