Граф коммитов

12 Коммитов

Автор SHA1 Сообщение Дата
Nick Gerleman 217696ee17 Fail tests on `console.error()` or `console.warn()`
Summary:
This makes it so that React Native unit tests will fail if code unexpectedly outputs a warning or error (which would show as a redbox error).

This logic split out from the normal `jest/setup.js` which is included by the jest-preset, to only effect our tests instead of existing RN Jest users.

Changelog:
[Internal][Changed] - Fail tests on `console.error()` or `console.warn()`

Reviewed By: huntie

Differential Revision: D41564032

fbshipit-source-id: 3cc7d3a8433fcb75f654669b9c350dea2da937a8
2022-12-01 06:59:04 -08:00
Rob Hogan c27501bb87 Update to Jest 29 (#34724)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34724

Following on from the recent upgrade from Jest 26->27, this brings us up to present day Jest 29 for tests of React Native itself, Metro, and Meta-internal code. An update to the template for RN apps will follow.

Changelog:
[Internal][Fixed] Update to Jest 29

Reviewed By: huntie

Differential Revision: D39543504

fbshipit-source-id: b47fdb678212b475881ec19085f6cd45a4530333
2022-09-20 14:15:50 -07:00
Rob Hogan 09a910f80b Prepare for Jest 27+ by making legacy fake timer use explicit
Summary:
Jest 27 [flips defaults](https://jestjs.io/blog/2021/05/25/jest-27#flipping-defaults), making "modern" fake timers (ie, `sinonjs/fake-timers`) the default, over "legacy", which we currently use.

We're not quite ready for modern timers yet, partly due to Promise polyfills (https://github.com/facebook/react-native/pull/34659), and also some internal issues with specific tests.

This makes our use of legacy timers explicit in preparation for an update to Jest. A switch to modern timers may follow later.

Changelog:
[Internal][Changed] - Prepare for Jest 27+ by making legacy fake timer use explicit

Reviewed By: jacdebug

Differential Revision: D39383719

fbshipit-source-id: 6a3dc6f8547cc76f7702a5a39c9b30a184303f17
2022-09-12 04:59:18 -07:00
Moti Zilberman 0301cb285b Stop publishing jest/preprocessor.js to npm
Summary:
Changelog:
[Breaking][General] Remove jest/preprocessor from the react-native package

Using `react-native/jest/preprocessor` outside of the React Native repo has been deprecated since D34820086 (c1e9aa9a27). Here, we make this file private and stop publishing it to npm.

The supported method of using Jest in React Native projects is using the [Jest preset](https://jestjs.io/docs/tutorial-react-native) shipped as part of the `react-native` package.

NOTE: We could probably make some of the other files under `jest/` private as well, but we should go through a separate deprecation cycle with those, in case they are also being used externally by some projects. I'm leaving that for future followup at the moment.

Reviewed By: GijsWeterings

Differential Revision: D36132939

fbshipit-source-id: 300ffa6cf16232573cd3a79a34c14daaafd7aa43
2022-05-06 04:43:09 -07:00
Moti Zilberman c1e9aa9a27 Deprecate jest/preprocessor.js
Summary:
Changelog:
[General][Deprecated] Deprecate the use of `react-native/jest/preprocessor.js` by external projects

The supported method of using Jest in React Native projects is using the [Jest preset](https://jestjs.io/docs/tutorial-react-native) shipped as part of the `react-native` package. Some projects are directly using `preprocessor.js` which is part of the testing setup for the React Native repo itself.

In a future release of React Native, we will stop publishing this file to npm and require projects to switch to the supported preset (or a custom Jest config if necessary).

Reviewed By: GijsWeterings

Differential Revision: D34820086

fbshipit-source-id: 197c33726639e66c6916a244117252e6af11f2f6
2022-03-14 07:40:05 -07:00
Andres Suarez 8bd3edec88 Update copyright headers from Facebook to Meta
Reviewed By: aaronabramov

Differential Revision: D33367752

fbshipit-source-id: 4ce94d184485e5ee0a62cf67ad2d3ba16e285c8f
2021-12-30 15:11:21 -08:00
Tim Yung 54e19a6b7f RN: Remove `fbjs` Dependency
Summary:
Removes `fbjs` dependency from `react-native` because it is no longer referenced.

Changelog:
[General][Changed] - Removed `fbjs` dependency from `react-native`.

Reviewed By: cpojer

Differential Revision: D23358201

fbshipit-source-id: 1945590d2e7ea853434c716a151fc1058718d471
2020-08-28 12:16:26 -07:00
stealthanthrax 63992c0b96 Migrating RNTester to Packages Directory (#29567)
Summary:
## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->
This PR aims to migrate the RNTester App to `packages` directory. But is currently, open to inspect the CI issues and resolve the merge conflicts.

Currently done
 - Working on iOS
 - Working on Android
 - Detox Tests working on iOS

Need to work on
 - Errors generated by the CI builds

[General] [Changed] - Migrated the RNTester App to the packages directory.

Pull Request resolved: https://github.com/facebook/react-native/pull/29567

Test Plan: It runs on both ios and android for now and the detox iOS builds are working.

Reviewed By: cpojer

Differential Revision: D23034761

Pulled By: rickhanlonii

fbshipit-source-id: e04bb06e1c7ef15d340206090d1575a871b9e6f5
2020-08-19 17:57:08 -07:00
Christoph Nakazawa a77f2c40d1 Create `@react-native/polyfills` package.
Summary: Changelog: [Internal]

Reviewed By: GijsWeterings

Differential Revision: D22625944

fbshipit-source-id: 1d97550c92115eb637da57e8f38c28e8139f3a8b
2020-07-22 03:02:45 -07:00
Andres Suarez aee88b6843 Tidy up license headers [3/n]
Summary: Changelog: [General] [Fixed] - License header cleanup

Reviewed By: yungsters

Differential Revision: D17952693

fbshipit-source-id: 8fcb8e58a2e04e7a3169f4d525bffc00835768e6
2019-10-16 10:06:34 -07:00
James Ide 7a2463e1f3 Delete hasteImpl, providesModuleNodeModules, and modulePathNameMapper (#24811)
Summary:
**Depends on https://github.com/facebook/react-native/pull/25100**

This commit depends on having migrated all of RN away from Haste. With 100% standard path-based requires, the key foundation is set and we no longer need `hasteImpl` and related settings in the Jest configuration.

This commit deletes the `hasteImpl` file and setting as well as `providesModuleNodeModules` and `modulePathNameMapper`, removing most of the dependency graph overriding performed by Jest.

## Changelog

[General] [Changed] - Delete hasteImpl, providesModuleNodeModules, and modulePathNameMapper from Jest config
Pull Request resolved: https://github.com/facebook/react-native/pull/24811

Differential Revision: D15659274

Pulled By: cpojer

fbshipit-source-id: 8a4a3b97ddf7e38fbe62c6d3cc9c98248bfca343
2019-06-05 10:55:08 -07:00
gengjiawen 4ba304dda5 extract jest config from package.json (#23638)
Summary:
Make package.json slimmer.

[General] [Changed] - Move Jest config outside of package.json
Pull Request resolved: https://github.com/facebook/react-native/pull/23638

Differential Revision: D14212028

Pulled By: cpojer

fbshipit-source-id: 5d5961eb47b04cc2cc2eeaf6b1cafdc156883bc1
2019-02-25 21:49:10 -08:00