-
Notifications
You must be signed in to change notification settings - Fork 50.2k
Closed
Description
In a few situations in our unit tests, we use .dispatchEvent on a jsdom DOM node in order to use the jsdom event system:
| instance.a.dispatchEvent(inputEvent); |
But it appears that if the event handler throws (ex: change the onChange handler in that test to throw), then the error is silently ignored and does not cause the test to fail.
jsdom does make some attempt to report an error:
We should hook into this in our jest config (scripts/jest/test-framework-setup.js) and see if we can fail any test that triggers this exception behavior. From the implementation of reportException it looks like we might be able to do an onerror handler; if that doesn't work then hooking into their "virtual console" may be possible.
flaviut and kohver