Closed ThisIsMissEm closed 1 year ago
I tried your repo, and yes, I see the extension started (because it found the jest binary in the node_modules). There is no error, it just says, no tests found...
Do you plan to use jest for this project? If not, you can simply disable the extension. If you do plan to use jest later and you don't want the terminal to pop up until you have some tests, you can use jest.autoRun "off"
to stop the automatic watch run.
Let me know if this didn't resolve your issue.
I think I just ended up changing my editor to always have jest.autoRun
off, maybe I'll enable it on a project basis.
In my opinion I believe that would be the best approach since you will be certain that you intent to use jest for that project. @connectdotz Am curious though if we can explore a possibility of looking into the package.json file to establish if a project uses jest and we auto run jest base on that.
What about looking for a jest.config. or jest.setup. file? Usually those are present in jest projects. Though I guess you could also scan the package.json scripts for mentions of "jest" as a word
Even though the presence of these "triggers", including the jest binary, indicates the intention of using jest, without them does not exclude a project from using jest. I will not be surprised to see false-negative complaints if we start to tighten the activation conditions as suggested.
To make a long story short, it's hard to get right all the time for all the use cases, and that's why there are customization settings. Hopefully, as you have discovered, the customization is pretty straightforward.
Environment
vscode-jest version
: v5.2.3node -v
: v16.18.1npm -v
oryarn --version
: 8.19.2 (npm)npm ls jest
ornpm ls react-scripts
(if you haven’t ejected):Prerequisite
npm run test
ornode_modules/.bin/jest
) n/aSteps to Reproduce
We have a repository where Jest is a dependent, but not actually used for tests (it's a peer-dep for some ESLint Configuration), the vscode-jest plugin automatically runs on this repository, despite it actually having no tests (at present).
You can see this in https://github.com/inrupt/typescript-sdk-tools, just cloning and doing an
npm ci --ignore-scripts
should be enough to reproduce when opening in vscode — it incorrectly detects just as being present for tests, when it's actually not used for tests.Relevant Debug Info
n/a
Expected Behavior
vscode-jest isn't enabled for the project / does not autorun.
Actual Behavior
vscode-jest autoruns and changes the focus of the terminal to it's output, despite the project having zero tests.
The fastest (and the most fun) way to resolve the issue is to submit a pull-request yourself. If you are interested, feel free to check out the contribution guide, we look forward to seeing your PR...