Added jasmine.spyOnGlobalErrorsAsync

* Allows testing code that's expected to prodeuce global errors or
  unhandled promise rejections
* Fixes #1843
* Fixes #1453
This commit is contained in:
Steve Gravrock
2022-06-30 18:09:56 -07:00
parent d0a9931ae6
commit 6c56ebc984
11 changed files with 884 additions and 109 deletions

View File

@@ -1,8 +1,9 @@
getJasmineRequireObj().RunableResources = function(j$) {
class RunableResources {
constructor(getCurrentRunableId) {
constructor(options) {
this.byRunableId_ = {};
this.getCurrentRunableId_ = getCurrentRunableId;
this.getCurrentRunableId_ = options.getCurrentRunableId;
this.globalErrors_ = options.globalErrors;
this.spyFactory = new j$.SpyFactory(
() => {
@@ -53,6 +54,7 @@ getJasmineRequireObj().RunableResources = function(j$) {
}
clearForRunable(runableId) {
this.globalErrors_.removeOverrideListener();
this.spyRegistry.clearSpies();
delete this.byRunableId_[runableId];
}