vscode-jest icon indicating copy to clipboard operation
vscode-jest copied to clipboard

"Run jest" file context menu item

Open hornta opened this issue 6 years ago • 7 comments

I would like a right click on file option "Run jest"somewhere in this menu.

image

hornta avatar Oct 11 '19 21:10 hornta

in a normal situation, jest is run in watch mode, i.e. it will run your tests automatically (when something related changed). Can you elaborate on the use case that you prefer to trigger it manually?

connectdotz avatar Nov 21 '19 05:11 connectdotz

In our multi-root workspace / large codebase setup, it's overwhelming to watch all tests all of the time. We prefer to re-run tests as needed. Generally speaking, our workflow is:

  1. Do a bunch of work
  2. Write the test
  3. Do a bunch of other work
  4. Maybe add more tests to the file

In those middle steps, it's distracting to have tests rerunning, when we're just periodically saving work and aren't ready to re-run tests yet. Therefore, it would be really convenient to add context menu items / inline buttons to run tests at the file/describe level

benasher44 avatar Jun 10 '21 21:06 benasher44

FWIW, this is probably the main feature keeping us from switching away from https://github.com/firsttris/vscode-jest-runner (provides debug options for describe, in addition to each it/test)

benasher44 avatar Jun 10 '21 21:06 benasher44

hi, the new v4 release does come with a context menu you can use to trigger the test run on-demand:

Screen Shot 2021-06-13 at 9 39 45 PM

Here is the instruction on how to set up your env for the interactive mode: https://github.com/jest-community/vscode-jest#how-to-trigger-the-test-run (click expand the "interactive mode"). Let me know if you have any issues using it.

connectdotz avatar Jun 14 '21 01:06 connectdotz

Oh great, thanks! Will give that a try

benasher44 avatar Jun 14 '21 02:06 benasher44

Do you think something like #288 is in the cards to better surface this (when file is wrapped in a describe)?

benasher44 avatar Jun 14 '21 04:06 benasher44

Yeah it's quite doable, we might do this as part of supporting the official vscode test explore, which hopefully will become available in a couple of months...

connectdotz avatar Jun 14 '21 04:06 connectdotz