Can't run Cypress tests into Docker container.
See original GitHub issueCurrent Behavior
it seems that I cannot run Cypress tests into a Docker container as shown here https://www.cypress.io/blog/2019/05/02/run-cypress-with-a-single-docker-command/.
Expected Behavior
I would hope to run tests either with the @nrwl/cypress-builder or through cypress run
through a docker container.
I can also assure the Cypress tests run fine in case of an Angular workspace/app (without @nwrl/nx installed).
Failure Logs
$ docker run -v /home/dc-user/workbench/:/e2e -w /e2e --entrypoint=cypress cypress/included:4.12.1 run --project ./apps/demo-app-e2e/ --config-file cypress.json
The function exported by the plugins file threw an error.
We invoked the function exported by `/e2e/apps/demo-app-e2e/src/plugins/index.js`, but it threw an error.
Error: Please provide an absolute path to a tsconfig.json as cypressConfig.env.tsConfig
at preprocessTypescript (/e2e/node_modules/@nrwl/cypress/src/plugins/preprocessor.js:18:15)
at module.exports (/e2e/apps/demo-app-e2e/src/plugins/index.js:21:27)
at /root/.cache/Cypress/4.12.1/Cypress/resources/app/packages/server/lib/plugins/child/run_plugins.js:78:12
at tryCatcher (/root/.cache/Cypress/4.12.1/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/util.js:16:23)
at Function.Promise.attempt.Promise.try (/root/.cache/Cypress/4.12.1/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/method.js:39:29)
at load (/root/.cache/Cypress/4.12.1/Cypress/resources/app/packages/server/lib/plugins/child/run_plugins.js:75:7)
at EventEmitter.<anonymous> (/root/.cache/Cypress/4.12.1/Cypress/resources/app/packages/server/lib/plugins/child/run_plugins.js:231:5)
at EventEmitter.emit (events.js:210:5)
at process.<anonymous> (/root/.cache/Cypress/4.12.1/Cypress/resources/app/packages/server/lib/plugins/util.js:19:22)
at process.emit (events.js:210:5)
at process.emit (/root/.cache/Cypress/4.12.1/Cypress/resources/app/packages/server/node_modules/source-map-support/source-map-support.js:495:21)
at emit (internal/child_process.js:876:12)
at processTicksAndRejections (internal/process/task_queues.js:81:21)
Environment
@nrwl/angular : 9.2.4
@nrwl/cli : 9.2.4
@nrwl/cypress : 9.2.4
@nrwl/eslint-plugin-nx : Not Found
@nrwl/express : Not Found
@nrwl/jest : 9.2.4
@nrwl/linter : Not Found
@nrwl/nest : Not Found
@nrwl/next : Not Found
@nrwl/node : Not Found
@nrwl/react : Not Found
@nrwl/schematics : Not Found
@nrwl/tao : 9.2.4
@nrwl/web : Not Found
@nrwl/workspace : 9.2.4
typescript : 3.8.3
Issue Analytics
- State:
- Created 3 years ago
- Comments:32
Top Results From Across the Web
Run Cypress with a single Docker command
Run Cypress with a single Docker command · Running headless tests · Commands and options · Container info · Interactive mode · Docker...
Read more >Cypress cannot run in Docker container - Stack Overflow
I have a web application running in a Docker container. From my understanding, using the 'cypress/base' image should provide the necessary ...
Read more >How to use Cypress tests with docker? | by Knoldus Inc.
How to run cypress tests in Docker? Prerequisite: Install Cypress and create a cypress test. Follow the below blog to solve this.
Read more >Dockerize your Cypress tests | Johnny Metz
It consists of two main commands: cypress run: Runs Cypress tests from the CLI ... We're going to dockerize the cypress run and...
Read more >Executing Cypress scripts inside Docker Container - LinkedIn
Now that we have tried to execute the project locally and tested everything, we can further extend cypress tests to run inside a...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@brunano21 OK, I figured this out.
It’s not complicated as we thought it was.
From the ROOT of your work space:
Basically, the
-v
maps between the folders of the container and the host, it’s not a copy, pure hot link. So we can map it all, including node modules, and just build it on the container.Note that on special scenarios, when using npm packages which require OS compilation (node GYP) and if the host/container are different (win/linux) you might have issues, I didn’t run into any here.
I’d like to avoid any custom configuration or running an npm install into the docker container.