So, i made a create-react-app, and it already has npm run test
now, I am importing one library,
import { createWeb3Modal } from '@web3modal/ethers/react'
and this react is imported from here
node_modules/@web3modal/ethers/dist/types/exports/react.tsx
and my App.jsx is in jsx, and this react imported files is in tsx, so, when I run npm run test
,
it gives me error of
FAIL src/components/App/App.test.js
● Test suite failed to run
Cannot find module '@web3modal/ethers/react' from 'src/components/App/App.jsx'
Require stack:
src/components/App/App.jsx
src/components/App/App.test.js
> 1 | import { createWeb3Modal } from '@web3modal/ethers/react'
how to solve this, infact I tried to install typescript still same issue.
my package.json
{
"name": "abc",
"version": "0.1.0",
"private": true,
"dependencies": {
"@sentry/cli": "^2.31.0",
"@sentry/react": "^7.108.0",
"@tanstack/react-query": "^5.28.2",
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"@types/jest": "^29.5.12",
"@types/node": "^20.12.7",
"@types/react": "^18.3.1",
"@types/react-dom": "^18.3.0",
"@web3modal/ethers": "^4.0.13",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-prettier": "^5.1.3",
"eth-connect": "^6.2.4",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-google-recaptcha-v3": "^1.10.1",
"react-redux": "^9.1.0",
"react-router-dom": "^6.22.3",
"react-scripts": "5.0.1",
"recoil": "^0.7.7",
"redux": "^5.0.1",
"typescript": "^5.4.5",
"web-vitals": "^2.1.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build && npm run sentry:sourcemaps",
"test": "react-scripts test",
"eject": "react-scripts eject",
"postbuild": "rimraf ./build/**/*.map"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsx-a11y": "^6.8.0",
"eslint-plugin-n": "^16.6.2",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-react": "^7.34.1",
"eslint-plugin-react-hooks": "^4.6.0",
"sass": "^1.72.0"
}
}
can anyone help me to solve this…