Clean up global error listener leaks in Jasmine's own tests

This commit is contained in:
Steve Gravrock
2025-09-14 17:27:58 -07:00
parent 5439c8c9cd
commit 4166ea791c

View File

@@ -1,4 +1,8 @@
beforeEach(function() {
// env is stateful. Ensure that it does not leak between tests.
jasmineUnderTest.currentEnv_ = null;
// env is stateful. Ensure that it, and its global error event listeners,
// do not leak between tests.
if (jasmineUnderTest.currentEnv_) {
jasmineUnderTest.currentEnv_.cleanup_();
jasmineUnderTest.currentEnv_ = null;
}
});