Open ngladitz opened 1 year ago
Have you figured a solution ? I think I have the same issue.
@DanielCambray Setting the internal CYPRESS_CONFIG_ENV
environment variable to unique values (per test) helped as this results in distinct output directories but this seems to have broken with Cypress 13 which no longer seems to like when I put random values in there.
Current behavior
I've got CI runners with many cores and figured I could run multiple cypress processes in parallel on the same project path to speed up testing. This did seem to work at first but sporadically I see e.g. runs where the support file seems to get skipped (custom commands are for some reason undefined).
I am using typescript and as far as I can tell this is due to Cypress outputting the transpiled sources to a directory that is shared by all parallel invocations with the same project path. Presumably these parallel invocations overwrite and pickup each others outputs in states where the files may be e.g. empty or half written.
Desired behavior
Distinct output directories for parallel invocations presumably would fix this. It looks like Cypress uses the hash of the project path to generate a unique directory to store outputs e.g.
~/.config/Cypress/cy/production/projects/e2e-8a927473225d3c926d92dc9ecd14b752
Perhaps the process id could be added as input to that hash? Though I am not sure when / how / if these directories are ever cleaned up right now so adding the PID may lead to more undeleted files.
Test code to reproduce
The race condition is difficult to reproduce reliably but I think I could create a test case (if needed) which may have to run for a long while to trigger though and may trigger faster on some systems than others.
Cypress Version
12.1.0
Node version
v16.16.0
Operating System
Windows 10/11, Ubuntu 22.10
Debug Logs
No response
Other
No response