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

Run and Debug icon (typically displayed above the test) disappears when using describe.each #137

Closed curt3105 closed 3 years ago

curt3105 commented 3 years ago

Hi I love using Jest Runner! We noticed an issue recently when writing tests with jest. Typically, there is a link/icon above each test. As you already know the link is for running and debug specific tests. When you add a describe.each test within the scope of the outer describe, the link above tests disappears. If you remove the describe.each the links reappear above the tests. The describe.each tests seem to interfere with the link. Thanks!

firsttris commented 3 years ago

hey @curt3105,

i think we need to update jest-editor-support to the latest version to enable this feature

https://github.com/firsttris/vscode-jest-runner/issues/55

curt3105 commented 3 years ago

Sounds good, is that something I need to do on my end? Sorry I am still a little naive with this. Thanks

curt3105 commented 3 years ago

Okay, I think I understand what you are saying now, it looks like in the https://github.com/firsttris/vscode-jest-runner/blob/master/package.json the jest-editor-support": "^27.2.0. What do we need to do to get that updated? @firsttris

firsttris commented 3 years ago

we need to increase it to the latest version https://github.com/jest-community/jest-editor-support/blob/master/package.json#L3

and maybe we also need to adjust this method: https://github.com/firsttris/vscode-jest-runner/blob/master/src/util.ts#L13

firsttris commented 3 years ago

you can clone the repo

update the version

npm install Go to Menu "Run" => "Start Debugging" open your project with the new vscode instance just open

verify everything is working as you expect it.

report back

bottlezz commented 3 years ago

I have tried updated the package, it generally, work fine, however , there are some issues. For a table case with image this would generate two test cases, the first test, test name would be "testId : 1 , testName : test1" however the test name jest-editor-support generates is "testId : \$id , testName : \$testName". and this will match no test case. As a result, for interpolated string test name, the solution would fail. A solution i have in mind is to replace $var with regexp (.*), but a evaluation to identify string interpolation on the test name would be involved for every test cases, not sure if that would be desirable.

firsttris commented 3 years ago

hey @bottlezz i think that should be fine.

don't hesitate to create a PR.

gregoryzh commented 3 years ago

@firsttris Hi, I have created a PR to resolve the naming string interpolation, please take a look https://github.com/firsttris/vscode-jest-runner/pull/148

firsttris commented 3 years ago

can this issue be closed now ? since #148 is merged.