Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Cypress is not able to clean /screenshots #4655
On every run, cypress will clean it's screenshots folder (as mentioned in the documentation). Unfortunately on Windows it is likely that the filenames are too long and thus can not be deleted. When cypress tries to do this, it ignores those files.
Cypress should be able to delete them anyway.
I will use a own build step that uses "rimraf" to do this. maybe cypress should include rimraf or similar for this task?
Steps to reproduce: (app code and test code)
Execute cypress from this repo on a Windows 2016 Server.
Please note: It seems that Windows 10 has increased it's max path length. So when using this repo on a Win10 machine, you will have no issues.
Thanks for providing a reproducible example. We shouldn't be creating screenshot files with a filename that is too long - so that we don't run into a problem deleting them.
There is some code to ensure filename length here: https://github.com/cypress-io/cypress/blob/develop/packages/server/lib/screenshots.coffee#L326
Thanks to make that clear.
But I am not sure if this needs to be fixed as stated in https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#short-vs-long-names the new Win10 versions do not have this limitation anymore and also new windows server versions doesn't restrict the length.
By using rimraf I have fixed this for our purpose.