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

Documentation to code coverage #125

Open
philippjenni opened this issue Nov 16, 2021 · 5 comments
Open

Documentation to code coverage #125

philippjenni opened this issue Nov 16, 2021 · 5 comments
Labels
cypress-angular enhancement New feature or request

Comments

@philippjenni
Copy link

Is there any documentation how i can use or integrate code coverage for my tests. I use the 'cypress-angular' plugin to test components in an angular sub project. That works fine but i would like use code coverage for the project. The components are loaded with mount and then tested.

@yjaaidi
Copy link
Member

yjaaidi commented Nov 17, 2021

Hi @philippjenni, this is in fact an interesting feature that we didn't dive into yet.
We would be more than happy if you or anyone else could help us out 😊

Thank you for raising this.

@yjaaidi yjaaidi added enhancement New feature or request cypress-angular labels Nov 17, 2021
@philippjenni
Copy link
Author

I have tried it to integrate with "istanbul-instrumenter-loader". The problem is, that is currently not possible to inject the required coverage webpack to the devserver. There are some examples, how codecoverage is to be integrated with cypress, but it requires always to inject the webpack config.

@andrew-cunliffe
Copy link

Just been trying to do this, we get coverage from cypress normally by using the ngx-build-plus library as per this example https://github.com/skylock/cypress-angular-coverage-example would be great if it would respect the coverage.webpack.js file already used for this too

@philippjenni
Copy link
Author

I tried to pass the settings to the web server via the webpackConfig property. This works as far as possible. The configuration in the DevWebServer looks OK, but the Coverage variable is not filled during the test, which leads to the message that the instrumentation was not started.

At the moment I have no idea what the problem is.

@philippjenni
Copy link
Author

I have pushed my test repo to https://github.com/philippjenni/angular-library-cypress
Any tip on how to get the coverage running is welcome. The coverage with the main project is working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cypress-angular enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants