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

Support collection of code coverage from multiple services #603

Open
lihaibh opened this issue Oct 18, 2022 · 0 comments
Open

Support collection of code coverage from multiple services #603

lihaibh opened this issue Oct 18, 2022 · 0 comments

Comments

@lihaibh
Copy link

lihaibh commented Oct 18, 2022

Is your feature request related to a problem? Please describe.
It is currently possible to fetch code coverage report from the browser (the frontend code) as well as backend.
However, you can configure only 1 endpoint and if your application is composed of multiple services, we need to be able to extract code coverage from them as well.

Describe the solution you'd like
I want to configure cypress in such a way that it will collect code coverage from multiple endpoints, and remove expectBackendCoverageOnly which i think is redundant for example:

codeCoverage: {
      collectFrontendCoverage: true,
      services: [
        {
          url: `${
            process.env.cypress_baseUrl || 'http://localhost:9001'
          }/__coverage__`,
          remotePath: `/backend`,
          localPath: `${process.cwd()}/backend`,
        },
        {
          url: `http://localhost:9002/__coverage__`,
          remotePath: `/app`,
          localPath: `${process.cwd()}/service2`,
        },
      ],
    },

In order to provide backward compatability, still use the url property, and by default search for coverage from window.originUrl/__coverage__
remotePath and localPath are optional. We need this in case we are running our services on a remote machine / docker container and the paths are not synced with our local sources path.

Describe alternatives you've considered
You can basically create a service that doing the collection for you from all the other services, but its not a good approach.
Additionally, instead of remotePath and localPath you can create a middleware on your service that perform the mapping of the local source path, to what it should be in the docker host, but again it is not a good approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant