Skip to content

16.1.0 breaks tests using React 18 #1369

@gismya

Description

@gismya
  • @testing-library/react version: 16.1.0
  • Testing Framework and version:
    Vitest 2.0.5
  • DOM Environment:
    JSDOM 25.0.1

Relevant code or config:

npm run update;

What you did:

Updated @testing-library/react from 16.0.1 to 16.1.0

What happened:

My tests using @testing-library/react started throwing errors.

Error: A React Element from an older version of React was rendered. This is not supported. It can happen if:
- Multiple copies of the "react" package is used.
- A library pre-bundled an old copy of "react" or "react/jsx-runtime".
- A compiler tries to "inline" JSX instead of using the runtime.

Problem description:

Not sure if it's a general issue or specific to our usage. We are only using it in one test file, and the methods we are importing and using are act, renderHook, waitFor.

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