Skip to content
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

Support to React 18 and Testing library #20

Open
Exodiel opened this issue May 11, 2022 · 1 comment
Open

Support to React 18 and Testing library #20

Exodiel opened this issue May 11, 2022 · 1 comment

Comments

@Exodiel
Copy link

Exodiel commented May 11, 2022

This project works fine with the actual dependencies but if the dependencies change to actual versions of React and remove enzyme and replaced it by @testing-library/jest-dom the project it doesn't pass the suite test.
So this steps it will follow if you want reproduce the example

  1. Modify dependencies in package.json
{
  "name": "@module-federation/reunited",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",
  "scripts": {
    "build": "webpack --config federated-test/webpack.test.config.js && webpack --config federated-cross-test/webpack.test.config.js",
    "webpack:test": "yarn build && webpack --config test/webpack.test.config.js",
    "jest": "jest test/bundle.test.js -u",
    "test": "yarn webpack:test && yarn jest",
    "build:demo": "cd federated-test && webpack --config ./webpack.build.config",
    "serve": "webpack --config federated-cross-test/webpack.build.config.js && webpack --config federated-test/webpack.build.config.js && concurrently \"PORT=3000 serve ./federated-cross-test/dist\" \"PORT=3001 serve ./federated-test/dist\" "
  },
  "devDependencies": {
    "jest": "28.1.0",
    "react": "18.1.0",
    "react-dom": "18.1.0",
    "synchronous-promise": "2.0.15",
    "webpack-cli": "4.9.2",
    "webpack-dev-server": "4.9.0"
  },
  "dependencies": {
    "@babel/preset-env": "7.17.10",
    "@babel/preset-react": "7.16.7",
    "@testing-library/jest-dom": "^5.16.4",
    "@testing-library/react": "^13.2.0",
    "@testing-library/react-hooks": "^8.0.0",
    "@testing-library/user-event": "^14.1.1",
    "@webpack-cli/serve": "1.6.1",
    "babel-loader": "8.2.5",
    "html-webpack-plugin": "5.5.0",
    "react-async-ssr": "0.7.2",
    "react-lazy-ssr": "0.2.4",
    "react-ssr-prepass": "1.5.0",
    "serve": "13.0.2",
    "webpack": "5.72.1",
    "webpack-node-externals": "3.0.0",
    "webpack-virtual-modules": "0.4.3",
    "workerpool": "6.2.1"
  }
}
  1. Replace enzyme and add @testing-library/jest-dom in jestSetup.js
    image

  2. Remove snapshotSerializers from jest file
    image

  3. And this is the error
    image

@alexis-regnaud
Copy link

Any solution for that one? I have got exactly the same issue

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

2 participants