Commit Graph

10 Commits

Author SHA1 Message Date
Andrew Datsenko 10a46f7b52 Add support for JS coverage (#53410)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53410

Changelog: [Internal]
Adding babel-istanbul-plugin to instrument bundle code with coverage reporting.
Metro will transform source code only when coverage flag is set up globally in jest.
Coverage map is then provided by runner as part of test result.

Reviewed By: sammy-SC

Differential Revision: D80716433

fbshipit-source-id: 3831f227f8793f874f0d2366759bb6916e747c72
2025-09-04 07:19:56 -07:00
Rubén Norte 9c201c0f8f Automatically inject debugger statements in tests in preparation for debug mode (#53205)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53205

Changelog: [internal]

This injects a custom Babel transform for Fantom tests that automatically injects `debugger` statements in the generated code. This simplifies debugging by providing a default interruption point in the test setup for the test author to decide what to debug.

This has no effect unless the debugger is opened, which isn't happening yet.

Reviewed By: rshest

Differential Revision: D79996000

fbshipit-source-id: 6153587264d293a067e359edba4f64f41898c506
2025-08-12 05:41:11 -07:00
Rubén Norte 5c2b9eda69 Refactor runner to use a single instance of Metro for each run (#52777)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52777

Changelog: [internal]

This significantly speeds up test execution in Fantom (around 2x in OSS and 6x at Meta) by starting a Metro server before all tests runs and reusing it across all tests to build test bundles, instead of spinning up a new Metro instance every time we run each test.

The architecture change (also considering the previous change in buck prebuilds) looks like this:
{F1980689532}

This is how is impacts execution times (compared to the baseline):
* OSS
  * Before: 62s {F1980564286}
  * After: 30s (**2x faster**) {F1980564265}

Reviewed By: andrewdacenko

Differential Revision: D78741903

fbshipit-source-id: b209f88925e49cc2a2067e8df9b7fa9a29b4c8d2
2025-08-04 05:56:51 -07:00
Rubén Norte 3c087fc81c Small refactor of Fantom global setup (#52766)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52766

Changelog: [internal]

Just a minor refactor so adding more logic that should work both at Meta and in OSS is easier in the next diff

Reviewed By: christophpurrer

Differential Revision: D78741904

fbshipit-source-id: 3abda5d5b7be157bf381e26dad2fd4b064a0f556
2025-07-23 04:41:42 -07:00
Rubén Norte fec6a0adf1 Set displayName for Fantom configuration (#52778)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52778

Changelog: [internal]

Jest has an option to select a specific project when running tests:

```
jest --selectProjects fantom
```

But for this to work, a `displayName` option needs to be set in the project configuration. This adds that for Fantom tests (using `fantom`).

Reviewed By: rshest

Differential Revision: D78802516

fbshipit-source-id: 483e7c1450b1f97961e4e43c963fac3ce82cee58
2025-07-23 04:41:42 -07:00
Christoph Purrer b5329ecd6d NativeCxxModuleExample test for testing C++ TM E2E (#52477)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52477

Changelog: [Internal]

This adds a Fantom test for

https://github.com/facebook/react-native/blob/main/packages/rn-tester/NativeCxxModuleExample/NativeCxxModuleExample.js

to test a C++ Turbo Module End 2 End (loading the C++ implementation in native code, accessing in JavaScript via Hermes VM and verifying the results of the API calls)

Reviewed By: rshest

Differential Revision: D77848654

fbshipit-source-id: 48a4ab88a330e9282ae8dab589743eaace62d124
2025-07-08 21:10:36 -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
Andrew Datsenko d0770ce425 Introduce isOSS (#52222)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52222

Changelog: [Internal]
Introduce environment option to force usage of OSS fantom test runner.
If env is not set - check for BUCK file in tester which is checked in for FB but not for OSS.

Reviewed By: rubennorte

Differential Revision: D77160761

fbshipit-source-id: 1701ff140ff2be1bbeacfb4305e9f89089cacb42
2025-06-26 11:03:20 -07:00
Tim Yung 98f5a4e118 Fantom: Enable hermesParser in Metro Transform (#52021)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/52021

Enables the `hermesParser` option in Fantom tests.

Notably, this configures parsing with `hermes-parser` to use `reactRuntimeTarget: '19'`.

Changelog:
[Internal]

Reviewed By: robhogan

Differential Revision: D76641340

fbshipit-source-id: a2dcdbe8cab838481dd37c251d03d1e6fffdf346
2025-06-14 06:41:00 -07:00
Tim Yung d6f29c8afd RN: Move {packages => private}/react-native-fantom (#51938)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51938

Moves `packages/react-native-fantom` to `private/react-native-fantom`.

Changelog:
[Internal]

Reviewed By: huntie

Differential Revision: D76368959

fbshipit-source-id: 8d62f792229c10cd108dc849e8629d3174dc72c1
2025-06-11 23:49:51 -07:00