Don't expose Suite objects as this of describe functions
This was a holdover from 1.x that should have been removed in 2.0, but was missed. Suite is meant to be private, and almost none of its methods can be safely called by user code.
This commit is contained in:
@@ -987,7 +987,7 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
|
||||
var declarationError = null;
|
||||
try {
|
||||
specDefinitions.call(j$.deprecatingThisProxy(suite, self));
|
||||
specDefinitions();
|
||||
} catch (e) {
|
||||
declarationError = e;
|
||||
}
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
/* eslint-disable compat/compat */
|
||||
// TODO: Remove this in the next major release.
|
||||
getJasmineRequireObj().deprecatingThisProxy = function(j$) {
|
||||
var msg = "Access to 'this' in describe functions is deprecated.";
|
||||
|
||||
try {
|
||||
new Proxy({}, {});
|
||||
} catch (e) {
|
||||
// Environment does not support Poxy.
|
||||
return function(suite) {
|
||||
return suite;
|
||||
};
|
||||
}
|
||||
|
||||
function DeprecatingThisProxyHandler(env) {
|
||||
this._env = env;
|
||||
}
|
||||
|
||||
DeprecatingThisProxyHandler.prototype.get = function(target, prop, receiver) {
|
||||
this._env.deprecated(msg);
|
||||
return target[prop];
|
||||
};
|
||||
|
||||
DeprecatingThisProxyHandler.prototype.set = function(target, prop, value) {
|
||||
this._env.deprecated(msg);
|
||||
return (target[prop] = value);
|
||||
};
|
||||
|
||||
return function(suite, env) {
|
||||
return new Proxy(suite, new DeprecatingThisProxyHandler(env));
|
||||
};
|
||||
};
|
||||
@@ -43,7 +43,6 @@ var getJasmineRequireObj = (function(jasmineGlobal) {
|
||||
j$.Clock = jRequire.Clock();
|
||||
j$.DelayedFunctionScheduler = jRequire.DelayedFunctionScheduler(j$);
|
||||
j$.Env = jRequire.Env(j$);
|
||||
j$.deprecatingThisProxy = jRequire.deprecatingThisProxy(j$);
|
||||
j$.StackTrace = jRequire.StackTrace(j$);
|
||||
j$.ExceptionFormatter = jRequire.ExceptionFormatter(j$);
|
||||
j$.ExpectationFilterChain = jRequire.ExpectationFilterChain();
|
||||
|
||||
Reference in New Issue
Block a user