fix: Do not screenshot or trigger the failed event when tests are skipped #19331
+146
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
?