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

Tests fail to run on new project creation #529

Closed
christopherdiehl opened this issue Jan 11, 2018 · 2 comments
Closed

Tests fail to run on new project creation #529

christopherdiehl opened this issue Jan 11, 2018 · 2 comments

Comments

@christopherdiehl
Copy link

christopherdiehl commented Jan 11, 2018

Description

npm run test fails with the error this promise must be present when running with -o.

1-2 sentences describing the problem you're having or the feature you'd like to request

Expected Behavior

What action did you perform, and what did you expect to happen?
I expected tests to run.

Observed Behavior

What actually happened when you performed the above actions?
The tests failed.

If there's an error message, please paste the full terminal output and error message in this code block:

Determining test suites to run...Error: This promise must be present when running with -o.
    at /Users/chris/git/apps/FirstProject/node_modules/jest/node_modules/jest-cli/build/search_source.js:202:17
    at Generator.next (<anonymous>)
    at step (/Users/chris/git/apps/FirstProject/node_modules/jest/node_modules/jest-cli/build/search_source.js:19:362)
    at /Users/chris/git/apps/FirstProject/node_modules/jest/node_modules/jest-cli/build/search_source.js:19:592
    at /Users/chris/git/apps/FirstProject/node_modules/jest/node_modules/jest-cli/build/search_source.js:19:273
    at SearchSource.getTestPaths (/Users/chris/git/apps/FirstProject/node_modules/jest/node_modules/jest-cli/build/search_source.js:216:10)
    at /Users/chris/git/apps/FirstProject/node_modules/jest/node_modules/jest-cli/build/run_jest.js:44:29
    at Generator.next (<anonymous>)

Environment

Mac v 10.12.6
Node v 7.10

Please run these commands in the project folder and fill in their results:

  • npm ls react-native-scripts:
    react-native-scripts@1.8.1
  • npm ls react-native:
    react-native@0.50.3
  • npm ls expo:
  • node -v:
  • npm -v:
    v4.2.0
  • yarn --version:
  • watchman version:
    4.9.0

Also specify:

  1. Operating system:
  2. Phone/emulator/simulator & version:

Reproducible Demo

Please provide a minimized reproducible demonstration of the problem you're reporting.

Issues that come with minimal repro's are resolved much more quickly than issues where a maintainer has to reproduce themselves.

@kavsingh
Copy link

kavsingh commented Jan 13, 2018

Am having the same problem when trying to run tests after project init

update
Tests work after deleting node_modules / yarn.lock and running yarn again, @christopherdiehl does that work for you?

Turns out the project folder has to be a git / hg repo. CRNA seems to run tests with the -o flag by default. From the Jest cli docs:

Run tests related to changed files based on hg/git (uncommitted files):

jest -o

so that makes sense, a git init then yarn test and all is well. Should this be documented?

@brentvatne
Copy link
Member

it seems that jest changed under our feet such that --watch requires a git repo. we will disable this by default going forward. thanks!

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

No branches or pull requests

3 participants