julianburr / cypress-match-screenshot

Utility to take screenshots during a cypress test and match them against previous runs
MIT License
58 stars 19 forks source link

CypressError: cy.exec('mkdir -p cypress/screenshots/new') #11

Open SirMoustache opened 6 years ago

SirMoustache commented 6 years ago

Hi, when I try to run this command I get the next error:

OS: Win 10 Git Bash is installed

Command:  exec
cypress_runner.js:139230 Error:    CypressError: cy.exec('mkdir -p cypress/screenshots/new') failed because the command exited with a non-zero code.

Pass {failOnNonZeroExit: false} to ignore exit code failures.

Information about the failure:
Code: 1

Stderr:
The syntax of the command is incorrect.
mattbgold commented 6 years ago

What you're seeing is the cmd output. This is actually a known issue with cy.exec on windows. https://github.com/cypress-io/cypress/issues/789

amjadalibb commented 6 years ago

Can you please use node-fs-extra or mkdirp instead of cy.exec ?

julianburr commented 6 years ago

@amjadalibb Don't have a windows maschine atm to test this, can you give an example (or make a PR) of how to do the same thing with node-fs-extra? I guess cy.launch has the same issue on windows, right? 🤔

amjadalibb commented 5 years ago

@julianburr Sorry for message after a long time.

Try with below, it should work for both windows and mac:

var fs = require('fs-extra'); fs.mkdirs('/tmp/some/long/path/that/prob/doesnt/exist', function(err) { if (err) return console.error(err); console.log('success!'); });

Kevdog777 commented 5 years ago

Hi @amjadalibb, sorry for a complete novice question...

Where do I edit this code?