-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Code coverage in Component Tests #25132
Comments
Hi @dvkuenssberg , thanks for reaching out. Typically questions about plugins are best answered by the plugin author & community, so you may have better luck reaching out to them directly. From what I can see that plugin hasn't been updated in a while and doesn't have any particular support for component testing, but there might be some work in progress or a plan forward. Code coverage in CT is a bit trickier than E2E since it has to hook into the dev server to set up instrumentation. Angular is particularly tricky since it requires customizing the default build process. We're still working on updating our docs & recipes with good examples since each framework handles these concerns differently (and with different levels of ease). Here are a couple example apps I can point you to that might give you a starting point if your chosen plugin doesn't yet have support: |
Hi @mike-plummer, thank you for your answer. Our current E2E testing setup actually uses an approach very similar to the one in the third link you included. We include the This leads me to my next question: do you know how Cypress starts the Angular application in order to run the component tests? Does it call |
@dvkuenssberg I'll try to give a simple and less-simple answer to your question - hopefully one of them helps 😁 Simple Answer More Technical Answer Hopefully that gives you some context. Happy to answer any other questions! |
@mike-plummer Thank you for the explanation! I did some digging yesterday and also found the |
@mike-plummer how would you override certain parts of the webpack config? as I understand, the custom webpack config just gets merged with the default config. so it is not possible to update something in the default configuration, is it? my use case is to add configuration to an existing loader which comes from angular. |
@dvkuenssberg Awesome! Glad to hear you got it working! 🚀 @magile-de You are correct - the Since this GH issue has been answered I will be closing it - if there are additional questions about how to use/configure Cypress I would recommend checking out our Discord server, it can be helpful for debugging or answering questions. |
@mike-plummer thanks for your response and the clarification. I know the possibility to overwrite the config-object was removed to simplify it. And yeah, the developer might break something, if important stuff gets overwritten or removed from that configuration. But, by removing this completely, you are closing the door for a lot of people who already have a custom webpack config, which is a little more complicated than just adding a loader. e.g. if you want to tinker with the scss-loader (like we do) or make changes to postcss, you have to adapt the config which comes from angular. I would reason, that if somebody overwrites plugins or whatever in the webpack-config he/she knows what's happening. |
What would you like?
We currently use code coverage for E2E tests in our project, but would also like to use it with Cypress component tests.
Why is this needed?
Setting up the
component
section incypress.config.ts
similarly to thee2e
section does not seem to successfully recognize code coverage: e.g. one file has 0.5 % coverage despite being thoroughly tested by Component tests.We use this plugin to gather the coverage reports and have them analyzed by SonarQube.
Of course, this would allow to ensure that every component is sufficiently tested.
When running a component test, there is the following warning:
Could not find any coverage information in your application by looking at the window coverage object. Did you forget to instrument your application?
How can we instrument the application so that coverage reports can be generated for component tests?
Other
No response
The text was updated successfully, but these errors were encountered: