vscode-jest
vscode-jest copied to clipboard
Error: This promise must be present when running with -o
Environment
-
node -v: v8.1.0 or v6.10.2 -
npm -v: 5.0.3 or v5.4.1 -
npm ls react-scripts(if you haven’t ejected): (empty) -
Operating system: MacOS Sierra 10.12.6
-
Jest version: v21.1.0
-
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.
This might be fixed by #146
@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.
I think letting jest handle this is probably a good 👍 - or it can be added to jest-editor-support
@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.
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, 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.
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
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.