Repository navigation
Description
Description
I found this when a table test I wrote for Fantom passed the type check and then failed its whole suite when Fantom ran it.
Fantom's runtime defines describe, it and test, their only and skip forms and fdescribe, xdescribe, fit, xit and xtest (runtime/setup.js L102-L206), and none of them gets an each. flow-typed/environment/jest.js declares each on describe (L1043-L1056) and on it (L1122-L1135), which test, fdescribe, xdescribe, xit and xtest take by typeof, so a test written with test.each or describe.each passes Flow, and Fantom then throws TypeError: undefined is not a function at the first .each call. Fantom's README lists it as "test.each is not yet implemented in Fantom" (L82-L85).
Steps to reproduce
- Clone the reproducer below and run
./fantom/reproduce.sh test-each. It needs only Docker: it clonesreact/react-nativeatmain, builds Fantom's tester withyarn workspace @react-native/fantom buildusing Clang and LLD 23.1.3, and runsyarn fantomonfantom/TestEach-itest.js, which holds atest.eachtable of two rows and adescribe.eachtable of two objects.
Expected: four tests, 1 + 1 = 2, 2 + 3 = 5, first receives its row and second receives its row, run and pass.
Actual: the suite fails at test.each before any test runs, and the script exits 1:
[…]
react-native 64af2293efd22d126f405212f29d596531b894ef, committed 2026-12-04T17:40:50+00:00
[…]
FAIL fantom private/react-native-fantom/src/__tests__/TestEach-itest.js
● Test suite failed to run
TypeError: undefined is not a function
9 | */
10 |
> 11 | test.each([
| ^
12 | [1, 1, 2],
13 | [2, 3, 5],
14 | ])('%i + %i = %i', (a, b, sum) => {
[…]
Test Suites: 1 failed, 1 total
Tests: 0 total
[…]
yarn fantom exited with status 1
SUMMARY: test.each is undefined in Fantom's runtime, so the suite fails at it before any test runs
React Native Version
main at 64af229 (newer than 0.90.0-nightly-20261204-82ae0577d); 0.88.1 installs no .each either
Affected Platforms
Other (please specify): Fantom, yarn fantom
Output of npx @react-native-community/cli info
Not applicable: Fantom runs from a checkout of this repository. The reproducer builds and runs it in the reactnativecommunity/react-native-android image with clang version 23.1.3.
Stacktrace or Logs
[…]
FAIL fantom private/react-native-fantom/src/__tests__/TestEach-itest.js
● Test suite failed to run
TypeError: undefined is not a function
9 | */
10 |
> 11 | test.each([
| ^
12 | [1, 1, 2],
13 | [2, 3, 5],
14 | ])('%i + %i = %i', (a, b, sum) => {
at anonymous (private/react-native-fantom/src/__tests__/TestEach-itest.js:11:10)
at global (node_modules/metro-runtime/src/polyfills/require.js:290:6)
at moduleId (node_modules/metro-runtime/src/polyfills/require.js:195:36)
at moduleIdReallyIsNumber (node_modules/metro-runtime/src/polyfills/require.js:104:24)
at _dependencyMap (private/react-native-fantom/.out/js-builds/run-1796407945652/1796407975384-TestEach-itest.js:20:26)
at anonymous (private/react-native-fantom/runtime/setup.js:509:14)
at runWithGuard (private/react-native-fantom/runtime/setup.js:218:7)
at registerTest (private/react-native-fantom/runtime/setup.js:508:15)
at anonymous (private/react-native-fantom/.out/js-builds/run-1796407945652/1796407975384-TestEach-itest.js:20:13)
[…]
MANDATORY Reproducer
https://github.com/YevheniiKotyrlo/react-native-fantom-reproducer
Screenshots and Videos
No response
Activity