Documentation to code coverage
philippjenni opened this issue · 5 comments
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.
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.
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.
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
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.
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.