Prevent monkey patching
This doesn't affect globals (describe, it, expect, etc). Those belong to the user and Jasmine doesn't depend on them.
This commit is contained in:
@@ -50,10 +50,16 @@ const getJasmineHtmlRequireObj = (function() {
|
||||
private$.FailuresView = htmlRequire.FailuresView(j$, private$);
|
||||
private$.PerformanceView = htmlRequire.PerformanceView(j$, private$);
|
||||
private$.TabBar = htmlRequire.TabBar(j$, private$);
|
||||
j$.HtmlReporterV2Urls = htmlRequire.HtmlReporterV2Urls(j$, private$);
|
||||
j$.HtmlReporterV2 = htmlRequire.HtmlReporterV2(j$, private$);
|
||||
j$.QueryString = htmlRequire.QueryString();
|
||||
private$.HtmlSpecFilterV2 = htmlRequire.HtmlSpecFilterV2();
|
||||
|
||||
for (const k of ['HtmlReporterV2Urls', 'HtmlReporterV2', 'QueryString']) {
|
||||
Object.defineProperty(j$, k, {
|
||||
enumerable: true,
|
||||
configurable: false,
|
||||
writable: false,
|
||||
value: htmlRequire[k](j$, private$)
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
return getJasmineHtmlRequire;
|
||||
@@ -101,6 +107,7 @@ getJasmineHtmlRequireObj().QueryString = function() {
|
||||
*/
|
||||
constructor(options) {
|
||||
this.#getWindowLocation = options.getWindowLocation;
|
||||
Object.freeze(this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -168,6 +175,7 @@ getJasmineHtmlRequireObj().QueryString = function() {
|
||||
return '?' + qStrPairs.join('&');
|
||||
}
|
||||
|
||||
Object.freeze(QueryString.prototype);
|
||||
return QueryString;
|
||||
};
|
||||
|
||||
@@ -772,6 +780,8 @@ getJasmineHtmlRequireObj().HtmlReporterV2 = function(j$, private$) {
|
||||
);
|
||||
this.#container.appendChild(this.#htmlReporterMain);
|
||||
this.#failures.show();
|
||||
|
||||
Object.freeze(this);
|
||||
}
|
||||
|
||||
jasmineStarted(options) {
|
||||
@@ -949,6 +959,7 @@ getJasmineHtmlRequireObj().HtmlReporterV2 = function(j$, private$) {
|
||||
}
|
||||
}
|
||||
|
||||
Object.freeze(HtmlReporterV2.prototype);
|
||||
return HtmlReporterV2;
|
||||
};
|
||||
|
||||
@@ -972,6 +983,8 @@ getJasmineHtmlRequireObj().HtmlReporterV2Urls = function(j$, private$) {
|
||||
return window.location;
|
||||
}
|
||||
});
|
||||
|
||||
Object.freeze(this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1022,6 +1035,7 @@ getJasmineHtmlRequireObj().HtmlReporterV2Urls = function(j$, private$) {
|
||||
}
|
||||
}
|
||||
|
||||
Object.freeze(HtmlReporterV2Urls.prototype);
|
||||
return HtmlReporterV2Urls;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user