Skip to content
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

Custom Chai Assertion Failures Show Failed Line in Test Instead of Support File #28429

Open
Loren-Johnson opened this issue Nov 29, 2023 · 3 comments
Labels
stale no activity on this issue for a long period type: bug type: error message

Comments

@Loren-Johnson
Copy link

What would you like?

In Open mode, when a custom Chai assertion fails, it shows the failure as coming from the support file (e.g e2e.ts) where the this.assert() call is. Ideally, this would show the line in the test that failed like it does for other assertions.

image

This example came from https://github.com/cypress-io/cypress-example-recipes/tree/master/examples/extending-cypress__chai-assertions where I changed line 67 of the spec file from

expect('foo').to.be.foo()

to

expect('foos').to.be.foo()

Why is this needed?

When one of these custom assertions fails, it can be difficult to determine what failed and where because the focus of the failure is shifted from a failed line in the test file to the assertion plumbing code in the support file.

Furthermore, if one wishes to override one of the existing chai assertions, such as .equals(), Cypress now reports ALL failures of that assertion as a failure in the support file rather than the test -- which reduces the value of such a customization.

Other

No response

@cypress-app-bot
Copy link
Collaborator

This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided.

@cypress-app-bot cypress-app-bot added the stale no activity on this issue for a long period label Jun 27, 2024
@Loren-Johnson
Copy link
Author

Confirmed the issue is the same on Cypress 13.12.0

@cypress-app-bot cypress-app-bot removed the stale no activity on this issue for a long period label Jun 28, 2024
@cypress-app-bot
Copy link
Collaborator

This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided.

@cypress-app-bot cypress-app-bot added the stale no activity on this issue for a long period label Dec 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale no activity on this issue for a long period type: bug type: error message
Projects
None yet
Development

No branches or pull requests

3 participants