Commit Graph

296 Commits

Author SHA1 Message Date
Sam Zhou cf664c65e2 Standardize subtyping error code into incompatible-type in react native and metro (#53312)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53312

Changelog: [Internal]

Reviewed By: jbrown215

Differential Revision: D80400976

fbshipit-source-id: 196af69c0b9621b2a2675b232406639773e04933
2025-08-18 09:04:31 -07:00
Alex Hunt fc5e33b582 Reorganise shared script utils (#52473)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52473

Shared utils that were located in the root of `scripts/` are now colocated closer to their dependencies or moved to `scripts/shared/` — simplifying the root directory layout.

Changelog: [Internal]

Reviewed By: robhogan

Differential Revision: D77873875

fbshipit-source-id: e04dba41a1ef811d32793931033fdfa93afad0cd
2025-07-08 06:10:36 -07:00
Tim Yung d17f7d0a29 RN: Private Package for Monorepo ESLint Rules (#51858)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51858

Creates a new private package for the ESLint rules that are defined in the `facebook/react-native` repository for linting the monorepo itself: `react-native/eslint-plugin-monorepo`

It resides in a new `private/` directory that will be used for all private packages. I plan to move private packages over from `packages/` and `tools/`.

This also eliminates the need for the `eslint-plugin-lint` dependency in open source.

Changelog:
[Internal]

Reviewed By: cortinico

Differential Revision: D76088698

fbshipit-source-id: 697d5d91421cda4ef3f96d0497a96954cd047296
2025-06-09 20:30:32 -07:00
Moti Zilberman d61a8f7059 Fix the ability to require() JSON files in tests (#51678)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51678

Changelog: [Internal]

TSIA

Reviewed By: hoxyq

Differential Revision: D75598975

fbshipit-source-id: ed6c151f021b5a9cc0fab22a179094064486691e
2025-05-29 06:16:48 -07:00
Tim Yung 1977dd6596 RN: Sort Pragmas in Headers (#51554)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51554

Sorts pragma directives file headers in React Native.

Changelog:
[Internal]

Reviewed By: SamChou19815

Differential Revision: D75264593

fbshipit-source-id: 9e4b253dd0fc94dc2fc469d7114b93a8aae305f4
2025-05-22 21:18:53 -07:00
Alex Hunt e1575857dd Relocate babel-register script (#49102)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49102

Moves this script one level up. In the next diff, will be used to support execution of scripts themselves, as well as `packages/`.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D68960279

fbshipit-source-id: 7b62420c269dc1c1366ac9a827db078d34cb86c5
2025-02-03 03:49:23 -08:00
Rubén Norte 81fbd18410 Move remaining Fantom files to react-native-fantom (#48143)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48143

Changelog: [internal]

Just a small cleanup to move `jest/integration/*` to `packages/react-native-fantom`, so everything related to Fantom (config, runner, runtime, etc.) is in the same directory.

Reviewed By: javache

Differential Revision: D66874763

fbshipit-source-id: 8b87d7320c7704f7ce6cd58761508193784f5ce2
2024-12-06 05:24:31 -08:00
Rubén Norte 923b194e47 Rename ReactNativeTester as just Fantom (#48142)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48142

Changelog: [internal]

This is the default export from the `react-native/fantom` package and it makes sense to be called that way. Also, this is similar to the `jest` global.

Reviewed By: javache

Differential Revision: D66874225

fbshipit-source-id: 8b43a637ebb42b5b1acb9ea5a6dbedd4c1a4f9e0
2024-12-06 05:24:31 -08:00
Rubén Norte b253b0fe94 Create @react-native/fantom package (#48125)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48125

Changelog: [internal]

This just moves the runtime modules for Fantom to its own package.

Reviewed By: javache

Differential Revision: D66825478

fbshipit-source-id: ac4dbc23b86895f09abc46345d497c1c53737ae2
2024-12-06 05:24:31 -08:00
Rubén Norte be9b076087 Add support for specifying feature flags in pragmas (#48097)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48097

Changelog: [internal]

As per title, this allows us to specify both common and JS-only feature flags for tests in the docblock as pragmas (in the same pragma separated by spaces, or in different pragmas). E.g.:

```
/**
 * fantom_flags commonTestFlag:true
 * fantom_flags jsOnlyTestFlag:true
 */
```

The feature flags are overridden automatically for us before the tests start.

Reviewed By: javache

Differential Revision: D66760121

fbshipit-source-id: 7e227e0035a170dab81b1e6ce39600a01a748867
2024-12-05 17:06:11 -08:00
Rubén Norte da6d089305 Extract logic to get Fantom test config to a standalone module (2nd attempt) (#48119)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48119

Changelog: [internal]

This is a re-land of https://github.com/facebook/react-native/pull/48092

Reviewed By: rshest

Differential Revision: D66820309

fbshipit-source-id: 6b07edcca6988eeb014f6b51ec82296d451bee14
2024-12-05 17:06:11 -08:00
Nikita Rubilov eee5d2ec3c Revert D66760119: Extract logic to get Fantom test config to a standalone module
Differential Revision:
D66760119

Original commit changeset: e955e8f59669

Original Phabricator Diff: D66760119

fbshipit-source-id: ef77a5cdc87efd81bbe503a2a943b1deef4a7e15
2024-12-05 06:46:15 -08:00
Rubén Norte bc0b5ca5df Extract logic to get Fantom test config to a standalone module (#48092)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48092

Changelog: [internal]

This is just in preparation to expand the scope of that function to include configuration for feature flags.

Reviewed By: javache

Differential Revision: D66760119

fbshipit-source-id: e955e8f596697ac6a0a87013bec3fc3e09caf19d
2024-12-05 05:18:08 -08:00
Rubén Norte b487e65869 Add support for expect() .toBeLessThan and .toBeGreaterThan (#48086)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48086

Changelog: [internal]

Just adding a bit of coverage for the `expect` API adding `toBeLessThan` and `toBeGreaterThan`.

Reviewed By: sammy-SC

Differential Revision: D66753268

fbshipit-source-id: 6a26f558f985ccbb5eb0daacecd93759841149e9
2024-12-05 05:18:08 -08:00
Rubén Norte ff934cd249 Extract definitions for expect and mocks from generic test setup to standalone modules (#48083)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48083

Changelog: [internal]

Just a small refactor to have a better code organization for the testing runtime infra.

Reviewed By: sammy-SC

Differential Revision: D66753269

fbshipit-source-id: e68727fe45fabe0be3528e21d5a60cef3045c252
2024-12-05 05:18:08 -08:00
Andrew Datsenko 2e444d2b40 Add ReactNativetester#getRenderedOutput() API (#47970)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47970

Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D65617491

fbshipit-source-id: 49369b694a81b7dfb541c75d9e24b62fc141d980
2024-12-04 09:55:56 -08:00
Andrew Datsenko dc88683798 Corrently symbolicate message (#48048)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48048

Changelog: [Internal]
Some messages may contains multi line content, ie snapshot comparison, multiline strings comparison.

Fixing this by checking first code pointer in the stack and slicing from there.

Reviewed By: christophpurrer, rubennorte

Differential Revision: D66660107

fbshipit-source-id: 57cea02cf6aae3c24f351504c2e077b5a2de0761
2024-12-02 11:16:03 -08:00
Rubén Norte 0580e88aa5 Allow tests to specify opt/dev mode (#48022)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48022

Changelog: [internal]

This adds support for Fantom options in tests to configure different aspects of the test execution.

For now, it only supports specifying the mode (dev or opt) so we can try things without having to change the runner (watch mode still works if you change mode :D).

Fantom options are specified as pragmas in the docblock of the test. E.g.:

```
/**
 * flow strict-local
 * format
 * fantom_mode opt
 */
```

We expect this is mostly going to be used for one-time tests and that regular tests won't specify the mode (they'll just run in dev mode).

Maybe we can evolve this in the future to specify that you want a test to be executed in both modes, to ensure the behavior is consistent in dev/prod.

Reviewed By: rshest

Differential Revision: D66597626

fbshipit-source-id: b12325fc2235740cc2a3e0283d6a556091c1794c
2024-12-02 06:06:26 -08:00
Rubén Norte 762389f775 Extract logic to debug command errors to shared function (#48019)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48019

Changelog: [internal]

Just a minor refactor to reduce code duplication.

Reviewed By: rshest

Differential Revision: D66596730

fbshipit-source-id: 2afa501cd5664402adf4aceba059a4d987c3ed62
2024-12-02 06:06:26 -08:00
Rubén Norte 4bced9099a Implement warm up step to remove costly builds from individual test running time (#48015)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48015

Changelog: [internal]

Right now, when we run individual Fantom tests, we compile Hermes and the RN Tester CLI as part of the test, which causes the first test to run to be very slow and the remaining tests in the same run to be very fast.

This is misleading because it makes it look like the test itself is slow, when it's actually paying a price for everyone.

Fortunately, Jest has an option to do a global setup before any tests in the project run (and it doesn't run if none of the tests in the project run, in multi-project setups), so we can use it to do the necessary warmup so it doesn't end up being attributed to individual tests.

Reviewed By: javache

Differential Revision: D66595406

fbshipit-source-id: 496aa2b248da661f7504c8445fed1edad0301803
2024-12-02 06:06:26 -08:00
Rubén Norte 21cc745d51 Extract some logic from runner to utils module (#48014)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48014

Changelog: [internal]

Just a small refactor in preparation for a following change that will add more usages for these utilities. It also cleans up the runner file which is good too.

Reviewed By: javache

Differential Revision: D66595405

fbshipit-source-id: e734d76006ce937fadd1cb673035db85a3e838dd
2024-12-02 06:06:26 -08:00
Rubén Norte b6f2b148f4 Add suppor for toBeLessThanOrEqual and toBeGreaterThanOrEqual (#48040)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48040

Changelog: [internal]

We need more expectations for a new test we're writing. This just adds:
* `expect(received).toBeLessThanOrEqual(expected)`
* `expect(received).toBeGreaterThanOrEqual(expected)`

Reviewed By: sammy-SC

Differential Revision: D66601921

fbshipit-source-id: 0a73f7757117ed790b95796b259244c8259136b7
2024-12-02 04:47:17 -08:00
Rubén Norte 7ccc5934d0 Implement symbolication of error stack traces (#48006)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48006

Changelog: [internal]

This implements symbolication of error stack traces in Fantom tests. We just needed to ask Metro to generate source maps and use the `source-map` package to process the stack traces that we get back from the runtime.

Reviewed By: sammy-SC

Differential Revision: D66577818

fbshipit-source-id: 672c66c246ad8646646d5ed31cabca39eb4f7aca
2024-11-28 07:59:26 -08:00
Rubén Norte 6ae49ee9e3 Improve error messages in tests (#47994)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47994

Changelog: [internal]

This adds a few hacks to improve errors messages in Fantom tests. Before, we were only logging the error message. After this, we log the message and the full (unsymbolicated for now) stack, including a pretty print of the exact location of the error.

For errors thrown from `expect` functions, the stack trace is modified to remove the "infra" lines from the stack.

The next step is symbolicating the errors using source maps generated by metro.

Reviewed By: javache

Differential Revision: D66555063

fbshipit-source-id: 17bd23cb30429a17e99f13f934c45e001120bbb3
2024-11-28 04:31:20 -08:00
Rubén Norte 6c581c9b9b Allow JS_DIR path to be relative to cwd (#47877)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47877

Changelog: [internal]

Reviewed By: sammy-SC

Differential Revision: D66302814

fbshipit-source-id: 55d6f86d098673e28fad71a43863f2041810d04b
2024-11-21 09:14:45 -08:00
Rubén Norte 9f604dbd43 Watch changes in C++ files (#47871)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47871

Changelog: [internal]

No need to keep going back to save test files when we change C++ files and need to re-run tests :)

Reviewed By: javache

Differential Revision: D66293212

fbshipit-source-id: dc232e1d3f7f8ae1578e894ce14bd21ccf3c8ade
2024-11-21 03:58:36 -08:00
Rubén Norte 92a476661c Add flag to force running tests in optimized mode (#47870)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47870

Changelog: [internal]

This flag allows us to run optimized mode by using the right buck modes for the Fantom CLI, using minified + dev in Metro and building bytecode using Buck as well.

It's disabled by default but in the future we can enable it based on the configuration in the test file (e.g.: if it's a benchmark) or we can run tests in both modes by default to catch problems caused by the differences between environments.

Reviewed By: rshest

Differential Revision: D66292709

fbshipit-source-id: d25294b739ff6a67507990241784b838d5b30dcd
2024-11-21 03:58:36 -08:00
Rubén Norte b2f624d054 Add flag to print Fantom logs in Jest output (#47758)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47758

Changelog: [internal]

This helps with debugging when adding logs in native code. By default they're logged to stderr and not shown in the Jest output, but we can opt into getting them with this new flag.

Reviewed By: sammy-SC

Differential Revision: D66232572

fbshipit-source-id: d507fa4438ae46988fafc92123d0954ab3d27631
2024-11-20 10:00:48 -08:00
Rubén Norte 737045217b Implement expect().toEqual() (#47697)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47697

Changelog: [internal]

Implements `expect(received).toEqual(expected)` in Fantom tests.

Reviewed By: sammy-SC

Differential Revision: D66108539

fbshipit-source-id: 4e1d2405064900ec9859220fb6a28ec25a5176f3
2024-11-20 04:27:10 -08:00
Samuel Susla 6f1cf004fa add expect().toBeNull() (#47716)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47716

changelog: [internal]

Add toBeNull check to Fantom.

Jest docs: https://jestjs.io/docs/expect#tobenull

Reviewed By: javache

Differential Revision: D66167811

fbshipit-source-id: 33b6cf362bcf1636f41b78dc6c84905b80be994e
2024-11-19 10:52:08 -08:00
Rubén Norte 05874c831b Implement toThrow(message) with a specific error message string (#47700)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47700

Changelog: [internal]

Add support for the string parameter for `toThrow` to assert for specific error messages.

Reviewed By: sammy-SC

Differential Revision: D66118001

fbshipit-source-id: 8c04cd20d4ad17163ec0c7bf943c429507a97985
2024-11-19 07:56:49 -08:00
Rubén Norte 47882f0000 Implement jest.fn(), expect().toHaveBeenCalled() and expect().toHaveBeenCalledTimes() (#47699)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47699

Changelog: [internal]

Implements a `jest.fn()` and a subset of methods in `expect` using them (`.toHaveBeenCalled()` and `.toHaveBeenCalledTimes()`).

Reviewed By: sammy-SC

Differential Revision: D66118002

fbshipit-source-id: 5422307d68967d7d8b4c4d5155a45926f8fc8cae
2024-11-19 07:56:49 -08:00
Samuel Susla 4cb82501a3 add test for Suspense and Suspense with startTransition (#47714)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47714

changelog: [internal]

Reviewed By: rshest

Differential Revision: D66093340

fbshipit-source-id: 1db205d42d0570ab9c77ba0363ffac0d2dd81071
2024-11-19 07:41:17 -08:00
Rubén Norte 4da6ed5caf Use Meta-specific renderers when running tests in Meta infra (#47705)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47705

Changelog: [internal]

Reviewed By: sammy-SC

Differential Revision: D66094272

fbshipit-source-id: 25c0bc2d9e68ed1f4ede9dc5f0470a530b5db7d0
2024-11-19 05:53:26 -08:00
Rubén Norte 7be98c99bd Filter out AppRegistry logs from output (#47658)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47658

Changelog: [internal]

AppRegistry logs are showing up again in Fantom because we changed the order and now they're not necessarily showing up last.

This fixes that by filtering them out in any position.

Reviewed By: sammy-SC

Differential Revision: D66094274

fbshipit-source-id: bd37394252ee6309f7093567f9a2b73b641938ce
2024-11-18 04:38:43 -08:00
Samuel Susla 89a7238acd introduce ability to flush messege queue from tests (#47646)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47646

changelog: [internal]

In order to control scheduling of tests, test setup must be separated from test running. This is because of how internal scheduling of React Native is restricted until bundle is loaded via BufferedRuntimeExecutor. This is the reason for executing tests by calling global function `$$RunTests$$`. This is not a pretty solution but it is hidden within testing infrastructure and users of our test infra are not exposed to this.

There is a new method exposed to JavaScript: flushMessageQueue. This will flush everything that is inside of message queue. This is the queue where tasks are queued whenever RuntimeScheduler enqueues something by calling `runtimeExecutor_`.

Reviewed By: christophpurrer

Differential Revision: D65951894

fbshipit-source-id: 2e8e0c10fbeb998f4a51ee6d01ef229eb5f70448
2024-11-17 03:30:31 -08:00
Rubén Norte 058624fc1d Add support for focused and skipped tests in React Native integration tests (#47559)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47559

Changelog: [internal]

Adds support for focused and skipped tests and describe blocks:
* `fdescribe` / `describe.only`
* `xdescribe` / `describe.skip`
* `fit` / `it.only` / `test.only`
* `xit` / `it.skip` / `xtest` / `test.skip`

Reviewed By: rshest

Differential Revision: D65769325

fbshipit-source-id: ea26ae533400390b2efc4f2369340e5dc73c5d50
2024-11-15 03:00:17 -08:00
Rubén Norte d417788b24 Hook up RN integration tests in Jest pipeline at Meta (#47613)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47613

Changelog: [internal]

Reviewed By: sammy-SC

Differential Revision: D65661703

fbshipit-source-id: 269444f8f7124082f06ffcf89cec40992a107d67
2024-11-15 03:00:17 -08:00
Rubén Norte 07b34f4ca3 Add Flow typing for test runner for RN integration tests (#47612)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47612

Changelog: [internal]

Just using babel-register so we can use Flow types in the code for the RN integration tests runner.

Reviewed By: sammy-SC

Differential Revision: D65948801

fbshipit-source-id: 6c54b0463fe4b71c818ff1c4faa973cc8b13b5d2
2024-11-15 03:00:17 -08:00
Rubén Norte 48b361688f Fix some broken expectations in RN integration tests (#47615)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47615

Changelog: [internal]

Fixes `.not` not being applied in some cases, and no logging the "not" label in case of error, and `.toBe` being flipped.

Reviewed By: javache

Differential Revision: D65952221

fbshipit-source-id: 030c0597b661d34e6324d69e5676375150a74f2e
2024-11-15 03:00:17 -08:00
Rubén Norte 849c139a4c Initial implementation of Jest test runner for RN integration tests (#47558)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47558

Changelog: [internal]

Reviewed By: sammy-SC

Differential Revision: D65661701

fbshipit-source-id: 0f0227debc769d0cebebc1989cbcfbbdd44dfc34
2024-11-14 06:20:47 -08:00
Tim Yung c9ea05552f RN: Fix lint/sort-imports Errors (#47109)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47109

Fixes the `lint/sort-imports` errors that are now surfaced after fixing the lint configuration.

For a couple files, I added lint suppressions instead because the unsorted import ordering is important due to interleaved calls with side effects.

Changelog:
[Internal]

Reviewed By: GijsWeterings

Differential Revision: D64569485

fbshipit-source-id: 26415d792e2b9efe08c05d1436f723faae549882
2024-10-18 04:07:02 -07:00
Vitali Zaidman 8bbd3a8fb4 do not require @fb-tools/babel-register in open source (#46863)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46863

open source should not require `fb-tools/babel-register`

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D63976514

fbshipit-source-id: 83302adfc8059d294ca568f9edf1aa24d0244933
2024-10-07 09:36:47 -07:00
Alex Hunt 7c2a7de162 Bump Metro to 0.81.0-alpha.2 (#46703)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46703

Updates us in line with the release branch and unblocks https://github.com/facebook/react-native/pull/46627.

Changelog: [Internal]

Reviewed By: hoxyq

Differential Revision: D63544047

fbshipit-source-id: 4c093e6c2fc389888f12063df013db7023761859
2024-10-01 11:27:41 -07:00
Alex Hunt 33b78ee080 Substitute babel-preset-fbjs for metro-transform-plugins (#46689)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46689

Resubmission of D61014834 / https://github.com/facebook/react-native/pull/45959 (previously reverted).

> Addresses TODO comment. I noticed this lone reference to babel-preset-fbjs (last published 3y ago) while attempting to upgrade our Babel Flow syntax plugin.

Changelog: [Internal]

Reviewed By: hoxyq

Differential Revision: D63532211

fbshipit-source-id: e94b55b7b61194b50131b36a2fe817e149152953
2024-09-27 10:36:42 -07:00
Rexogamer de2f9c0f77 fix: clean up various ESLint issues (#46379)
Summary:
this PR fixes a few small ESLint issues that were showing up under PR diffs.

## Changelog:

[INTERNAL] [FIXED] - Fix various ESLint issues

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

Test Plan: ran JS tests + linter; all passing

Reviewed By: cipolleschi

Differential Revision: D62385788

Pulled By: NickGerleman

fbshipit-source-id: b33d7ade4696bbaed2ac1a3fc2e0b3dff9bb04b7
2024-09-17 13:07:20 -07:00
Gijs Weterings f2aa3fe0ec Revert D61014834: Substitute babel-preset-fbjs for metro-transform-plugins
Differential Revision:
D61014834

Original commit changeset: 26bd1cacf890

Original Phabricator Diff: D61014834

fbshipit-source-id: 6879dc6e1dae7fdb59cfc3bd63ac090cffca26b0
2024-08-09 09:39:26 -07:00
Alex Hunt 82795715ae Substitute babel-preset-fbjs for metro-transform-plugins (#45959)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45959

Addresses TODO comment. I noticed this lone reference to `babel-preset-fbjs` (last published 3y ago) while attempting to upgrade our Babel Flow syntax plugin.

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D61014834

fbshipit-source-id: 26bd1cacf8907550a5c318d4daf70359fb4f5700
2024-08-09 06:28:29 -07:00
Rob Hogan 2055ca0583 Set BUILD_EXCLUDE_BABEL_REGISTER: true under Jest tests (#42690)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42690

Issues triggered by `InspectorProxy*` tests under `packages/dev-middleware` (T169943794) can be root-caused to `dev-middleware` performing Babel registration within a test run, after Jest has hooked its own transformer.

Babel registration is only required when running this code (`dev-middleware`, etc) directly from source - we already have the `BUILD_EXCLUDE_BABEL_REGISTER` mechanism to strip it out from production builds, but we currently don't prevent registration under tests, where Jest's transformer should be allowed to do its work.

This adds the same `babel-plugin-transform-define` mechanism that we use for production builds to the Jest transformer.

Changelog:
[Internal] Prevent inadvertent Babel registration during running of repo tests

Reviewed By: huntie

Differential Revision: D53125777

fbshipit-source-id: 1f0a20315c96edaf79054e29a80c7a9561e5b352
2024-01-27 06:49:15 -08:00
Moti Zilberman d6e0bc714a Enable lint/sort-imports everywhere (#41334)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41334

TSIA.

Changelog: [Internal]

Reviewed By: robhogan

Differential Revision: D51025812

fbshipit-source-id: e10d437be775a6b80946483aa96460f34927f870
2023-11-06 12:59:38 -08:00