You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cannot test that a component throws an error. Always fails the test because Cypress has no .catch method.
Desired behavior
Can test a component throws an error
Test code to reproduce
import{mount}from'@cypress/react'it('throws',(done)=>{cy.on('uncaught:exception',(err,runnable)=>{expect(err.message).to.include('Expected to throw')done()returnfalse})constMyComponent=()=>{constthrowError=()=>thrownewError('Expected to throw')return<divonClick={throwError}>Click me to throw</div>}mount(<MyComponent></MyComponent>).get('div').click()})
Versions
The text was updated successfully, but these errors were encountered:
Current behavior
Cannot test that a component throws an error. Always fails the test because Cypress has no
.catch
method.Desired behavior
Can test a component throws an error
Test code to reproduce
Versions
The text was updated successfully, but these errors were encountered: