module-federation / reunited

Module federation and unit tests
MIT License
34 stars 4 forks source link

Support to React 18 and Testing library #20

Open Exodiel opened 2 years ago

Exodiel commented 2 years ago

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"
    }
    }
  2. Replace enzyme and add @testing-library/jest-dom in jestSetup.js image

  3. Remove snapshotSerializers from jest file image

  4. And this is the error image

alexis-regnaud commented 1 year ago

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