-
Notifications
You must be signed in to change notification settings - Fork 108
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
Not working with Storybook 7 #657
Comments
Through local debugging, I've verified that It always returns here: Lines 70 to 73 in 1468c58
Yet... I've added a test step to show that the coverage object can be obtained within the test function. cy.window().then((win) => {
cy.log("coverage object", win.__coverage__);
}); (source) |
The best I can tell, My tests are working correctly with coverage when I change the Line 63 in 1468c58
- beforeEach(() => {
+ afterEach(() => { I don't know what the impacts are for this change. Maybe there can be both a FWIW, I also have this problem when I render Storybook with the Vite builder. (I'm using the default Webpack 5 builder.) |
For the short term, I've added the following monkey patch to my repos to get me rolling again. 😭
"postinstall": "perl -i -pe's/beforeEach/afterEach/g' node_modules/@cypress/code-coverage/support.js", |
I replicated this issue and will forward it to the appropriate team. They will evaluate the priority of this ticket and consider their capacity to pick it up. Please note that this does not guarantee that this issue will be resolved. The ticket will indicate status changes during evaluation, so we ask that you please refrain from asking for updates. Thanks! |
Are you producing source maps? |
Yes. Coverage works with |
For SPA app in general, Changing the timing to |
Logs and screenshots
click for logs...
Versions
"@storybook/addon-coverage"
"babel-plugin-istanbul"
registered in.babelrc.json
window.__coverage__
object? Can you paste a screenshot?.nyc_output
folder? Is there.nyc_output/out.json
file. Is it empty? Can you paste at least part of it so we can see the keys and file paths?Not fully empty, but no coverage reported in it.
see `.nyc_output/out.json`
package.json
(nyc
object) or in other NYC config filesopen `.nycrc`
Describe the bug
I run Cypress e2e tests against my instrumented Storybook stories for React.
After upgrading to Storybook 7, when I run Cypress, I see
window.__coverage__
as expected, but.nyc_output/out.json
never shows coverage within it.This worked with Storybook 6, but only upgrading to Storybook 7 breaks cypress coverage.
I assume the problem might be with conflicting transitive dependencies, but I don't know.
Link to the repo
I have created a new repository to showcase the issue. My application repositories are private.
https://github.com/jfairley/storybook-with-cypress
The text was updated successfully, but these errors were encountered: