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

8 Коммитов

Автор SHA1 Сообщение Дата
Lorenzo Sciandra cb2dcd327c feat(jest): move Jest config to use a custom react-native Jest env (#34971)
Summary:
This PR is the follow up to the conversation started here by SimenB: https://github.com/react-native-community/discussions-and-proposals/issues/509

Basically, we want to move RN to use its own custom environment so that we can tweak it going forward - this PR in fact only sets up the groundwork for that; robhogan mentioned that with this in place, Meta engineers can
> iterate on it (with jest-environment-node as a starting point) against our internal product tests

This is also connected to Rob's work to bring Jest 29 into the codebase https://github.com/facebook/react-native/pull/34724 and my "mirror" PR to bring template in main up to the same version (https://github.com/facebook/react-native/pull/34972)

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[General] [Changed] - move Jest config to use a custom react-native Jest env

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

Test Plan: Tested that `yarn test` in main works fine after the changes; CI and Meta's internal CI will also serve the purpose of verifying that it works (but there's no reason not to since it's still pretty much just relying on `node`).

Reviewed By: huntie

Differential Revision: D40379760

Pulled By: robhogan

fbshipit-source-id: 2c6d0bc86d337fda9befce0799bda2f56cc4466c
2022-10-17 12:40:25 -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
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
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
Michał Pierzchała 7e23c7c565 Make Jest transform @react-native-community packages by default (#24294)
Summary:
Currently, `react-native` Jest preset will not automatically transpile extracted Lean Core modules (all under `react-native-community` org), so maintainers will likely need to update their docs on how to do that (it's a common pain in RN testing story).

We can make it easier for users and maintainers by adding RNC modules to the `transformIgnorePatterns` whitelist we have in Jest preset. Some of them are not necessary to transpile, but I'd say it's a small sacrifice to make (having first test run possibly slower) for having less friction around migrating to extracted modules.

[General] [Added] - make Jest transform react-native-community/ packages by default
Pull Request resolved: https://github.com/facebook/react-native/pull/24294

Differential Revision: D14748962

Pulled By: cpojer

fbshipit-source-id: 36300ee021f03b8c13275a6e0cf28d988ee5beba
2019-04-03 09:25:56 -07:00
Michał Pierzchała 23ef604d41 chore: update Jest preset to align with Jest 24 (#24062)
Summary:
Jest 24 includes [`testMatch` and `moduleFileExtensions`](c5fd7aae93/packages/jest-config/src/Defaults.ts (L70)) that align with the ones that are currently there on master, because it added default handling for TypeScript as well. I think it's time for us to move to Jest 24. Is there a way we can tell users to upgrade Jest to certain version?

Fixes https://github.com/facebook/react-native/issues/24060

[General] [Changed] - update Jest preset to align with Jest 24
Pull Request resolved: https://github.com/facebook/react-native/pull/24062

Differential Revision: D14538988

Pulled By: cpojer

fbshipit-source-id: d8d152b8e8517b34144970f1cc1ed0b49f8b4e54
2019-03-20 04:58:20 -07:00
James Ide 7d84d0dc07 Remove react-clone-referenced-element dependency (#23933)
Summary:
This package was a dependency for ListView, which is no longer part of RN. Removed the dependency from package.json and yarn.lock.

Also removed its pattern from the Jest preset -- ListView is not in this repo and also react-clone-referenced-element was written at a time when Node did not support the same modern JS features as RN. The latest Node 8+ supports the features that react-clone-referenced-element uses so we don't need to transform it.

[General] [Removed] - Removed unused react-clone-referenced-element dependency
Pull Request resolved: https://github.com/facebook/react-native/pull/23933

Differential Revision: D14477240

Pulled By: cpojer

fbshipit-source-id: 4f6975133b54cc75088262cedd11da20225cada8
2019-03-15 11:50:07 -07:00
Simen Bekkhus 991e83f568 fix: use `require.resolve` in `jest-preset` (#22972)
Summary:
The current way the Jest preset work requires the different files to be in `<rootDir>/node_modules/react-native`. This is not necessarily true - especially in monorepoes.

If we instead do `require.resolve`, we do not need to do `rootDir` replacement in Jest.

Having a JS file as preset has been supported since Jest 23.0.0: https://github.com/facebook/jest/pull/6185

Changelog:
----------

[General] [Fixed] - use `require.resolve` in `jest-preset`
Pull Request resolved: https://github.com/facebook/react-native/pull/22972

Differential Revision: D13662758

Pulled By: hramos

fbshipit-source-id: ca79b5b89d9d05c6fe639b0d88619858e8d05da7
2019-01-14 16:35:38 -08:00