Closed andrewheumann closed 7 months ago
[updated]
To disable automatic focus shifting to the test-results tab, set "testing.openTesting": "neverOpen"
.
For a comprehensive understanding of focus behavior, especially why setting jest.outputConfig.revealWithFocus
to "none" (the default value) doesn't prevent the test-results tab from stealing focus, refer to jest.outputConfig. Adjusting "testing.openTesting"
to "neverOpen" resolves this issue, as detailed in the documentation.
I also noticed this upon updating VSCode to the most recent release.
Option 3 seems to make the most sense to me (from a user perspective). The option of whether to run it automatically or not shouldn't be linked to focusing the test results panel.
But happy with whatever decision the maintainers choose in the end.
It looks like I have made the issue more complicated than it is, sorry. I updated my earlier comment and provided a more straightforward answer there instead.
Please let me know if there are any other questions.
@v-msft, is setting "testing.openTesting": "neverOpen"
not working for you? You could set it in the user-level settings.json
, so you don't have to do this for every one of your VSCode workspaces.
Yeah, I know it's annoying. I wish we could make "neverOpen" the default value for "testing.openTesting"
, especially in auto-run scenarios. Unfortunately, the setting and the test results panel are part of the VSCode core, over which we have little control regarding their implementation. The VSCode team provided "testing.openTesting"
precisely to address different focus preferences.
That being said, I think we could consider showing a warning and an option to update the setting if the user consents. Do people think that would help reduce the pain?
I confirm that using "testing.openTesting": "neverOpen"
resolves this issue for me.
Just this past week after updating VS Code I also noticed this issue: every single time I ran any test (such as on any save) the terminal panel would open and the Testing tab would steal focus. That was new and unpleasant, such that I had to disable the automatic test runner completely.
Using "testing.openTesting": "neverOpen"
however just makes the tests run silently in the background which is exactly the behaviour I want.
Close this issue as there is a clear configuration solution mentioned above.
I tried setting it to "testing.openTesting": "openOnTestFailure"
and it still opens every time, instead of only on failures
I tried setting it to
"testing.openTesting": "openOnTestFailure"
and it still opens every time, instead of only on failures
I feel like this is a different bug from the original one. Maybe this should be raised as a different bug to mention that the setting is not working as expected?
@GeorgeWL I was able to repo your issue, but I think @hugoburguete is right, this is a different issue, it's actually a real bug. 😓 I will patch it shortly if you want to creat a new issue for it.
@GeorgeWL I was able to repo your issue, but I think @hugoburguete is right, this is a different issue, it's actually a real bug. 😓 I will patch it shortly if you want to creat a new issue for it.
I've done that now and referenced my earlier comment in that report
Environment
vscode-jest version
:6.2.0
node -v
:v20.9.0
npm -v
oryarn --version
:v10.1.0
npm ls jest
ornpm ls react-scripts
(if you haven’t ejected):Prerequisite
npm run test
ornode_modules/.bin/jest
)npm run test
Steps to Reproduce
Example Repo https://github.com/andrewheumann/jest-steals-focus
In this bare repository, on every file save, "Test Results" steals focus in the VS code panel. I want my terminal to stay front and center.
https://github.com/jest-community/vscode-jest/assets/31935763/fadb9b25-25e5-4e01-bd5d-eac31978b37e
In another repo, it's stealing focus on every git action.
Even if I explicitly close the
Test Results
panel tab, it re-opens itself on every file save or git action.