Skip to content

jest not working with react 17 #10814

@TomDlu

Description

@TomDlu

I have updated react to 17 and configured babel to new automatic runtime. Jest stopped working.
Whats the issue here?
image

Code:

  "scripts": {
    "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
  },
  "jest": {
    "roots": [
      "<rootDir>/src"
    ],
    "moduleNameMapper": {
      "\\.(css|scss|sass)$": "identity-obj-proxy"
    },
    "setupFilesAfterEnv": ['./test.js'],
    "transform": {
      "\\.[jt]sx?$": "babel-jest"
    },
    "testEnvironment": "jest-environment-node",
    "modulePaths": [],
  }
import Enzyme from "enzyme";
import Adapter from "enzyme-adapter-react-16";

Enzyme.configure({ adapter: new Adapter() });
{
    "presets": [
      [
        "@babel/preset-react",
        {
          "runtime": "automatic"
        }
      ]
    ]
  }
import { mount } from 'enzyme';

it("renders", () => {
  const wrapper = mount(<div />);
});

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