Skip to content

Incorrect props snapshot rendering #1759

Open
@qdanik

Description

@qdanik

Describe the bug

Incorrect snapshot rendering of props components.
P.S. it can be an issue of react-test-renderer

Code Example:

<ScrollView
  testID="scroll-view"
  refreshControl={
    <RefreshControl refreshing={refreshing} onRefresh={callback} />
  }
>
 <SomeScrollViewData />
</ScrollView>

Expected behavior

I want to see like a structured JSX component in snapshot output.

Example:

<RCTScrollView
    onScroll={[Function]}
    refreshControl={
      <RefreshControlMock
        onRefresh={[Function]}
        refreshing={false}
      />
    }
    testID="scroll-view"
  >
    <RCTRefreshControl />
    <SomeScrollViewData />
</RCTScrollView>

Steps to Reproduce

Setup empty project with listed dependencies and render example (provided below) using output toJSON method from the render(). To avoid RangeError: Invalid string length error during testing please setup snapshotFormat: { maxDepth: 10 } in jest.config.js, probably this is also an issue.

Screenshots

Image

Versions

npmPackages:
@testing-library/react-native: 13.1.1 => 13.1.1
jest: 29.7.0 => 29.7.0
react: 19.0.0 => 19.0.0
react-native: 0.78.2 => 0.78.2
react-test-renderer: 19.0.0 => 19.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions