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

jest-runner started adding `-c '/home/Dev/monitoring/projects/main-frame/package.json'` #273

Closed karlosos closed 1 year ago

karlosos commented 1 year ago

Recently while running the test jest-runners adds additional argument to the command:

`-c '/home/Dev/monitoring/projects/main-frame/package.json'`

which causes the error. I am using monorepo with lerna and yarn workspaces. main-frame is one of the projects.

Up to this date, everything was working fine. The only required change was to jestCommand:

    "jestrunner.jestCommand": "yarn test:main-frame -- --",

This command is starting the tests in proper project.

Now I get:

yarn test:main-frame -- -- '/home/Dev/monitoring/projects/main-frame/src/features/__tests__/SampleTest.test.tsx' -c '/home/Dev/monitoring/projects/main-frame/package.json' -t 'Test name'

instead of:

yarn test:main-frame -- -- '/home/Dev/monitoring/projects/main-frame/src/features/__tests__/SampleTest.test.tsx' -t 'Test name'

How to remove this:

-c '/home/Dev/monitoring/projects/main-frame/package.json'

from the generated command?

karlosos commented 1 year ago

I see it was mentioned here https://github.com/firsttris/vscode-jest-runner/issues/209 and the rootcause is recent merge request: https://github.com/firsttris/vscode-jest-runner/pull/270 which introduced using package.json for jest config.

firsttris commented 1 year ago

hey @karlosos

are you sure you are on the latest version, there have been multiple MR that inroduced this feature, the first didnt work.

im also tested it in a yarn workspaces mono repo, and it dont get the -c 'path...'

can you verify ?

firsttris commented 1 year ago

i can revert this MR if we are sure it causes this issue.

firsttris commented 1 year ago

reverted this MR

karlosos commented 1 year ago

Thank you for your quick action! After updating the extension to v0.4.57 everything works fine now!