I’m trying to push my brach-code for merging, but I’m stuck on this error after I tried running the command: npm test
Error: Test suite failed to run
ReferenceError: global is not defined
at Object.<anonymous> (node_modules/graceful-fs/graceful-fs.js:92:1)
I saw a solution regaring it in on the platform and tried adding
`”jest-environment-jsdom”: “^27.0.6” as a dev dependency, but that didn’t resolve my error.
Here’s a copy to my package.json file:
{
"name": "reactapp",
"version": "0.1.0",
"license": "GPL-2.0",
"engines": {
"node": ">=14.0.0 <15"
},
"private": true,
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^1.2.36",
"@fortawesome/free-regular-svg-icons": "^5.12.1",
"@fortawesome/free-solid-svg-icons": "^5.15.4",
"@fortawesome/react-fontawesome": "^0.1.19",
"@sentry/browser": "^4.6.6",
"@tinymce/tinymce-react": "^3.14.0",
"ajv": "^6.12.6",
"ajv-keywords": "^3.5.2",
"axios": "^0.21.2",
"axios-mock-adapter": "^1.22.0",
"bootstrap": "^4.5.3",
"cheerio": "^1.0.0-rc.12",
"classnames": "^2.2.6",
"d3": "^7.8.5",
"date-fns": "^2.14.0",
"diff": "^5.0.0",
"dompurify": "^3.1.3",
"font-awesome": "^4.7.0",
"fs-extra": "^11.2.0",
"global": "^4.4.0",
"history": "^4.10.1",
"html-react-parser": "^1.4.14",
"html-to-pdfmake": "^2.0.6",
"joi": "^14.0.6",
"jquery": "^3.7.1",
"jwt-decode": "^2.2.0",
"leaflet": "^1.9.4",
"lodash": "^4.17.21",
"lz-string": "^1.5.0",
"moment": "^2.29.2",
"moment-timezone": "^0.5.33",
"pdfmake": "^0.1.65",
"prop-types": "^15.7.2",
"react": "^17.0.2",
"react-autosuggest": "^10.1.0",
"react-bootstrap": "^1.0.1",
"react-circular-progressbar": "^2.1.0",
"react-collapsible": "^2.10.0",
"react-datepicker": "^7.6.0",
"react-day-picker": "^7.4.10",
"react-dom": "^17.0.2",
"react-html-parser": "^2.0.2",
"react-icons": "^4.3.1",
"react-input-range": "^1.3.0",
"react-leaflet": "^4.2.1",
"react-leaflet-cluster": "^2.1.0",
"react-modal": "^3.16.3",
"react-multi-select-component": "^4.0.2",
"react-phone-input-2": "^2.14.0",
"react-redux": "^7.2.0",
"react-router-dom": "^5.2.0",
"react-router-hash-link": "^2.3.1",
"react-scripts": "^5.0.1",
"react-select": "^5.7.2",
"react-sticky": "^6.0.3",
"react-table": "^6.10.0",
"react-toastify": "^5.3.1",
"react-tooltip": "^4.2.10",
"react-use-websocket": "^3.0.0",
"reactjs-popup": "^2.0.5",
"reactstrap": "^8.4.1",
"read-excel-file": "^5.5.3",
"recharts": "^2.12.7",
"redux": "^4.0.5",
"redux-actions": "^2.6.5",
"redux-concatenate-reducers": "^1.0.0",
"redux-persist": "^5.10.0",
"redux-thunk": "^2.3.0",
"sass": "^1.83.4",
"tinymce": "^7.2.0",
"typescript": "^4.9.5",
"uuid": "^9.0.1",
"web-vitals": "^2.1.4"
},
"scripts": {
"prestart": "npm run test",
"postinstall": "node ./postinstall.js",
"start": "react-scripts start",
"build": "npm run postinstall && react-scripts build",
"test": "cross-env CI=true react-scripts test --env=jest-environment-jsdom-sixteen",
"test:watch": "react-scripts test --env=jest-environment-jsdom-sixteen",
"test:coverage": "cross-env CI=true react-scripts test --env=jest-environment-jsdom-sixteen --coverage",
"eject": "react-scripts eject",
"start:local": "react-scripts start",
"lint": "eslint . --ext .jsx,.js",
"lint:fix": "eslint --fix . --ext .jsx,.js",
"prepare": "husky install"
},
"resolutions": {
"wrap-ansi-cjs": "^6.0.0",
"jest-environment-jsdom": "^27.0.6"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
],
"devDependencies": {
"@babel/helper-validator-identifier": "^7.12.11",
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@jest/globals": "^27.0.6",
"@testing-library/jest-dom": "^4.0.0",
"@testing-library/react": "^12.0.0",
"@testing-library/user-event": "^13.5.0",
"@types/react-router-dom": "^5.3.3",
"babel-eslint": "^10.1.0",
"cross-env": "^5.2.1",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.8",
"enzyme-to-json": "^3.6.2",
"eslint": "^7.32.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-prettier": "^5.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsx-a11y": "^6.9.0",
"eslint-plugin-prettier": "^3.4.1",
"eslint-plugin-react": "^7.35.0",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-testing-library": "^3.6.0",
"husky": "^7.0.4",
"jest": "^27.0.6",
"jest-environment-jsdom": "^27.0.6",
"jest-environment-jsdom-sixteen": "^2.0.0",
"msw": "^0.19.5",
"node-fetch": "^3.1.1",
"prettier": "^1.19.1",
"redux-mock-store": "^1.5.4",
"sinon": "^7.3.2",
"surge": "^0.21.6"
}
}
Any clues on how to resolve this issue?