Skip to content

Fantom: a test titled by a function, as the Jest types allow, reports no title, a null ancestor title and the function's text as its full name #60589

Backlog

Description

@YevheniiKotyrlo

Description

I found this while reading how Fantom's runtime builds a test's result: a test titled by a function, as describe(MyComponent, () => …) in Jest, reports no title of its own.

flow-typed/environment/jest.js types the title of describe, it and their only and skip forms as JestTestName, string | Function (L184), so Flow accepts a function there. Fantom's runtime stores the title as given (runtime/setup.js L102-L110, L152-L158) and builds the result's title, ancestorTitles and fullName from it (L321-L327): the JSON report drops the function from title, writes it as null in ancestorTitles, and fullName joins each function's text. The reporter then prints the test as ✓ undefined. Jest names a block and a test given a function after the function's name, through jest-util's convertDescriptorToString, which jest-circus applies to both.

Steps to reproduce

  1. Clone the reproducer below and run ./fantom/reproduce.sh function-title. It needs only Docker: it clones react/react-native at main, builds Fantom's tester with yarn workspace @react-native/fantom build using Clang and LLD 23.1.3, with two settings the reproducer adds for that Clang (-Wno-error=deprecated-literal-operator, and SKCMS_NO_RUNTIME_CPU_DETECTION for Skia's skcms), copies fantom/FunctionTitle-itest.js into private/react-native-fantom/src/__tests__/ and runs yarn fantom --json on it:
[…]
function add(a, b) {
  return a + b;
}

describe(add, () => {
  it(add, () => {
    expect(add(1, 2)).toBe(3);
  });
});

Expected: the test's title is add, the describe block's entry in ancestorTitles is add and its fullName is add add, and the reporter prints ✓ add.

Actual: the test passes as ✓ undefined, and the script exits 1:

[…]
react-native eb37db0c4448a7d26684a5d8b4027166c13fc3e2, committed 2026-12-05T08:30:53+00:00
[…]
PASS fantom private/react-native-fantom/src/__tests__/FunctionTitle-itest.js (5.329 s)
  FunctionTitle (hermes)
      ✓ undefined (1 ms)
[…]
== the test's result in /tmp/FunctionTitle-report.json
title: (no such key)
ancestorTitles: ["FunctionTitle (hermes)",null]
fullName: "function add(a0, a1) { [bytecode] } function add(a0, a1) { [bytecode] }"
status: "passed"
SUMMARY: the test's result has no title, the describe block's title in its ancestorTitles is null, and its fullName is the function's text twice

React Native Version

main at eb37db0; 0.88.1 builds fullName the same way

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

[…]
  FunctionTitle (hermes)
      ✓ undefined (1 ms)
[…]

MANDATORY Reproducer

https://github.com/YevheniiKotyrlo/react-native-fantom-reproducer

Screenshots and Videos

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions