-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
fix(unify): Do not screenshot or trigger the failed event when tests are skipped #19279
fix(unify): Do not screenshot or trigger the failed event when tests are skipped #19279
Conversation
Thanks for taking the time to open a PR!
|
Test summaryRun details
View run in Cypress Dashboard ➡️ Failures
Flakiness
This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard |
@@ -1205,6 +1205,12 @@ export default { | |||
// else just return ret | |||
return ret | |||
} catch (err) { | |||
// If the runnable was marked as pending, this test was skipped | |||
// go ahead and just return | |||
if (runnable.isPending()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What specifically is erroring in the above try block? Could we check is pending up there and return instead of relying on the try block?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mocha is actually throwing the error: https://github.com/mochajs/mocha/blob/ac43029d6a86150a48ccd59e50e89ca10c72a9c0/lib/runnable.js#L143
I don't believe there's a way we could catch it earlier than this as it's being triggered directly from the test being executed here: https://github.com/cypress-io/cypress/pull/19279/files#diff-231d74866a51e1411d172ab6ca0658f7fa712e9676f216ba797c544c47dcbf94R1144
@ryanthemanuel Does this also fix this user's case? If so, I think we should add a test covering that. Probably need tests covering |
…be generated if there is a problem
Good catch @chrisbreiding I added the test case and ensured that snapshots actually would be generated in this case. Previously they were not due to configuration for the driver tests. I was unable to recreate the issue described here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good 👍 It's just a nitpick, but I prefer not to prefix every test title with 'should'. Just ends up being a bit redundant.
User facing changelog
Tests that are skipped within then blocks will no longer throw errors causing the test to fail. Tests that are skipped outside of then blocks will no longer trigger the fail event. This will prevent screenshots from happening from errors thrown by the fail event.
Additional details
When a test is skipped, mocha triggers a "sync skip; aborting execution" error. In investigating #17660, it was determined that #14867 had the same root cause. The main difference is that #17660 deals with synchronous tests and #14867 deals with asynchronous tests. In both cases, the fix is to update the failure handling to check if the test is pending (mocha's indicator that the test was skipped) and not fail in that scenario.
How has the user experience changed?
#17660 Before:
#17660 After:
#14866 Before:
#14866 After:
PR Tasks
cypress-documentation
?type definitions
?cypress.schema.json
?