vscode-jest icon indicating copy to clipboard operation
vscode-jest copied to clipboard

Error: This promise must be present when running with -o

Open drpicox opened this issue 8 years ago • 8 comments
trafficstars

Environment

  1. node -v: v8.1.0 or v6.10.2

  2. npm -v: 5.0.3 or v5.4.1

  3. npm ls react-scripts (if you haven’t ejected): (empty)

  4. Operating system: MacOS Sierra 10.12.6

  5. Jest version: v21.1.0

  6. vscode-jest version: 2.3.0

Steps to Reproduce

  • Create an empty project.
  • Install locally Jest v21.1.0
  • Creater some.spec.js that just asserts true equals true
  • Restart VS Code
  • Go to Jest output, it shows this:
Error: This promise must be present when running with -o.
    at /Project/node_modules/jest/node_modules/jest-cli/build/search_source.js:203:17
    at Generator.next (<anonymous>)
    at step (/Project/node_modules/jest/node_modules/jest-cli/build/search_source.js:20:362)
    at /Project/node_modules/jest/node_modules/jest-cli/build/search_source.js:20:592
    at Promise (<anonymous>)
    at /Project/node_modules/jest/node_modules/jest-cli/build/search_source.js:20:273
    at SearchSource.getTestPaths (/Project/node_modules/jest/node_modules/jest-cli/build/search_source.js:217:10)
    at /Project/node_modules/jest/node_modules/jest-cli/build/run_jest.js:45:29
    at Generator.next (<anonymous>)
    at step (/Project/node_modules/jest/node_modules/jest-cli/build/run_jest.js:24:380)

Expected Behavior

Work. Like it does when using latest jest v20

Actual Behavior

Does not works, does nothing.

drpicox avatar Sep 15 '17 10:09 drpicox

This might be fixed by #146

orta avatar Oct 02 '17 14:10 orta

@orta @drpicox I had the same issue. From this thread it seems like this is a problem whenever you don't have git yet in the project. Indeed setting the watchAll instead of watch flag helped, but better yet I've just initialized git repo and it worked well (I would need to do this anyways). Dunno if it's something you can fix on your end as they still have opened PRs, though.

sunshinejr avatar Oct 08 '17 15:10 sunshinejr

I think letting jest handle this is probably a good 👍 - or it can be added to jest-editor-support

orta avatar Oct 08 '17 19:10 orta

@sunshinejr, you should be able to run with --watchAll by just customizing the jest.pathToJest option (in vscode's settings) or the npm script it points to. for example: "jest.pathToJest": "node_modules/.bin/jest --watchAll"

vscode-jest would run the command first time as it is (without appending the --watch flag), so it should pick up your --watchAll flag. Since --watchAll will not exit, vscode-jest will just never go into its normal --watch mode. But everything should function just fine.

Anyway, I agree with @orta that if the issue is caused by jest, it is best for the jest team to fix the root cause. Hopefully, the --watchAll will get you around this problem until jest is fixed.

connectdotz avatar Oct 09 '17 00:10 connectdotz

Right, sorry if my message wasn't clear, this is exactly what I wanted to say with Jest having opened PRs for the fix 👍

sunshinejr avatar Oct 09 '17 11:10 sunshinejr

@sunshinejr, thanks for pointing at using the --watchAll flag. I experienced the same issue working on Windows 10 with Jest v21.2.1 and solved it that way. It seems to have been fixed in #4737 but not yet released.

daniel-234 avatar Nov 09 '17 18:11 daniel-234

This is going against my "wontfix" label, but since the UI still gets stuck at "testing changes" is it worth:

  • detecting if the output starts with the "watch without version control" error
  • restart Jest with --watchAll
  • logging the change to the output channel

seanpoulter avatar Dec 14 '17 19:12 seanpoulter

This issue has been inactive for over a year and has been marked as stale. It will be automatically closed in 30 days if no further activity occurs. Since significant changes have occurred in the codebase, please open a new issue with updated details if the problem still persists.

github-actions[bot] avatar Apr 10 '25 03:04 github-actions[bot]