You're running Mink / Webdriver tests (or Drupal 8+) Tests and need to assert expected JavaScript errors? Sounds like an easy task, but doesn't seem very well-supported yet. After playing around a bit, this pattern is what worked best:
This post saved you a lot of time and headache?
Then I'd be very happy about a delicious coffee! Or a helpful book from my wish list.
Or are you looking for professional web software development?
Our experienced team at webks GmbH consults, develops & implements individual, innovative web, eCommerce, Drupal CMS & mobile applications.