Skip to content

Incorrect props snapshot rendering #1759

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
qdanik opened this issue Apr 14, 2025 · 0 comments
Open

Incorrect props snapshot rendering #1759

qdanik opened this issue Apr 14, 2025 · 0 comments

Comments

@qdanik
Copy link

qdanik commented Apr 14, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant