|
2 | 2 |
|
3 | 3 | [🏠 Home](../../../__docs__/README.md) |
4 | 4 |
|
| 5 | +> [!WARNING] |
| 6 | +> |
| 7 | +> This is experimental! |
| 8 | +> |
| 9 | +> We are limiting the scope of the project to just React Native internals for |
| 10 | +> now, so we can iterate on it quickly and keep the maintenance costs at bay. |
| 11 | +> |
| 12 | +> In the future, we might explore providing it for testing library/product code |
| 13 | +> internally and externally. |
| 14 | +> |
| 15 | +> This means tests must live in `packages/react-native`. |
| 16 | +
|
5 | 17 | Fantom is the new **integration testing and benchmarking tool for React |
6 | 18 | Native**. |
7 | 19 |
|
@@ -49,18 +61,6 @@ to test cases that are hard to reproduce manually. |
49 | 61 |
|
50 | 62 | ## 🚀 Usage |
51 | 63 |
|
52 | | -> [!WARNING] |
53 | | -> |
54 | | -> This is experimental! |
55 | | -> |
56 | | -> We are limiting the scope of the project to just React Native internals for |
57 | | -> now, so we can iterate on it quickly and keep the maintenance costs at bay. |
58 | | -> |
59 | | -> In the future, we might explore providing it for testing library/product code |
60 | | -> internally and externally. |
61 | | -> |
62 | | -> This means tests must live in `packages/react-native`. |
63 | | -
|
64 | 64 | Create a file with the `-itest.js` suffix anywhere you would normally create a |
65 | 65 | Jest unit test file. |
66 | 66 |
|
@@ -139,11 +139,11 @@ Available pragmas: |
139 | 139 |
|
140 | 140 | #### How is this different from Jest tests? |
141 | 141 |
|
142 | | -Fantom runs C++ part of React Native, as well as JavaScript. This makes it |
143 | | -possible to test things related to shadow nodes, layout, events, scheduling, C++ |
144 | | -state updates to name a few. The results of Fabric are mounted in a mock UI tree |
145 | | -that can be asserted against and individual mounting instructions can be |
146 | | -inspected. |
| 142 | +Fantom runs C++ part of React Native, as well as JavaScript on Hermes VM - |
| 143 | +unlike Jest tests that run on V8. This makes it possible to test things related |
| 144 | +to shadow nodes, layout, events, scheduling, C++ state updates to name a few. |
| 145 | +The results of Fabric are mounted in a mock UI tree that can be asserted against |
| 146 | +and individual mounting instructions can be inspected. |
147 | 147 |
|
148 | 148 | You can even test your C++ code. For example, we have |
149 | 149 | [Fantom tests for the new View Culling optimization](../../react-native/Libraries/Components/ScrollView/__tests__/ScrollView-viewCulling-itest.js), |
@@ -179,17 +179,27 @@ Native. |
179 | 179 |
|
180 | 180 | #### Is Fantom ready for production use cases? |
181 | 181 |
|
182 | | -Fantom is stable and will not go away. For testing specific to React Native, it |
183 | | -is the recommended solution. |
| 182 | +Fantom is a stable and reliable testing framework that is here to stay. If |
| 183 | +you're planning to make changes to React or React Native internals, we highly |
| 184 | +recommend using Fantom as your go-to testing solution. |
184 | 185 |
|
185 | | -For now, it is discouraged to use Fantom for product code testing. |
| 186 | +**Important Note:** While Fantom is ideal for testing React and React Native |
| 187 | +internals, it is not currently supported for testing application-specific code |
| 188 | +in React Native apps. We'll keep you updated on any future developments that may |
| 189 | +change this. |
186 | 190 |
|
187 | 191 | #### Where can I find examples of tests? |
188 | 192 |
|
189 | 193 | Look for files with the `-itest.js` suffix to find existing tests. The Fantom |
190 | 194 | test for its public API ([`Fantom-itest.js`](../src/__tests__/Fantom-itest.js)) |
191 | 195 | has simple examples you can learn from. |
192 | 196 |
|
| 197 | +#### Are tests executed on Github CI? |
| 198 | + |
| 199 | +Fantom tests are currently tied to Meta's infrastructure and do not run outside |
| 200 | +of Meta's CI. We are working on migrating Fantom to Github CI. If you submit a |
| 201 | +PR, the tests will run as part of the PR import process. |
| 202 | + |
193 | 203 | --- |
194 | 204 |
|
195 | 205 | If you have any questions not answered here, please reach out to us. |
|
0 commit comments