Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
drpicox opened this issue Sep 15, 2017 · 7 comments
Open

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

drpicox opened this issue Sep 15, 2017 · 7 comments

Comments

@drpicox
Copy link

drpicox commented Sep 15, 2017

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.

@orta
Copy link
Member

orta commented Oct 2, 2017

This might be fixed by #146

@sunshinejr
Copy link

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

@orta
Copy link
Member

orta commented Oct 8, 2017

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

@connectdotz
Copy link
Collaborator

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

@sunshinejr
Copy link

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

@daniel-234
Copy link

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

@seanpoulter
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants