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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[jest-expo] expo's jest-preset is called twice, leading to warnings in console and a corrupted jest-preset #9050

Closed
alex-fournier opened this issue Jul 1, 2020 · 5 comments 路 Fixed by #9051
Labels
Jest with Expo Pertains to using Jest with an Expo project.

Comments

@alex-fournier
Copy link
Contributor

馃悰 Bug Report

Summary of Issue (just a few sentences)

Since upgraded to Expo SDK 38, I noticed some warnings in console when executing jest. The jest-preset.js file in jest-expo is called twice, it is due to a change since jest@25.

The preset is built by mutating the react-native preset, leading to warnings on the second pass and a corrupted output. The preset should be built in a immutable way.

Environment - output of expo diagnostics & the platform(s) you're targeting

  Expo CLI 3.21.13 environment info:
    System:
      OS: Windows 10 10.0.19041
    Binaries:
      Node: 12.16.1 - D:\Programs\nodejs\node.EXE
      Yarn: 1.22.4 - D:\Programs\Yarn\bin\yarn.CMD
      npm: 6.13.4 - D:\Programs\nodejs\npm.CMD
    npmPackages:
      expo: ^38.0.0 => 38.0.8
      react: 16.11.0 => 16.11.0
      react-native: https://github.com/expo/react-native/archive/sdk-38.0.0.tar.gz => 0.62.2

Reproducible Demo

  1. expo init -t tabs jest-demo
  2. cd jest-demo
  3. yarn test

Warnings showing in console:

Expected react-native/jest-preset to define transform[^.+\.(bmp|gif|jpg|jpeg|mp4|png|psd|svg|webp)$]
react-native/jest-preset contained different transformIgnorePatterns than expected

Workaround

  1. yarn add jest@^24.0.0
  2. Launch tests using this command: node ./node_modules/jest/bin.jest.js
@byCedric
Copy link
Member

byCedric commented Jul 1, 2020

Hi @alex-fournier! Thanks for the issue report and a PR 馃槃 Do you know what change could cause this? I went over the changelog for 25.x.x, but I can't find anything that might have affected this.

@byCedric byCedric added Jest with Expo Pertains to using Jest with an Expo project. and removed needs validation Issue needs to be validated labels Jul 1, 2020
@alex-fournier
Copy link
Contributor Author

I think this commit is causing the issue : jestjs/jest#8894

Fix Jest multi project runner still cannot handle exactly one project in the CHANGELOG of 25.1.0.

@brunohkbx
Copy link
Contributor

+1
This change here introduced the issue:
https://github.com/facebook/jest/pull/8894/files#diff-9787071c48fc2896fbe36394532b7288R294

@alex-fournier
Copy link
Contributor Author

Any news on this? The PR is ready but still not merged.

@renanmav
Copy link

renanmav commented Aug 4, 2020

@alex-fournier I can confirm that it works for me (patched jest-expo here)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Jest with Expo Pertains to using Jest with an Expo project.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants