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

unable to overwrite a cypress error message #30950

Open
I-Laur opened this issue Jan 27, 2025 · 0 comments
Open

unable to overwrite a cypress error message #30950

I-Laur opened this issue Jan 27, 2025 · 0 comments

Comments

@I-Laur
Copy link

I-Laur commented Jan 27, 2025

Current behavior

I want to add a custom comment at the end of a cypress error but it doesn't seem to work

Desired behavior

error message should be overwritten

Test code to reproduce

Cypress.on('fail', (error, runnable) => {
    error.message += `\nCustom comment: ...`
    throw error
  })
  
  describe('failing test', () => {
    it('should fail on purpose', () => {
      cy.visit('https://example.com')
      cy.get('#non-existent-element').should('be.visible')
    })
  })

Cypress Version

13.13.3 (tried on multiple versions)

Node version

v18.18.2

Operating System

Microsoft Windows [Version 10.0.19045.5247]

Debug Logs

Other

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant