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

[Regression] Jest no longer works out of the box #20683

Closed
3 tasks done
deecewan opened this issue Aug 16, 2018 · 3 comments
Closed
3 tasks done

[Regression] Jest no longer works out of the box #20683

deecewan opened this issue Aug 16, 2018 · 3 comments
Labels
Impact: Regression Describes a behavior that used to work on a prior release, but stopped working recently. Resolution: Locked This issue was locked by the bot. 🔩Test Infrastructure Test infrastructure and continuous integration.

Comments

@deecewan
Copy link
Contributor

deecewan commented Aug 16, 2018

Environment

  React Native Environment Info:
    System:
      OS: macOS High Sierra 10.13.1
      CPU: x64 Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
      Memory: 69.45 MB / 16.00 GB
      Shell: 5.4.2 - /usr/local/bin/zsh
    Binaries:
      Node: 8.11.1 - ~/.nvm/versions/node/v8.11.1/bin/node
      Yarn: 1.9.2 - /usr/local/bin/yarn
      npm: 5.6.0 - ~/.nvm/versions/node/v8.11.1/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 11.2, macOS 10.13, tvOS 11.2, watchOS 4.2
      Android SDK:
        Build Tools: 23.0.1, 23.0.3, 25.0.1, 25.0.3, 26.0.1, 26.0.2, 27.0.3
        API Levels: 23, 25, 26, 27
    IDEs:
      Android Studio: 3.1 AI-173.4720617
      Xcode: 9.2/9C40b - /usr/bin/xcodebuild
    npmPackages:
      react: 16.4.1 => 16.4.1
      react-native: 0.56.0 => 0.56.0

Description

After upgrading to React Native v0.56.0, jest no longer works.
It is missing a babel-core bridge and the @babel/core dependency.
Once these are added, previously working tests no longer work if the source contains code that requires transpilation.

To confirm, my tests ran fine under v0.55.4 - after the upgrade, they started to fail. I was able to reproduce a minimal demo using react-native init

Reproducible Demo

Edit: I've created a repo that has the project set up the exact same with 0.55.4 and 0.56.0.

  • run react-native init <any name>
  • add a dependency on react-native-vector-icons (the same issue also happens with react-native-pie-chart, but only one is required)
    • yarn add react-native-vector-icons && yarn react-native link react-native-vector-icons
  • in App.js, add import Icon from 'react-native-vector-icons/MaterialIcons';
  • echo "import App from './App';" > App.test.js
    • You technically need to have at least one test in this file, but it will never get past the parse stage.
  • yarn test

This will result in an error due to incorrect babel versions:

image

This one is pretty easily resolved with yarn add -D [email protected].

Running the yarn test again will result in the following errors:

image

@deecewan
Copy link
Contributor Author

I've just created a repo to demonstrate this regression. Doing the exact same steps as I've listed above (short of upgrading the babel-core version) in 0.55.4 results in a successful test.

@deecewan deecewan changed the title Jest no longer works out of the box [Regression] Jest no longer works out of the box Aug 16, 2018
@react-native-bot react-native-bot added the Impact: Regression Describes a behavior that used to work on a prior release, but stopped working recently. label Aug 16, 2018
@ferdicus
Copy link
Contributor

duplicate? #19859

@hramos
Copy link
Contributor

hramos commented Aug 16, 2018

Duplicate of #19859

@hramos hramos marked this as a duplicate of #19859 Aug 16, 2018
@hramos hramos closed this as completed Aug 16, 2018
@kelset kelset added the 🔩Test Infrastructure Test infrastructure and continuous integration. label Aug 20, 2018
@facebook facebook locked as resolved and limited conversation to collaborators Aug 16, 2019
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Aug 16, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Impact: Regression Describes a behavior that used to work on a prior release, but stopped working recently. Resolution: Locked This issue was locked by the bot. 🔩Test Infrastructure Test infrastructure and continuous integration.
Projects
None yet
Development

No branches or pull requests

5 participants