Add deprecation messages for things that will change/break in 3.0
[#154746527]
This commit is contained in:
@@ -287,7 +287,7 @@ jasmineRequire.HtmlReporter = function(j$) {
|
||||
var warningBarClassName = 'jasmine-bar jasmine-warning';
|
||||
for(i = 0; i < deprecationWarnings.length; i++) {
|
||||
var warning = deprecationWarnings[i];
|
||||
alert.appendChild(createDom('span', {className: warningBarClassName}, 'DEPRECATION: ' + warning.message));
|
||||
alert.appendChild(createDom('span', {className: warningBarClassName}, 'DEPRECATION: ' + warning));
|
||||
}
|
||||
|
||||
var results = find('.jasmine-results');
|
||||
@@ -365,8 +365,13 @@ jasmineRequire.HtmlReporter = function(j$) {
|
||||
return this;
|
||||
|
||||
function addDeprecationWarnings(result) {
|
||||
if (result && result.deprecationWarnings && result.deprecationWarnings.length > 0) {
|
||||
deprecationWarnings = deprecationWarnings.concat(result.deprecationWarnings);
|
||||
if (result && result.deprecationWarnings) {
|
||||
for(var i = 0; i < result.deprecationWarnings.length; i++) {
|
||||
var warning = result.deprecationWarnings[i].message;
|
||||
if (deprecationWarnings.indexOf(warning) < 0) {
|
||||
deprecationWarnings.push(warning);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ body { overflow-y: scroll; }
|
||||
.jasmine_html-reporter .jasmine-bar.jasmine-passed { background-color: #007069; }
|
||||
.jasmine_html-reporter .jasmine-bar.jasmine-skipped { background-color: #bababa; }
|
||||
.jasmine_html-reporter .jasmine-bar.jasmine-errored { background-color: #ca3a11; }
|
||||
.jasmine_html-reporter .jasmine-bar.jasmine-warning { background-color: #ba9d37; }
|
||||
.jasmine_html-reporter .jasmine-bar.jasmine-warning { background-color: #ba9d37; color: #333; }
|
||||
.jasmine_html-reporter .jasmine-bar.jasmine-menu { background-color: #fff; color: #aaa; }
|
||||
.jasmine_html-reporter .jasmine-bar.jasmine-menu a { color: #333; }
|
||||
.jasmine_html-reporter .jasmine-bar a { color: white; }
|
||||
|
||||
@@ -716,6 +716,8 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
var self = this;
|
||||
var global = options.global || j$.getGlobal();
|
||||
|
||||
var hasExecuted = false;
|
||||
|
||||
var totalSpecsDefined = 0;
|
||||
|
||||
var catchExceptions = true;
|
||||
@@ -901,6 +903,7 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
|
||||
// TODO: fix this naming, and here's where the value comes in
|
||||
this.catchExceptions = function(value) {
|
||||
this.deprecated('The catchExceptions option is deprecated and will be replaced with stopOnSpecFailure in Jasmine 3.0');
|
||||
catchExceptions = !!value;
|
||||
return catchExceptions;
|
||||
};
|
||||
@@ -954,6 +957,7 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
options.fail = self.fail;
|
||||
options.globalErrors = globalErrors;
|
||||
options.completeOnFirstError = throwOnExpectationFailure && options.isLeaf;
|
||||
options.deprecated = self.deprecated;
|
||||
|
||||
new j$.QueueRunner(options).execute();
|
||||
};
|
||||
@@ -973,6 +977,12 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
};
|
||||
|
||||
this.execute = function(runnablesToRun) {
|
||||
if (hasExecuted) {
|
||||
this.deprecated('Executing the same Jasmine multiple times will no longer work in Jasmine 3.0');
|
||||
}
|
||||
|
||||
hasExecuted = true;
|
||||
|
||||
if(!runnablesToRun) {
|
||||
if (focusedRunnables.length) {
|
||||
runnablesToRun = focusedRunnables;
|
||||
@@ -1146,6 +1156,7 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
var focusedRunnables = [];
|
||||
|
||||
this.fdescribe = function(description, specDefinitions) {
|
||||
this.deprecated('fit and fdescribe will cause your suite to report an \'incomplete\' status in Jasmine 3.0');
|
||||
ensureIsNotNested('fdescribe');
|
||||
ensureIsFunction(specDefinitions, 'fdescribe');
|
||||
var suite = suiteFactory(description);
|
||||
@@ -1271,6 +1282,7 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
};
|
||||
|
||||
this.fit = function(description, fn, timeout){
|
||||
this.deprecated('fit and fdescribe will cause your suite to report an \'incomplete\' status in Jasmine 3.0');
|
||||
ensureIsNotNested('fit');
|
||||
ensureIsFunctionOrAsync(fn, 'fit');
|
||||
var spec = specFactory(description, fn, currentDeclarationSuite, timeout);
|
||||
@@ -1526,6 +1538,9 @@ getJasmineRequireObj().Any = function(j$) {
|
||||
}
|
||||
|
||||
if (this.expectedObject == Object) {
|
||||
if (other === null) {
|
||||
j$.getEnv().deprecated('jasmine.Any(Object) will no longer match null in Jasmine 3.0');
|
||||
}
|
||||
return typeof other == 'object';
|
||||
}
|
||||
|
||||
@@ -4336,7 +4351,7 @@ getJasmineRequireObj().QueueRunner = function(j$) {
|
||||
return function() {
|
||||
if (!called) {
|
||||
called = true;
|
||||
fn();
|
||||
fn.apply(null, arguments);
|
||||
}
|
||||
return null;
|
||||
};
|
||||
@@ -4355,6 +4370,7 @@ getJasmineRequireObj().QueueRunner = function(j$) {
|
||||
this.fail = attrs.fail || function() {};
|
||||
this.globalErrors = attrs.globalErrors || { pushListener: function() {}, popListener: function() {} };
|
||||
this.completeOnFirstError = !!attrs.completeOnFirstError;
|
||||
this.deprecated = attrs.deprecated;
|
||||
}
|
||||
|
||||
QueueRunner.prototype.execute = function() {
|
||||
@@ -4414,9 +4430,13 @@ getJasmineRequireObj().QueueRunner = function(j$) {
|
||||
clearTimeout(timeoutId);
|
||||
self.globalErrors.popListener(handleError);
|
||||
}),
|
||||
next = once(function () {
|
||||
next = once(function (err) {
|
||||
cleanup();
|
||||
|
||||
if (err instanceof Error) {
|
||||
self.deprecated('done callback received an Error object. Jasmine 3.0 will treat this as a failure');
|
||||
}
|
||||
|
||||
function runNext() {
|
||||
if (self.completeOnFirstError && errored) {
|
||||
self.skipToCleanup(iterativeIndex);
|
||||
|
||||
@@ -11,6 +11,8 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
var self = this;
|
||||
var global = options.global || j$.getGlobal();
|
||||
|
||||
var hasExecuted = false;
|
||||
|
||||
var totalSpecsDefined = 0;
|
||||
|
||||
var catchExceptions = true;
|
||||
@@ -196,6 +198,7 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
|
||||
// TODO: fix this naming, and here's where the value comes in
|
||||
this.catchExceptions = function(value) {
|
||||
this.deprecated('The catchExceptions option is deprecated and will be replaced with stopOnSpecFailure in Jasmine 3.0');
|
||||
catchExceptions = !!value;
|
||||
return catchExceptions;
|
||||
};
|
||||
@@ -249,6 +252,7 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
options.fail = self.fail;
|
||||
options.globalErrors = globalErrors;
|
||||
options.completeOnFirstError = throwOnExpectationFailure && options.isLeaf;
|
||||
options.deprecated = self.deprecated;
|
||||
|
||||
new j$.QueueRunner(options).execute();
|
||||
};
|
||||
@@ -268,6 +272,12 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
};
|
||||
|
||||
this.execute = function(runnablesToRun) {
|
||||
if (hasExecuted) {
|
||||
this.deprecated('Executing the same Jasmine multiple times will no longer work in Jasmine 3.0');
|
||||
}
|
||||
|
||||
hasExecuted = true;
|
||||
|
||||
if(!runnablesToRun) {
|
||||
if (focusedRunnables.length) {
|
||||
runnablesToRun = focusedRunnables;
|
||||
@@ -441,6 +451,7 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
var focusedRunnables = [];
|
||||
|
||||
this.fdescribe = function(description, specDefinitions) {
|
||||
this.deprecated('fit and fdescribe will cause your suite to report an \'incomplete\' status in Jasmine 3.0');
|
||||
ensureIsNotNested('fdescribe');
|
||||
ensureIsFunction(specDefinitions, 'fdescribe');
|
||||
var suite = suiteFactory(description);
|
||||
@@ -566,6 +577,7 @@ getJasmineRequireObj().Env = function(j$) {
|
||||
};
|
||||
|
||||
this.fit = function(description, fn, timeout){
|
||||
this.deprecated('fit and fdescribe will cause your suite to report an \'incomplete\' status in Jasmine 3.0');
|
||||
ensureIsNotNested('fit');
|
||||
ensureIsFunctionOrAsync(fn, 'fit');
|
||||
var spec = specFactory(description, fn, currentDeclarationSuite, timeout);
|
||||
|
||||
@@ -5,7 +5,7 @@ getJasmineRequireObj().QueueRunner = function(j$) {
|
||||
return function() {
|
||||
if (!called) {
|
||||
called = true;
|
||||
fn();
|
||||
fn.apply(null, arguments);
|
||||
}
|
||||
return null;
|
||||
};
|
||||
@@ -24,6 +24,7 @@ getJasmineRequireObj().QueueRunner = function(j$) {
|
||||
this.fail = attrs.fail || function() {};
|
||||
this.globalErrors = attrs.globalErrors || { pushListener: function() {}, popListener: function() {} };
|
||||
this.completeOnFirstError = !!attrs.completeOnFirstError;
|
||||
this.deprecated = attrs.deprecated;
|
||||
}
|
||||
|
||||
QueueRunner.prototype.execute = function() {
|
||||
@@ -83,9 +84,13 @@ getJasmineRequireObj().QueueRunner = function(j$) {
|
||||
clearTimeout(timeoutId);
|
||||
self.globalErrors.popListener(handleError);
|
||||
}),
|
||||
next = once(function () {
|
||||
next = once(function (err) {
|
||||
cleanup();
|
||||
|
||||
if (err instanceof Error) {
|
||||
self.deprecated('done callback received an Error object. Jasmine 3.0 will treat this as a failure');
|
||||
}
|
||||
|
||||
function runNext() {
|
||||
if (self.completeOnFirstError && errored) {
|
||||
self.skipToCleanup(iterativeIndex);
|
||||
|
||||
@@ -24,6 +24,9 @@ getJasmineRequireObj().Any = function(j$) {
|
||||
}
|
||||
|
||||
if (this.expectedObject == Object) {
|
||||
if (other === null) {
|
||||
j$.getEnv().deprecated('jasmine.Any(Object) will no longer match null in Jasmine 3.0');
|
||||
}
|
||||
return typeof other == 'object';
|
||||
}
|
||||
|
||||
|
||||
@@ -258,7 +258,7 @@ jasmineRequire.HtmlReporter = function(j$) {
|
||||
var warningBarClassName = 'jasmine-bar jasmine-warning';
|
||||
for(i = 0; i < deprecationWarnings.length; i++) {
|
||||
var warning = deprecationWarnings[i];
|
||||
alert.appendChild(createDom('span', {className: warningBarClassName}, 'DEPRECATION: ' + warning.message));
|
||||
alert.appendChild(createDom('span', {className: warningBarClassName}, 'DEPRECATION: ' + warning));
|
||||
}
|
||||
|
||||
var results = find('.jasmine-results');
|
||||
@@ -336,8 +336,13 @@ jasmineRequire.HtmlReporter = function(j$) {
|
||||
return this;
|
||||
|
||||
function addDeprecationWarnings(result) {
|
||||
if (result && result.deprecationWarnings && result.deprecationWarnings.length > 0) {
|
||||
deprecationWarnings = deprecationWarnings.concat(result.deprecationWarnings);
|
||||
if (result && result.deprecationWarnings) {
|
||||
for(var i = 0; i < result.deprecationWarnings.length; i++) {
|
||||
var warning = result.deprecationWarnings[i].message;
|
||||
if (deprecationWarnings.indexOf(warning) < 0) {
|
||||
deprecationWarnings.push(warning);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -218,6 +218,7 @@ body {
|
||||
|
||||
&.jasmine-warning {
|
||||
background-color: $pending-color;
|
||||
color: $text-color;
|
||||
}
|
||||
|
||||
&.jasmine-menu {
|
||||
|
||||
Reference in New Issue
Block a user