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

Jest fails to run tests on React Native 0.59.5 #24447

Closed
ethanneff opened this issue Apr 14, 2019 · 1 comment
Closed

Jest fails to run tests on React Native 0.59.5 #24447

ethanneff opened this issue Apr 14, 2019 · 1 comment
Labels
Bug Resolution: Locked This issue was locked by the bot.

Comments

@ethanneff
Copy link

ethanneff commented Apr 14, 2019

🐛 Bug Report

Jest fails to run on React Native 0.59.5

To Reproduce

  1. update react native 0.59.3 -> 0.59.5
  2. have jest config:
  "jest": {
    "preset": "react-native",
    "transform": {
      "^.+\\.(jsx?)$": "<rootDir>/node_modules/react-native/jest/preprocessor.js",
      "^.+\\.tsx?$": "ts-jest"
    },
    "transformIgnorePatterns": [
      "node_modules/(?!react-native)/"
    ],
    "globals": {
      "window": {},
      "ts-jest": {
        "tsConfig": "./tsconfig.jest.json"
      }
    }
  },
  1. run jest ./node_modules/.bin/jest
  2. get the following error
$ ./node_modules/.bin/jest
No tests found
In /Users/ethanneff/Dropbox/active/dev/react-native/example
  712 files checked.
  testMatch:  - 712 matches
  testPathIgnorePatterns: /node_modules/ - 190 matches
  testRegex: (/__tests__/.*|(\.|/)(test|spec))\.(jsx?|tsx?)$ - 2 matches
Pattern:  - 0 matches

Expected Behavior

Jest was working fine and running all tests in 0.59.3

Code Example

See steps to reproduce

Environment

$ react-native info
info 
  React Native Environment Info:
    System:
      OS: macOS 10.14.4
      CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
      Memory: 534.38 MB / 16.00 GB
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 10.15.3 - /usr/local/bin/node
      Yarn: 1.15.2 - /usr/local/bin/yarn
      npm: 6.7.0 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
      Android SDK:
        API Levels: 22, 23, 24, 25, 26, 27, 28
        Build Tools: 23.0.1, 23.0.3, 25.0.0, 25.0.1, 25.0.2, 26.0.1, 26.0.2, 26.0.3, 27.0.3, 28.0.0, 28.0.1, 28.0.2, 28.0.3
        System Images: android-19 | Intel x86 Atom, android-22 | Google APIs Intel x86 Atom, android-26 | Google APIs Intel x86 Atom, android-27 | Google APIs Intel x86 Atom, android-27 | Google Play Intel x86 Atom, android-28 | Google APIs Intel x86 Atom
    IDEs:
      Android Studio: 3.3 AI-182.5107.16.33.5314842
      Xcode: 10.2/10E125 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.8.6 => 16.8.6 
      react-native: 0.59.4 => 0.59.4 
    npmGlobalPackages:
      react-native-cli: 2.0.1
@ethanneff ethanneff changed the title Jest fails to run tests on React Native 0.59.4 Jest fails to run tests on React Native 0.59.5 Apr 18, 2019
@ethanneff
Copy link
Author

solved with the following:

  "jest": {
    "preset": "react-native",
    "transform": {
      "^.+\\.(jsx?)$": "<rootDir>/node_modules/react-native/jest/preprocessor.js",
      "^.+\\.tsx?$": "ts-jest"
    },
    "transformIgnorePatterns": [
      "node_modules/(?!react-native)/"
    ],
    "testMatch": [
      "**/__tests__/**/*.[jt]s?(x)"
    ],
+   "moduleFileExtensions": [
+     "ts",
+     "tsx",
+     "js",
+     "jsx",
+     "json",
+     "node"
+   ],
    "globals": {
      "window": {},
      "ts-jest": {
        "tsConfig": "./tsconfig.jest.json"
      }
    }
  },

@facebook facebook locked as resolved and limited conversation to collaborators Apr 18, 2020
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Apr 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

2 participants