Do you want to request a feature or report a bug?
Bug
What is the current behavior?
When jest --watch
is executed inside a non-git folder the following exception is raised:
Determining test suites to run...Error: This promise must be present when running with -o.
at /path/to/node_modules/jest-cli/build/search_source.js:192:17
at next (native)
at step (/path/to/node_modules/jest-cli/build/search_source.js:20:362)
at /path/to/node_modules/jest-cli/build/search_source.js:20:592
at /path/to/node_modules/jest-cli/build/search_source.js:20:273
at SearchSource.getTestPaths (/path/to/node_modules/jest-cli/build/search_source.js:204:10)
at /path/to/node_modules/jest-cli/build/run_jest.js:45:31
at next (native)
at step (/path/to/node_modules/jest-cli/build/run_jest.js:24:380)
at /path/to/node_modules/jest-cli/build/run_jest.js:24:540
If the current behavior is a bug, please provide the steps to reproduce and either a repl.it demo through https://repl.it/languages/jest or a minimal repository on GitHub that we can yarn install
and yarn test
.
.git
folder is not present (removed)What is the expected behavior?
A more helpful message as to why jest failed.
Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system.
That's a bug! cc @rogeliog @aaronabramov
I've run into the same issue with the follow configuration:
I did a little playing with versions to deduce where the problem may have started. Downgrading to Jest v21.0.0 leaves me with the same problem, and the same workaround as above solves the issue. I'm able to run jest --watch
with no errors when using Jest v20.0.4 and missing a .git directory in my project.
I've run into the same issue with the follow configuration:
Jest v21.0.1
Node v7.10.0
npm 4.2.0
Linux mint 18.2
running: jest --watch
I'm also able to repro it, I think it was introduced here
Same issue here
Jest 21.0.1
Node 8.1.2
npm 5.0.3
cc: @aaronabramov
Downgrading back to jest cli version 20.0.4 seems to be a temporary solution:
npm install [email protected] --save
or (I believe):yarn add [email protected]
@15Dkatz thx, that helped
@rogeliog it seems like it happens because onlyChanged
is set to true here https://github.com/facebook/jest/blob/master/packages/jest-cli/src/lib/update_global_config.js#L53-L56
and if onlyChanged
is true, we assume that we're in a git/hg repo and try to get the list of changed files, which is not possible if we're not in git.
Can we just remove this assignment from watch mode? is this config option is used for anything else then getting changed files from hg/git?
Thanks for the point out there @aaronabramov. I ended up changing to --watchAll which helps to circumvent this issue.
My configuration is:
...
"react": "16.0.0-alpha.12",
"react-native": "0.45.1",
"react-native-camera": "^0.10.0",
"babel-jest": "21.2.0",
"babel-preset-react-native": "4.0.0",
"jest": "21.2.1",
...
2 possibles solutions (that I found):
it works when i use --watchAll, but when i played around with filters (pattern mode) and after that i clicked "c" to clear filters i had the same error again.
Same issue:
Jest: 21.2.1
Yarn: 1.3.2
Node: 8.9.0
React Native: 0.49.5
Adding a git repo to project folder is a fix.
Fixed in #4737 (not released)
Most helpful comment
Downgrading back to jest cli version 20.0.4 seems to be a temporary solution:
npm install [email protected] --save
or (I believe):yarn add [email protected]