Commit Graph

14 Commits

Author SHA1 Message Date
sAm_vdP 216bce3163 Fix jest snapshot testing on windows
Summary:
Fixes #19370

Applied changes to existing project that uses jest snapshot testing. Testing was broken before and now works.

To verify: Run any snapshot test containing an image reference on Windows before and after this PR.

[WINDOWS][BUGFIX][jest] - Fixed jest snapshot testing on windows
Closes https://github.com/facebook/react-native/pull/19496

Differential Revision: D8195947

Pulled By: hramos

fbshipit-source-id: 909b5fe7cfd8c6286baf161a227a359854a37603
2018-05-31 12:58:05 -07:00
Rubén Norte 9927d20927 Set hasteImplModulePath in React Native Jest preset
Reviewed By: cpojer

Differential Revision: D7843566

fbshipit-source-id: 98be0d7286351475248f53b7c028e6c85d411a10
2018-05-02 03:52:39 -07:00
Keyan Zhang b4fb68c701 mock mp4 files
Reviewed By: frantic

Differential Revision: D6105671

fbshipit-source-id: d05336a46bb2c1e2d0530188dc85cc2b4f7f4537
2017-10-20 13:05:26 -07:00
Martin Yrjölä 25639176ff Asset basenames in Jest snapshots
Summary:
This change only affects tests run with Jest. `require('/images/image1.png')` will be replaced with

```
Object {
  "testUri": "relative/path/to/images/image1.png",
}
```

in the Jest snapshot instead of always being 1 returned by RelativeImageStub. This change makes it possible to test conditional asset loading in components.

The problem with this change is that it will probably break a lot of existing snapshots, but that should be easily fixed when a project updates to a new version of React Native by running `jest -u` to update all snapshots.

A component can have conditional asset loading based on its props, this logic would be nice to test with Jest snapshots. This problem has been discussed in https://github.com/facebook/jest/issues/2838.

* **Who does this affect**: Everyone using `Image` in Jest snapshots
* **How to migrate**: Running `jest -u` will update the snapshots, the snapshots should be reviewed that they are correct.
* **Why make this breaking change**: It enables testing of conditional asset loading.
* **Severity (number of people affected x effort)**: Low.
Closes https://github.com/facebook/react-native/pull/13319

Reviewed By: rafeca

Differential Revision: D5708180

Pulled By: mjesun

fbshipit-source-id: 16ac42004d597db08545a21d4fffe95c5ee7e21f
2017-09-06 03:33:43 -07:00
James Ide 6e13adbf56 Remove remnants of the packager
Summary:
There were still some references to "packager/" that are no longer used since the `packager` directory has been deleted after moving to Metro. Cleaned up the ones that were doing nothing and updated the references that are still meaningful.
Closes https://github.com/facebook/react-native/pull/14881

Reviewed By: cpojer

Differential Revision: D5380731

Pulled By: javache

fbshipit-source-id: 1355268f48db47343d0d38fae2598b64c8c01475
2017-07-07 03:06:21 -07:00
Christoph Pojer 4d5ef76b1a Add missing slash.
Summary:
This should be there for consistency.
Closes https://github.com/facebook/react-native/pull/11357

Differential Revision: D4294530

Pulled By: kentaromiura

fbshipit-source-id: 6219a7c69a65dde21d96bc032fc9a327386a85ca
2016-12-07 20:58:30 -08:00
Loic CHOLLIER 30152ff5b4 Adds native to the list of jest-react-native platforms to fix testing with react-relay.
Summary:
See https://github.com/facebook/jest/pull/2170. Per cpojer's request, bringing this PR to react-native as well.

**Summary**

When using jest with React Native and Relay and recommended default settings, jest throws :
```
    Cannot find module 'react-dom' from 'relayUnstableBatchedUpdates.js'

      at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:151:17)
      at Object.<anonymous> (node_modules/react-relay/lib/relayUnstableBatchedUpdates.js:15:18)
      at new RelayEnvironment (node_modules/react-relay/lib/RelayEnvironment.js:39:63)
```

Investigating this, I found out that https://github.com/facebook/jest/blob/master/packages/jest-react-native/jest-preset.json didn't have "native" in the list of platforms, hence jest can't pick up `relayUnstableBatchedUpdates.native.js` in react-relay.

**Test plan**

I copied and paste the content of https://github.com/facebook/jest/blob/master/packages/jest-react-native/jest-preset.json in my `package.json` `jest` section, as well a
Closes https://github.com/facebook/react-native/pull/11179

Differential Revision: D4243073

Pulled By: cpojer

fbshipit-source-id: bcfeb2235df4d466ba19d0a3fe94fc98835a20ea
2016-11-28 21:28:28 -08:00
David Aurelio ca58e0af82 BREAKING kill deprecated asset support
Summary:
This removes support for `require('image!…')`, which has been deprecated for a long time.

It is still possible to use images that are already bundled by the native app using the `nativeImageSource` module.
Check http://facebook.github.io/react-native/docs/images.html for detailed documentation.

Reviewed By: matryoshcow

Differential Revision: D4231208

fbshipit-source-id: 05ec4c1ca0fabdc3fbb652f8ad1acdf240a67955
2016-11-24 05:43:38 -08:00
Christoph Pojer 3bd949cac7 Update Jest + jest-haste-map
Reviewed By: voideanvalue

Differential Revision: D4180887

fbshipit-source-id: f6ee6901e63206824f0639c81b64167b66da2168
2016-11-15 06:58:45 -08:00
Konstantin Raev 015a497cf1 Revert D4149694: [RN] Update Jest + jest-haste-map
Differential Revision: D4149694

fbshipit-source-id: 65a39bc1d0a0f9e7094ebc8dec9233e432a5e14d
2016-11-14 12:43:51 -08:00
Christoph Pojer 2382ffe9bc Update Jest + jest-haste-map
Reviewed By: matryoshcow

Differential Revision: D4149694

fbshipit-source-id: 4f8378c419ddc7978e05dfcf2112e833775391be
2016-11-10 06:28:38 -08:00
kentaromiura 97d90a1d71 Add `React` name mapping to the preset
Summary:
Fixes breakage on https://circleci.com/gh/facebook/react-native/12763 after the upgrade of React

Explain the **motivation** for making this change. What existing problem does the pull request solve?

Jest preset has been upgraded so that requiring `React` capitalized can be possible

**Test plan (required)**

Couldn't reproduce it locally, we need to see if Circle passes.
Closes https://github.com/facebook/react-native/pull/10749

Differential Revision: D4132150

Pulled By: bestander

fbshipit-source-id: e41fb95b6677113fc6a3bf8bbce9247f59aa81dd
2016-11-04 20:43:43 -07:00
David Aurelio 3683beb88a RN: Update React (2/2)
Reviewed By: kentaromiura

Differential Revision: D4026114

fbshipit-source-id: 67808af91454d95941fea01eef58a4d9086f46e1
2016-11-04 05:43:44 -07:00
Cristian Carlesso 6d3e074dd4 Adding Jest preset so that people can configure Jest using react-native as preset
Reviewed By: cpojer

Differential Revision: D4081817

fbshipit-source-id: 43cf2ec467ea69651705162b6a58e0b3f1ad1dbf
2016-10-31 12:58:35 -07:00