A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/bahmutov/app-in-docker-coverage-example below:

bahmutov/app-in-docker-coverage-example: Cypress code coverage example when app runs in a Docker container

App in Docker, Cypress on Host Machine example

This example requires Docker.

  1. Install dependencies

This will install Cypress and @cypress/code-coverage plugin.

  1. Start local application in local Docker container with

You will see it mapping the local folder into container-specific path /var/to/my/app/e2e

-v $PWD:/var/to/my/app/e2e -w /var/to/my/app/e2e

The application runs on port 1234 and instruments all source files on the fly with respect to Docker folder /var/to/my/app/e2e.

  1. Run Cypress tests with

Tests execute, code coverage object is checked to see if the paths in .nyc_output/out.json exist locally. If not, it tries to automatically find how the current working folder matches to the Docker folder and files that $PWD = /var/to/my/app/e2e. You see it from the last debug messages

code-coverage found prefix that matches current folder: /var/to/my/app/e2e +0ms
code-coverage found common folder /var/to/my/app/e2e that matches current working directory /Users/gleb/git/app-in-docker-coverage-example +0ms
code-coverage replaced /var/to/my/app/e2e/app/main.js -> /Users/gleb/git/app-in-docker-coverage-example/app/main.js +0ms
code-coverage replaced /var/to/my/app/e2e/app/second.js -> /Users/gleb/git/app-in-docker-coverage-example/app/second.js +0ms
code-coverage saving updated file /Users/gleb/git/app-in-docker-coverage-example/.nyc_output/out.json +0ms

The report is then generated on the host machine and it has the right files.

~/git/app-in-docker-coverage-example on master
$ open coverage/lcov-report/index.html


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4