dudeNumber4
dudeNumber4

Reputation: 4697

Can't run Cypress Open

I recently took over a cypress project; running on windows. The first time I installed, all was working. Now, subsequent to upgrading node/electron/chrome, I can't open cypress with any command. Here's what I tried:

At that point I can see cypress in my process list, but the UI never shows. I can run headless tests normally, so I'm OK from a CI perspective, but I still want to open the UI with my tests locally. I can launch the cypress executable in my user dir and then open my project root directory manually, but can't run an open command normally. The scripts section of package.json doesn't seem to be designed to accept a path to an exe with params.

Is there another way to call open that I'm missing?

Upvotes: 7

Views: 27863

Answers (6)

Gss Raghu Ram
Gss Raghu Ram

Reputation: 1

Using this in my code solved the issue

cypress (folder) -->support --> index.ts

add this:

import './commands'

Cypress.on('uncaught:exception', (err, runnable) => {

// returning false here prevents Cypress from failing the test

return false

})

Upvotes: 0

user15442670
user15442670

Reputation: 1

I can't use command npm to open cypress neither, but command npx works well. So you can try this in your visual studio code: npx cypress open

Upvotes: 0

Aviv
Aviv

Reputation: 14477

Solution: Go to your project directory which you installed cypress, in your package.json update the cypress version to the latest , look at the releases versions link, or just install the latest from cli:

npm install cypress@latest --save-dev

Reopen again and verify:

./node_modules/.bin/cypress open
//OR
npx cypress open

Upvotes: 5

Rahil Kumar
Rahil Kumar

Reputation: 428

Didn't work for me as well. I got the same error. I've created new folder in the repo.

  • Run npm init -y
  • Run npm install --save-dev cypress
  • Then go to ./node_modules/.bin/cypress open

And boom the error. I've workaround it by adding:

{
  "scripts": {
    "test": "cypress open"
  }
}

into package.json and run cypress with npm run test

Upvotes: -2

Joshua Wade
Joshua Wade

Reputation: 5293

Did you upgrade the Electron version that Cypress uses? Cypress uses Electron 1.8.2 which is significantly behind the latest, and Cypress does not currently support newer versions of electron. See this Github issue for more info.

Upvotes: 3

womd
womd

Reputation: 3453

try starting with debugging enabled:

DEBUG=cypress:* ./node_modules/.bin/cypress open

Upvotes: 2

Related Questions