Questions & Answers

Completely disable auto run of Jest test runner in Visual Studio Code editor

I have some sets of Jest test cases that run Puppeteer browser tests.

I have tried these test runners

To me, I like Jest Test Explorer the most but it always auto-start running test cases. As you can imagine, a lot of Chrome browser instances get launched when I open a project with VS Code.

I found some configurations but they cannot prevent auto-run test cases.

  • "testExplorer.onStart": "reset", or set to null
  • "testExplorer.onReload": "reset", or set to null

FYI, an example UI of Jest Test Explorer enter image description here

Jest (vscode-jest) is a good runner but I can't stop auto-run with these settings as well.

  • "jest.runAllTestsFirst": false,
  • "jest.autoEnable": false,
  • "jest.showCoverageOnLoad": false

Therefore, right now Jest Runner (vscode-jest-runner) is the only runner that does not auto-start unit tests.

In addition, if you have any other test runners to suggest, please let me know.

Thank you so much.

2023-01-11 09:15:44
You're not the only one with this problem! I'm so annoyed by Tridactyl's WebDriverIO tests launching every time I open VScode, and for the life of me, I cannot figure out how to make them stop. ;_;
2023-01-11 09:15:44
Hi @ELLIOTTCABLE. Until now, I still don't know how to fix it. ^^
Answers(8) :

First open the jest extension settings.json in the vs code. In the json script add "jest.autoRun": "off" to disable test autorun. Below, I add other options as well.
Source: Documentation

  • fully manual there will be no automatic test run, users will trigger test run by either command or context-menu. Example: "jest.autoRun": "off"
  • automatically run tests when test file changed the extension will trigger test run for the given test file upon save. Example: "jest.autoRun": {"watch": false, "onSave": "test-file"}
  • automatically run tests when either test or source file changed: the extension will trigger test run for the given test or source file upon save. Example: "jest.autoRun": {"watch": false, "onSave": "test-src-file"}

There's some great updated docs here

Migration rule from settings prior to v4:

if "jest.autoEnabled" = false => manual mode: "jest.autoRun": "off"

if "jest.runAllTestsFirst" = false => "jest.autoRun": {"watch": true }

if no customization of the 2 settings and no "jest.autoRun" found =>

I made it work by only setting the setting "jest.autoEnable": false, on my settings.json and restarting VSCode. At least, it is working until now and it hasn't broken yet: Disable starting Jest automatically

To open your settings.json:

  1. Press Ctrl+Shift+P
  2. Then type Preferences: Open Settings (JSON)
2023-01-11 09:15:44
Thank you so much. I will try and give a feedback.
2023-01-11 09:15:44
Thanks! I also had to restart my vscode session to make this change apply.

Go to vscode setting.json

You can either add

"jest.autoRun": "off"


"jest.autoRun": false

both are valid options. You can checkout the official recommended settings here.

"jest.autoEnable": false

is deprecated.

I just set this simple option into the VS Code's settings.json:

"jest.autoRun": "false"
2023-01-11 09:15:44
This is the best answer; states autoEnable should instead use autoRun.
2023-01-11 09:15:44
This is the only thing that worked for me
2023-01-11 09:15:44
I believe this has changed in a recent update. I now get the following error invalid autoRun setting "false". Will use default setting instead I'm now using the setting "jest.autoRun": { "watch": false } instead

For orta.vscode-jest extension, I added the configuration below in settings.json. You can open settings.json by doing Command + Shift + P (Ctrl + Shift + P on Windows), typing settings JSON and selecting Preferences: Open Settings (JSON).

"jest.autoRun": {
    "onStartup": []

Or you can simply add:

"jest.autoRun": {}

If you want to run all tests on startup, add all-tests to the onStartup array:

"jest.autoRun": {
    "onStartup": ["all-tests"]
2023-01-11 09:15:45
Thank you. Command + Shift + P -> typing SETTINGS.JSON -> Preferences: Open Workspace settings ( JSON ). And add "jest.autoRun": {} Otherwise it will open settings.json file in read only mode.

What it worked for me was:

File -> preferences -> settings. Then under the panel user (in workspace is as well but I am not sure if you need to modify it there as well), go to extensions -> jest.

There you will have a section jest: auto run and you will find a link "edit in settings.json" and modify what is there for this

"jest.autoRun": { "watch": false }

At the time of writing (Dec 22) the new way to do this (as per is to have the following in the VS Code settings.json. Note I had previously tried the other answers but none worked.

  "jest.autoRun": { "watch": false }