Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

325
Views
Test the new Error() message with Cypress

I went over the documentation of cypress and i did not find any details about how to test if a error was thrown in javascript like:
throw new Error('my error');
Question: Is there a solution to test if a error wast thrown like i showed above, or to test the message?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Such an error is an Uncaught exception from your application

When Cypress detects an uncaught exception in your application, it will fail the currently running test.

You can turn off this behavior globally or conditionally with the uncaught:exception event. Please see the Catalog of Events for examples.

Cypress.on('uncaught:exception', (err, runnable) => {
  expect(err.message).to.eq('my error')
  return false
})
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!