Jest not working on new CRNA

#1

using Node v6.11.1
npm v3.10.10
Expo SDK 23

I create a new app with create-react-native-app oath-rss

yarn start works fine. app runs as expected

however when I run yarn test I get the following:

Determining test suites to run...Error: This promise must be present when running with -o.
    at /Users/mory/repos/gitlab-findmory/oath-rss/node_modules/jest-cli/build/search_source.js:202:17
    at next (native)
    at step (/Users/mory/repos/gitlab-findmory/oath-rss/node_modules/jest-cli/build/search_source.js:19:362)
    at /Users/mory/repos/gitlab-findmory/oath-rss/node_modules/jest-cli/build/search_source.js:19:592
    at /Users/mory/repos/gitlab-findmory/oath-rss/node_modules/jest-cli/build/search_source.js:19:273
    at SearchSource.getTestPaths (/Users/mory/repos/gitlab-findmory/oath-rss/node_modules/jest-cli/build/search_source.js:216:10)
    at /Users/mory/repos/gitlab-findmory/oath-rss/node_modules/jest-cli/build/run_jest.js:44:29
    at next (native)
    at step (/Users/mory/repos/gitlab-findmory/oath-rss/node_modules/jest-cli/build/run_jest.js:23:380)
    at /Users/mory/repos/gitlab-findmory/oath-rss/node_modules/jest-cli/build/run_jest.js:23:540

i’ve made no code edits after running CRNA.

this is the package.json that is created

{
  "name": "oath-rss",
  "version": "0.1.0",
  "private": true,
  "devDependencies": {
    "react-native-scripts": "1.8.1",
    "jest-expo": "23.0.0",
    "react-test-renderer": "16.0.0"
  },
  "main": "./node_modules/react-native-scripts/build/bin/crna-entry.js",
  "scripts": {
    "start": "react-native-scripts start",
    "eject": "react-native-scripts eject",
    "android": "react-native-scripts android",
    "ios": "react-native-scripts ios",
    "test": "node node_modules/jest/bin/jest.js --watch"
  },
  "jest": {
    "preset": "jest-expo"
  },
  "dependencies": {
    "expo": "^23.0.4",
    "react": "16.0.0",
    "react-native": "0.50.3"
  }
0 Likes

#2

hi @findmory, this appears to be a bug with jest 21.0.1. here, sorry about that! In the meantime, you can run node node_modules/jest/bin/jest.js, without the --watch option to run the tests.

1 Like

#3

This was helpful! running git init on my project allowed me to get back to using --watch. Also there’s the --watchAll flag which is an option as well. thanks

0 Likes

closed #4

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

0 Likes