cypress-io / cypress

Fast, easy and reliable testing for anything that runs in a browser.
https://cypress.io
MIT License
46.69k stars 3.16k forks source link

cy.exec fails when Cypress is started from some terminals #15538

Closed sandra-ouadghiri closed 3 years ago

sandra-ouadghiri commented 3 years ago

Current behavior

On a Windows machine (not tested on a linux system)

OK scenario

KO scenario

I discovered this when trying to change my terminal in IntelliJ (Ctrl-Alt-S, Tool > Terminal). I reproduced it outside of my IDE with terminals I launched manually. This only occurs when cypress is in the loop : all terminal replies correctly to my command (whoami) when asked directly.

Results

-> Manual run of whoami -> OK in git bash, cmd & powershell -> Cypress execution when cypress launched from cmd or powershell -> OK image

-> Cypress execution when cypress launched from git bash -> KO image

Please note that my windows path is ok ; my windows computer resolves git bash correctly. Could it be because the windows path to git bash has a space (Program Files) ? Both the "Program:" and the \ and / that are not cohesive in the error message make me think this is the part cypress does not handle well. Maybe a lead.

Desired behavior

I want my code to work the same way (=to compile) agnosticly from what terminal Cypress was launched from. Today, some dev may not be able to execute my valid test code solely because of their terminal preference. That's an issue to me.

Test code to reproduce

This produce. Other commands too. As long as the command inside cy.exec is valid, you can produce with it.

  cy.exec('whoami')

Versions

Produced in 6.5.0

jennifer-shehane commented 3 years ago

I think this is a duplicate of https://github.com/cypress-io/cypress/issues/789 - some Windows users experience this in other terminals. But if you can shed some light on the issue that would be 👍

sandra-ouadghiri commented 3 years ago

Thanks @jennifer-shehane for the triage. You are absolutly right.