cypress-match-screenshot
cypress-match-screenshot copied to clipboard
CypressError: cy.exec('mkdir -p cypress/screenshots/new')
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.
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
Can you please use node-fs-extra or mkdirp instead of cy.exec ?
@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 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!'); });
Hi @amjadalibb, sorry for a complete novice question...
Where do I edit this code?