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

Add explorer menus to run and debug tests with jest #149

Closed lvoliveira closed 3 years ago

lvoliveira commented 3 years ago

Add explorer context menus for running tests under a folder

Captura de tela de 2021-03-31 11-35-02

Also works in files

Captura de tela de 2021-03-31 11-36-07

lvoliveira commented 3 years ago

Resolves #150

firsttris commented 3 years ago

pretty cool :rocket:

firsttris commented 3 years ago

i tested

currently the explorer menu is shown no matter which file im going to click

it would be cleaner if the menu where only shown if the files are actual test/spec files.

i researched and this should be possible:

https://stackoverflow.com/questions/52382136/can-a-vscode-extension-create-an-explorer-context-menu-for-a-specific-file

lvoliveira commented 3 years ago

@firsttris I was thinking about that too. I'll try to modify it.

My only concern is with the test file pattern that should be used.

I'll check if there is a way to make it configurable on the extension. What do you think?

firsttris commented 3 years ago

configurable:

i think you could simlpy use jestrunner.codeLensSelector from config.

jestrunner.codeLensSelector | CodeLens will be shown on files matching this pattern (default */.{test,spec}.{js,jsx,ts,tsx})

firsttris commented 3 years ago

maybe we should rename that config option to "testFilePattern" then...?

lvoliveira commented 3 years ago

jestrunner.codeLensSelector | CodeLens will be shown on files matching this pattern (default */.{test,spec}.{js,jsx,ts,tsx})

I couldn't find a way to make it work with a regex coming from a config entry. The options will be shown on folders and on files matching this pattern. I think that will cover most use cases.

People can still open the file on the editor and use the menus from that context to run all tests on a file. Since they don't have any match filters they will be shown on any file

lvoliveira commented 3 years ago

I think this is ready. @firsttris please let me know if there is anything else I need to do.

firsttris commented 3 years ago

@lvoliveira good work, thx!

firsttris commented 3 years ago

@lvoliveira

currently for me it does not show any explorer/context items.

image

do you know why that is?

did something broke by merging it?

can you check?

lvoliveira commented 3 years ago

@firsttris Look like this commit removed the explorer menu options from the package.json file. I already created a new PR fixing it #184.