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

React Native Update 0.56: npm test is broken (even in new projects). Jest tests do not run. #20053

Closed
3 tasks done
janhesters opened this issue Jul 5, 2018 · 1 comment
Closed
3 tasks done
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@janhesters
Copy link

I went through all these requirements before I filed this issue. Can't find a fix anywhere.

Environment

Here is my environment:

React Native Environment Info:
    System:
      OS: macOS High Sierra 10.13.4
      CPU: x64 Intel(R) Core(TM) i7-7920HQ CPU @ 3.10GHz
      Memory: 486.81 MB / 16.00 GB

      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 9.4.0 - /usr/local/bin/node
      npm: 6.1.0 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 11.4, macOS 10.13, tvOS 11.4, watchOS 4.3
    IDEs:
      Android Studio: 3.1 AI-173.4697961
      Xcode: 9.4.1/9F2000 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.4.1 => 16.4.1
      react-native: 0.56.0 => 0.56.0
    npmGlobalPackages:
      create-react-native-app: 1.0.0
      react-native-cli: 2.0.1
      react-native-git-upgrade: 0.2.7

Description

While trying to test my newly created action creators,npm test throws the following error:

> jest

 FAIL  app/actions/logout/logout.test.js
  ● Test suite failed to run


    Plugin 0 specified in "/Users/jan/Startup/react-native/ordersome/node_modules/babel-preset-react-native/index.js" provided an invalid
property of "default" (While processing preset: "/Users/jan/Startup/react-native/ordersome/node_modules/babel-preset-react-native/index.js
")

      at Plugin.init (node_modules/babel-core/lib/transformation/plugin.js:131:13)
      at Function.normalisePlugin (node_modules/babel-core/lib/transformation/file/options/option-manager.js:152:12)
      at node_modules/babel-core/lib/transformation/file/options/option-manager.js:184:30
          at Array.map (<anonymous>)
      at Function.normalisePlugins (node_modules/babel-core/lib/transformation/file/options/option-manager.js:158:20)
      at OptionManager.mergeOptions (node_modules/babel-core/lib/transformation/file/options/option-manager.js:234:36)
      at node_modules/babel-core/lib/transformation/file/options/option-manager.js:265:14
      at node_modules/babel-core/lib/transformation/file/options/option-manager.js:323:22
          at Array.map (<anonymous>)
      at OptionManager.resolvePresets (node_modules/babel-core/lib/transformation/file/options/option-manager.js:275:20)

I have googled heavily and can't find a fix. It seems like it has something to do with babel.

Reproducible Demo

It's easy to reproduce (currently). I tried an started a new project using react-native init. Then I just created a random .test.js file and wrote the getting started test of the documentation in it:

function sum(a, b) {
  return a + b;
}

test("adds 1 + 2 to equal 3", () => {
  expect(sum(1, 2)).toBe(3);
});

Next I run 'npm test' and it gives the error above.

@kelset
Copy link
Contributor

kelset commented Jul 5, 2018

Duplicate of #19859

@kelset kelset marked this as a duplicate of #19859 Jul 5, 2018
@kelset kelset closed this as completed Jul 5, 2018
@facebook facebook locked as resolved and limited conversation to collaborators Jul 18, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

3 participants