Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting 'downloadsFolder' option in config as empty string deletes whole project(!) #26393

Open
alexwoollam opened this issue Apr 2, 2023 · 2 comments
Assignees
Labels
E2E Issue related to end-to-end testing Triaged Issue has been routed to backlog. This is not a commitment to have it prioritized by the team. type: bug type: unexpected behavior User expected result, but got another

Comments

@alexwoollam
Copy link

Current behavior

Please see my fork cypress.config.js https://github.com/alexwoollam/cypress-test-tiny/blob/master/cypress.config.js

Adding the config option downloadsFolder: "" and running cypress run results in

Oops...we found an error preparing this test file:

  > cypress/e2e/spec.cy.js

The error was:

Error: Webpack Compilation Error
multi ./cypress/e2e/spec.cy.js
Module not found: Error: Can't resolve '/run/media/alex/93b28b87-f65f-4e20-807f-0d1b65cd0ffe/www/cypress-test-tiny/cypress/e2e/spec.cy.js' in '/run/media/alex/93b28b87-f65f-4e20-807f-0d1b65cd0ffe/www/cypress-test-tiny'
[...]

^- this error is due to the fact cypress has deleted the whole project folder (everything, including .git). This is probably by design, but presuming I didn't set downloadsFolder to the root of the project. Further testing with "../" set, in fact deletes the whole /var/www folder(!!!) (structure: /var/www/project ). Interestingly, I am not running cypress with sudo. I haven't tested this with a folder set as owned by other users yet.

Notes:

  • Strangely running cypress open and running specs, runs as expected.
  • We have hit this on multiple OS', node, npm/yarn and cypress versions.
  • Same behavior was observed using the typescript setup.

To reproduce:

  • clone fork.
  • ls -al see the project.
  • npm install (if needed).
  • cypress run.
  • See error message.
  • ls -al, see an empty folder.

Docs

https://docs.cypress.io/guides/references/configuration#Folders--Files

Cypress package version: 12.8.1
Cypress binary version: 12.8.1
Electron version: 21.0.0
Bundled Node version: 16.16.0

Desired behavior

Please idiot-proof this option.

Test code to reproduce

https://github.com/alexwoollam/cypress-test-tiny/

Cypress Version

12.8.1

Node version

16.1610

Operating System

Debian 11, Manjaro 6.1, MacOS 12

Debug Logs

No response

Other

No response

@alexwoollam
Copy link
Author

Further to the above, I can confirm the following with "../" set:
(in /var/www):

$ git clone git@github.com:alexwoollam/cypress-test-tiny.git
$ sudo mkdir ./something
[..did sudo password..]
$  ls -al 
[... 
    alex:alex cypress-test-tiny
    root:root something 
...]
$ cd cypress-test-tiny
$  cypress run
[...output...]
$  cd ..
$  ls -al
[...(empty)...]

@emilyrohrbough
Copy link
Member

OH MY 😰 what a terrible bug....I didn't even want to try & repo this (yay for docker!). This is problem that definitely needs fixed.

Mind sharing how you discovered this and/why you wanted to set downloadsFolder: "" in the first place?

Looking at where this is called, this is an issue with screenshotsFolder and videoFolder as well.

Is this something you are interested in fixing?

@emilyrohrbough emilyrohrbough added type: bug type: unexpected behavior User expected result, but got another routed-to-e2e E2E Issue related to end-to-end testing labels Apr 5, 2023
@nagash77 nagash77 added Triaged Issue has been routed to backlog. This is not a commitment to have it prioritized by the team. and removed routed-to-e2e labels Apr 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E2E Issue related to end-to-end testing Triaged Issue has been routed to backlog. This is not a commitment to have it prioritized by the team. type: bug type: unexpected behavior User expected result, but got another
Projects
None yet
Development

No branches or pull requests

3 participants