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
{{ message }}
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.
For example bug #2568 -- which should have failed a test by throwing an exception but didn't because dispatchEvent() hides thrown exceptions from its callers. (And the exception didn't change anything that the test was checking for, which granted means the bug wasn't that bad... but it would be nice to fail the test anyway).
NJ pointed out that many tests that use dispatchEvent() could just use $.trigger() instead. But there are a few tests that interact with non-jQuery listeners (e.g. Bootstrap or CodeMirror code) where we're always stuck with dispatchEvent(). Are there enough of those to care?
There's also the question of uncaught exceptions in async code. Normally I'd expect that to mean the async code never finishes and thus the Jasmine testcase fails by virtue of a timeout... but is that always true?
If we wanted to be fancy we could use window.onerror to guarantee noticing any uncaught exception. But it may not be worth the effort (though in the main app a similar approach could be useful for error reporting).
The text was updated successfully, but these errors were encountered:
It won't work for any addEventListener() listeners in general (not just capture listeners), I think. (Though it does work for non-jQuery listeners attached via the DOM onxxx attributes.)
Right, it's just that our own code (should) only use addEventListener() when we need a capture listener. For normal listeners we should always be going through jQuery.
For example bug #2568 -- which should have failed a test by throwing an exception but didn't because dispatchEvent() hides thrown exceptions from its callers. (And the exception didn't change anything that the test was checking for, which granted means the bug wasn't that bad... but it would be nice to fail the test anyway).
NJ pointed out that many tests that use dispatchEvent() could just use $.trigger() instead. But there are a few tests that interact with non-jQuery listeners (e.g. Bootstrap or CodeMirror code) where we're always stuck with dispatchEvent(). Are there enough of those to care?
There's also the question of uncaught exceptions in async code. Normally I'd expect that to mean the async code never finishes and thus the Jasmine testcase fails by virtue of a timeout... but is that always true?
If we wanted to be fancy we could use
window.onerror
to guarantee noticing any uncaught exception. But it may not be worth the effort (though in the main app a similar approach could be useful for error reporting).The text was updated successfully, but these errors were encountered: