Skip to content

Jest fails with CRA v5.0.0 #12157

@Huespal

Description

@Huespal

Describe the bug

react-scripts test command fails after updating the project to CRA (react-scripts) version 5.0.0. In previous versions it was working fine.
The error is this:

TypeError: _interopRequireWildcard is not a function

This is a continuation of #11043 (comment)

Did you try recovering your dependencies?

Yes.

Which terms did you search for in User Guide?

Jest
Webpack 5
TypeError: _interopRequireWildcard is not a function
and more

Environment

Using yarn v.3.2.0, in pnp mode, so it seems to make npm packages as Not Found using this command.

Environment Info:

System:
OS: macOS 12.2.1
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Binaries:
Node: 17.3.0 - /usr/local/bin/node
Yarn: 3.2.0 - /usr/local/bin/yarn
npm: 8.3.0 - /usr/local/bin/npm
Browsers:
Chrome: 99.0.4844.51
Edge: Not Found
Firefox: 95.0.2
Safari: 15.3
npmPackages:
react: Not Found
react-dom: Not Found
react-scripts: Not Found
npmGlobalPackages:
create-react-app: Not Found

Steps to reproduce

Into a project with tests set.

  1. yarn
  2. yarn test
  3. Watch the fail

Expected behaviour

Tests are executed successfully, as it happens in previous CRA version.

Actual behaviour

yarn test command fails with an unexpected error. It seems related to babel. I did not add @babel/runtime as I understand is already added internally by react-scripts.

CRA 5 - Jest fail

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