Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ReferenceError 'process not defined' when executing Cypress test

Trying to execute any of the tests leads to this error popping up.

I am using Cypress 6.5.0

Really clueless about what to do.

Sorry for the image, but it was much better to show it this way.

enter image description here

And also the StackTrace.

at Object../node_modules/is-ci/node_modules/ci-info/index.js (webpack:///node_modules/is-ci/node_modules/ci-info/index.js:5:1)
at __webpack_require__ (webpack:///webpack/bootstrap:19:1)
at Object../node_modules/is-ci/index.js (webpack:///node_modules/is-ci/index.js:3:18)
at __webpack_require__ (webpack:///webpack/bootstrap:19:1)
at Object.eval (webpack:///node_modules/cypress/lib/util.js:21:14)
at Object../node_modules/cypress/lib/util.js (http://localhost:37869/__cypress/tests?p=test/e2e/support/index.js:87250:31)
at __webpack_require__ (webpack:///webpack/bootstrap:19:1)
at Object.eval (webpack:///node_modules/cypress/index.js:9:14)
at Object../node_modules/cypress/index.js (http://localhost:37869/__cypress/tests?p=test/e2e/support/index.js:82972:31)
at __webpack_require__ (webpack:///webpack/bootstrap:19:1)
From previous event:
at runScriptsFromUrls (http://localhost:37869/__cypress/runner/cypress_runner.js:177985:98)
at Object.runScripts (http://localhost:37869/__cypress/runner/cypress_runner.js:177999:11)
at $Cypress.onSpecWindow (http://localhost:37869/__cypress/runner/cypress_runner.js:167733:19)
like image 396
lastSheep Avatar asked Feb 25 '21 23:02

lastSheep


People also ask

How to fix uncaught ReferenceError process is not defined?

To Solve Uncaught ReferenceError: process is not defined Error All You Need to do is Just update your react-scripts to v5. Just run this command: npm install –save react-scripts@latest OR npm install react-scripts@latest And Now, your error should be fixed.


2 Answers

This happened for me when I imported cypress within my test, removing that fixed the issue

like image 73
Christopher Slater Avatar answered Oct 10 '22 06:10

Christopher Slater


Sometimes by mistake, Visual Studio Code will auto-import unnecessary libraries. You should delete them. For me it was

import { cli } from 'cypress';

like image 3
canbax Avatar answered Oct 10 '22 05:10

canbax