jest-community / vscode-jest

The optimal flow for Jest based testing in VS Code
MIT License
2.84k stars 295 forks source link

I cannot turn autoRun off #993

Closed Inspirateur closed 1 year ago

Inspirateur commented 1 year ago

Environment

  1. vscode-jest version: 5.1.0

  2. node -v: 18.12.1

  3. npm -v: 9.1.2

  4. npm ls jest: backend@1.0.0 D:\Documents\Repos\service-desk\backend ├── jest@27.5.1 └─┬ ts-jest@27.1.5 └── jest@27.5.1 deduped

  5. your vscode-jest settings if customized:

    • jest.autoRun: "off"
  6. Operating system: Windows 10

Prerequisite

Steps to Reproduce

Sorry I don't have time yet to recreate a repo with the same config.

Expected Behavior

Jest should not run on vs code startup nor should it run on save.

Actual Behavior

It does.

connectdotz commented 1 year ago

The jest.autoRun setting should stop jest from automatically running. However, the extension might still try to examine your env to find the jest commands and parse the test files to put the run/debug menu for each test...

Are you seeing the jest terminal reporting something? Just curious, how do you know the tests are running? If this is related to the jest terminal, please try v5.2.0 pre-release, which will only reveal when tests are run.

NuclleaR commented 1 year ago

Is this related?

console is empty but something is running tests. it happens only when extension enabled

sorry for video from phone IDK how to unblock os notification when screen recorders take video.

https://user-images.githubusercontent.com/6917580/214128335-37a81e10-7c98-46ab-9dea-42f0412e49ca.MOV

connectdotz commented 1 year ago

@NuclleaR thanks for the video, a few questions/comments:

ciriousjoker commented 1 year ago

@connectdotz This terminal automatically opens whenever I launch the project:

Bildschirm­foto 2023-01-28 um 22 31 21

Here's the settings.json:

"jest.autoRun": {
  "watch": false,
  "onStartup": []
}

I also tried: "jest.autoRun": "off".

Here's the jest status:

Bildschirm­foto 2023-01-28 um 22 34 14

This is the extension output:

Bildschirm­foto 2023-01-28 um 22 35 16

(debugMode is true for all of these screenshots)

connectdotz commented 1 year ago

@ciriousjoker thanks for the info. The status bar "..." means no test has been run. The terminal issue has been fixed in v5.2 (#976), once you upgrade to the latest (v5.2.2), the terminal should only be shown when tests are run.

ciriousjoker commented 1 year ago

Works perfectly, thanks!

Johann01 commented 1 year ago

Definitly not the case, it still opens a terminal, when opening a new run vscode project with jest and npm install has not run yet. (To install dotenv)

Screenshot 2023-02-01 at 14 49 51
connectdotz commented 1 year ago

@Johann01 If there is a "fatal error" when the extension setting up your test env, the terminal will be revealed. This does not mean the tests are run, which is what jest.autoRun controls.

Maybe the jest.autoRun is easily confused with "auto running the extension"? Maybe we should rename it to jest.autoTestRun?

See more explanation about the difference between test run vs. extension run: comment