cypress-match-screenshot icon indicating copy to clipboard operation
cypress-match-screenshot copied to clipboard

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

Open SirMoustache opened this issue 6 years ago • 5 comments

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.

SirMoustache avatar May 14 '18 15:05 SirMoustache

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

mattbgold avatar Sep 23 '18 20:09 mattbgold

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

amjadalibb avatar Sep 26 '18 22:09 amjadalibb

@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? 🤔

julianburr avatar Sep 28 '18 02:09 julianburr

@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!'); });

amjadalibb avatar Jul 05 '19 01:07 amjadalibb

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

Where do I edit this code?

Kevdog777 avatar Sep 18 '19 08:09 Kevdog777