cypress: Error: EINVAL: invalid argument, mkdir on windows for cypress + windows + Angular project
Current behavior:
When cypres@3.8.3 is run on windows in Angular project, i am getting this type of error when i click on any test specs and try to run and capture image snapshot:
Error: EINVAL: invalid argument, mkdir 'C:\Users\rocks\AppData\Roaming\Cypress\cy\production\projects\styleguide-e2e-a8ba09f50d81ec188e3b12528503dca9\bundles\C:\Users\rocks\project\torque\styleguide\cypress\support
Cypress cache folder is: C:\Users\rocks\AppData\Roaming\Cypress\cy\production\projects for windows.
Desired behavior:
It should not throw any error on windows system.
Test code to reproduce
Package.json
{
"cypress": "3.8.3",
"cypress-axe": "^0.8.1",
"cypress-cucumber-preprocessor": "^2.0.1",
"cypress-image-snapshot": "^3.1.1",
}
NPM command to open cypress:
npm run nx-high-memory -- e2e styleguide-e2e --watch
```
cypress.josn config file
```json
{
"video": false,
"testFiles": "**/*.{feature,features}",
"fixturesFolder": "../../cypress/fixtures",
"integrationFolder": "../../cypress/integration",
"pluginsFile": "../../cypress/plugins/index",
"supportFile": "../../cypress/support/index",
"screenshotsFolder": "../../cypress/screenshots"
}
```
<!-- If we cannot fully run the tests as provided the issue WILL BE CLOSED -->
<!-- Issues without a reproducible example WILL BE CLOSED -->
<!-- You can fork https://github.com/cypress-io/cypress-test-tiny repo, set up a failing test, then link to your fork -->
### Versions
```json
"cypress": "3.8.3",
"cypress-axe": "^0.8.1",
"cypress-cucumber-preprocessor": "^2.0.1",
"cypress-image-snapshot": "^3.1.1",
"chrome": "Version 85.0.4183.102 (Official Build) (64-bit)"
"windows": 10
```
<!-- Cypress, operating system, browser -->
About this issue
- Original URL
- State: open
- Created 4 years ago
- Reactions: 5
- Comments: 32 (7 by maintainers)
We found a workaround for this issue:
Create nested/cypressSupportForWindows.js file with content:
and then change nested/cypress.json to point that file
Can be reproduced with the following repo: https://github.com/ausi/cypress-issue-8599
This results in the following output (only on Windows):
I will help you fix this but trying to reproduce the issue based on snippets and comments is a bit time consuming, can you please upload a repo I can clone and reproduce the issue? That will let me spend more time finding a fix. Thanks!
I am able to reproduce this by setting a relative
supportFilepath in configSetup Reproduction project: https://github.com/artkoselev/cypress8599 OS: Windows Cypress package version: 6.2.1 Cypress binary version: 6.2.1 Electron version: 11.1.1 Bundled Node version: 12.18.3
Reproduction steps
Expected: Cypress visits cypress.io page Actual: Error thrown -
Error: EINVAL: invalid argument, mkdir 'C:\Users\{user}\AppData\Roaming\Cypress\cy\production\projects\nested-0b20f090537cddae1cfb3da2204e4eae\bundles\C:\Users\{user}\cypress8599\supportNotes:
npm testcallsnpx cypress run --project nestedand nested project contains entry"supportFile": "../support/index.js". From the error message it seems that the path gets converted to absolute which results in an invalid argument for ‘mkdir’ -... bundles\C:\Users\{user}\ ...