Vscode-jest: "Starting Jest in Watch mode failed too many times" helper is not very helpful

Created on 2 Jan 2020  路  5Comments  路  Source: jest-community/vscode-jest

Environment

  1. node -v: 12.9.1
  2. yarn -v: 1.21.1
  3. npm ls jest or npm ls react-scripts (if you haven鈥檛 ejected): [email protected]
  4. your vscode-jest settings if customized:

    • jest.pathToJest? yarn test
  5. Operating system: macOS 10.15.2

Prerequisite

  • are you able to run jest test from command line? yes
  • how do you run your tests from command line? (for example: npm run test or node_modules/.bin/jest) yarn test

Steps to Reproduce

  • create a workspace with multiple folders
  • add a folder (folder-1) without any test, in package.json add a test script with --passWithNoTests, vscode-jest will still consider jest failed.
  • add another folder (folder-2) without any test, in package.json, add a test script with "test": echo "no test yet"

Relevant Debug Info

from folder-1 output channel:

Done in 0.93s.

Starting Jest in Watch mode failed too many times and has been stopped.
Consider add this workspace folder to disabledWorkspaceFolders
 see troubleshooting: https://github.com/jest-community/vscode-jest/blob/master/README.md#troubleshooting

from folder-2 output channel:

yarn run v1.21.1

$ echo 'test not yet implemented' --testLocationInResults --json --useStderr --outputFile /var/folders/vg/yw9mltwd1mj_29xbvhwywc980000gn/T/jest_runner_core.json --watch --no-coverage --no-color --reporters default --reporters /Users/xxx/.vscode/extensions/orta.vscode-jest-3.1.0/out/reporter.js

test not yet implemented --testLocationInResults --json --useStderr --outputFile /var/folders/vg/yw9mltwd1mj_29xbvhwywc980000gn/T/jest_runner_core.json --watch --no-coverage --no-color --reporters default --reporters /Users/xxx/.vscode/extensions/orta.vscode-jest-3.1.0/out/reporter.js

Done in 0.06s.

Starting Jest in Watch mode failed too many times and has been stopped.
Consider add this workspace folder to disabledWorkspaceFolders
 see troubleshooting: https://github.com/jest-community/vscode-jest/blob/master/README.md#troubleshooting

Expected Behavior

  • folder-1 output channel has wiped out the actual command executed
  • it should not report jest test failure
  • if it must, at least show which folder is failed in the helper popup
  • our troubleshooting section should be revamped to provide better self-help instructions...

Actual Behavior

right now all failures in a workspace env suggest users to "disableWorkspaceFolders", which is not always helpful


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...

Most helpful comment

you could also, as a work around, modify pathToJest to source which version of node first

// in your workspace setting
"jest.pathToJest": "PATH=/Path/to/your/Node/bin/:$PATH yarn test"

All 5 comments

+1
Yep, without the folder name in which it failed, it's quite hard to detect which folder has a problem in a workspace with multiple projects

I had the same issue, and my problem ended up being that I was using nvm, so the plugin couldn't find node.

My solution ended up being installing node using one of the recommended installers.

I also have a workspace with multiple projects, and running VSCODE from within the project folder, in which my test folder is found, all works fine. However, if I open VSCODE at the workspace folder level the test explorer fails to find the tests in the project contained in my project's sub-folder.

you could also, as a work around, modify pathToJest to source which version of node first

// in your workspace setting
"jest.pathToJest": "PATH=/Path/to/your/Node/bin/:$PATH yarn test"

I'm having the same problem, but without the disabledWorkspaceFolder description:

Test Suites: 44 passed, 44 total
Tests: 79 passed, 79 total
Snapshots: 14 passed, 14 total
Time: 22.442s
Ran all test suites.

Starting Jest in Watch mode failed too many times and has been stopped.
see troubleshooting: https://github.com/jest-community/vscode-jest/blob/master/README.md#troubleshooting

Can anyone recommend any troubleshooting for that?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ryanlittle picture ryanlittle  路  3Comments

RehanSaeed picture RehanSaeed  路  5Comments

FDiskas picture FDiskas  路  3Comments

radfahrer picture radfahrer  路  3Comments

DaniGTA picture DaniGTA  路  3Comments