getting cypress to work with a plugin via docker, also showing different version

Viewed 458

I'll got a reproducible repo here: https://github.com/opyate/cypress-weirdness

We're using Cypress 9.1.1 and I'm trying to run the tests with:

docker-compose up --exit-code-from cypress

But it has an error, and the weirdest bit is this:

Error: EACCES: permission denied, mkdir '/root/.cache/Cypress/9.4.1'

But I'm not even using 9.4.1 anywhere.

I would greatly appreciate some pointers to make this work, and even clean it up, or use latest Cypress (which I've tried, with its own EACCESS errors...).

(I've also asked this in the Discord.)

1 Answers

This commit fixes it.

I install cypress-file-upload inside the container in /opt, then mount my tests in /opt/e2e.

NPM then looks recursively for the dependency in these places until it finds it:

/opt/e2e/cypress/support/package.json
/opt/e2e/cypress/support/node_modules
/opt/e2e/cypress/node_modules
/opt/e2e/node_modules
/opt/node_modules        # <---- finds the dep here
/node_modules

This setup has the added benefit of not polluting your host with node_nodules, package.json and package-lock.json.

No idea why 9.4.1 shows up in a 9.1.1 build, but I also upgraded Cypress to 9.4.1 and all seems to be working fine.

Related