Skip to content

Cannot find module 'react-dom/test-utils' from 'act-compat.js' #315

Closed
@merraysy

Description

@merraysy
  • react-testing-library version: 6.0.0
  • react version: 15.4.1
  • node version: 8.11.3
  • npm (or yarn) version: 1.12.3

Relevant code or config:

import 'react-testing-library/cleanup-after-each';

What you did:

Just imported the react-testing-library/cleanup-after-each

What happened:

Got this error Cannot find module 'react-dom/test-utils' from 'act-compat.js'

Reproduction:

Problem description:

The react-addons-test-utils was moved to react-dom/test-utils in the version 15.5, that path doesn't work in react-dom <15.5

Suggested solution:

Import from react-addons-test-utils or react-dom/lib/ReactTestUtils for react-dom 15.4.x versions, see this line
https://github.com/kentcdodds/react-testing-library/blob/master/src/act-compat.js#L3

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions