alphagov / accessible-autocomplete

An autocomplete component, built to be accessible.
https://alphagov.github.io/accessible-autocomplete/examples/
MIT License
900 stars 147 forks source link

Ensure tests fail when an uncaught error or unhandled rejection happens in the browser #679

Open romaricpascal opened 4 months ago

romaricpascal commented 4 months ago

What

Update our tests so they fail when an uncaught error or unhandled rejection happens in the browser.[^1]

Why

Some tests may have their assertions pass, but an error being displayed in the console because of something breaking but not affecting the assertion. We should get aware of that so we can fix things.

Who needs to work on this

Developers

Who needs to review this

Developers

Done when

[^1]: We may have to take the matter in our own hands there, as I couldn't find anything similar to the Puppeteer's pageerror event for Webdriver.io. Suspecting this is because Webdriver has to handle both Chrome (locally) and Sauce Labs. We might be able to spot errors by tracking the errors ourselves inside the browser through the error and unhandledrejection events, and checking in an afterEach block (or potentially through hooks)