Compare commits

...

8 Commits

Author SHA1 Message Date
Gregg Van Hove
4530f9431f Generate combined file with new version numbers 2018-02-06 10:33:39 -08:00
Gregg Van Hove
9911d37f06 bump version to 2.99 2018-02-05 16:57:51 -08:00
Gregg Van Hove
32f99ef99d Use Jasmine's arrayContains to look for duplicate deprecations
[#154746527]
2018-02-05 14:24:14 -08:00
Gregg Van Hove
c142490c69 Add deprecation messages for things that will change/break in 3.0
[#154746527]
2018-02-05 14:01:46 -08:00
Gregg Van Hove
24bf3489dc Display deprecation warnings in HTML reporter
- Also no longer check for stack since IE doesn't do that

[#154746527]
2018-02-05 12:11:36 -08:00
Gregg Van Hove
5afe1222f4 Add ability to report deprecation warnings from within the suite
[#154746527]
2018-02-05 11:19:15 -08:00
Gregg Van Hove
70bce55721 Bump version to 2.9.1 2018-01-19 17:51:18 -08:00
Gregg Van Hove
53529bdc9a Clear timeouts when starting to process a milli instead of at the end
- Fixes #1482
2018-01-19 17:47:28 -08:00
19 changed files with 286 additions and 15 deletions

View File

@@ -88,7 +88,8 @@ jasmineRequire.HtmlReporter = function(j$) {
results = [],
htmlReporterMain,
symbols,
failedSuites = [];
failedSuites = [],
deprecationWarnings = [];
this.initialize = function() {
clearPrior();
@@ -126,6 +127,7 @@ jasmineRequire.HtmlReporter = function(j$) {
}
stateBuilder.suiteDone(result);
addDeprecationWarnings(result);
};
this.specStarted = function(result) {
@@ -169,6 +171,8 @@ jasmineRequire.HtmlReporter = function(j$) {
failures.push(failure);
}
addDeprecationWarnings(result);
};
this.jasmineDone = function(doneResult) {
@@ -278,6 +282,14 @@ jasmineRequire.HtmlReporter = function(j$) {
alert.appendChild(createDom('span', {className: errorBarClassName}, errorBarMessagePrefix + failure.message));
}
addDeprecationWarnings(doneResult);
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));
}
var results = find('.jasmine-results');
results.appendChild(summary);
@@ -352,6 +364,17 @@ jasmineRequire.HtmlReporter = function(j$) {
return this;
function addDeprecationWarnings(result) {
if (result && result.deprecationWarnings) {
for(var i = 0; i < result.deprecationWarnings.length; i++) {
var warning = result.deprecationWarnings[i].message;
if (!j$.util.arrayContains(warning)) {
deprecationWarnings.push(warning);
}
}
}
}
function find(selector) {
return getContainer().querySelector('.jasmine_html-reporter ' + selector);
}

View File

@@ -33,6 +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; 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; }

View File

@@ -505,6 +505,7 @@ getJasmineRequireObj().Spec = function(j$) {
* @property {String} fullName - The full description including all ancestors of this spec.
* @property {Expectation[]} failedExpectations - The list of expectations that failed during execution of this spec.
* @property {Expectation[]} passedExpectations - The list of expectations that passed during execution of this spec.
* @property {Expectation[]} deprecationWarnings - The list of deprecation warnings that occurred during execution this spec.
* @property {String} pendingReason - If the spec is {@link pending}, this will be the reason.
* @property {String} status - Once the spec has completed, this string represents the pass/fail status of this spec.
*/
@@ -514,6 +515,7 @@ getJasmineRequireObj().Spec = function(j$) {
fullName: this.getFullName(),
failedExpectations: [],
passedExpectations: [],
deprecationWarnings: [],
pendingReason: ''
};
}
@@ -629,6 +631,10 @@ getJasmineRequireObj().Spec = function(j$) {
return this.getSpecName(this);
};
Spec.prototype.addDeprecationWarning = function(msg) {
this.result.deprecationWarnings.push(this.expectationResultFactory({ message: msg }));
};
var extractCustomPendingMessage = function(e) {
var fullMessage = e.toString(),
boilerplateStart = fullMessage.indexOf(Spec.pendingSpecExceptionMessage),
@@ -710,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;
@@ -895,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;
};
@@ -933,6 +942,14 @@ getJasmineRequireObj().Env = function(j$) {
return seed;
};
this.deprecated = function(msg) {
var runnable = currentRunnable() || topSuite;
runnable.addDeprecationWarning(msg);
if(typeof console !== 'undefined' && typeof console.warn !== 'undefined') {
console.error('DEPRECATION: ' + msg);
}
};
var queueRunnerFactory = function(options) {
options.catchException = catchException;
options.clearStack = options.clearStack || clearStack;
@@ -940,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();
};
@@ -959,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;
@@ -1025,10 +1049,12 @@ getJasmineRequireObj().Env = function(j$) {
* @typedef JasmineDoneInfo
* @property {Order} order - Information about the ordering (random or not) of this execution of the suite.
* @property {Expectation[]} failedExpectations - List of expectations that failed in an {@link afterAll} at the global level.
* @property {Expectation[]} deprecationWarnings - List of deprecation warnings that occurred at the global level.
*/
reporter.jasmineDone({
order: order,
failedExpectations: topSuite.result.failedExpectations
failedExpectations: topSuite.result.failedExpectations,
deprecationWarnings: topSuite.result.deprecationWarnings
});
});
};
@@ -1130,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);
@@ -1255,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);
@@ -1510,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';
}
@@ -2193,6 +2224,7 @@ getJasmineRequireObj().DelayedFunctionScheduler = function(j$) {
}
do {
deletedKeys = [];
var newCurrentTime = scheduledLookup.shift();
tickDate(newCurrentTime - currentTime);
@@ -2215,7 +2247,6 @@ getJasmineRequireObj().DelayedFunctionScheduler = function(j$) {
}
funcToRun.funcToCall.apply(null, funcToRun.params || []);
});
deletedKeys = [];
} while (scheduledLookup.length > 0 &&
// checking first if we're out of time prevents setTimeout(0)
// scheduled in a funcToRun from forcing an extra iteration
@@ -4320,7 +4351,7 @@ getJasmineRequireObj().QueueRunner = function(j$) {
return function() {
if (!called) {
called = true;
fn();
fn.apply(null, arguments);
}
return null;
};
@@ -4339,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() {
@@ -4398,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);
@@ -5147,13 +5183,15 @@ getJasmineRequireObj().Suite = function(j$) {
* @property {String} description - The description text passed to the {@link describe} that made this suite.
* @property {String} fullName - The full description including all ancestors of this suite.
* @property {Expectation[]} failedExpectations - The list of expectations that failed in an {@link afterAll} for this suite.
* @property {Expectation[]} deprecationWarnings - The list of deprecation warnings that occurred on this suite.
* @property {String} status - Once the suite has completed, this string represents the pass/fail status of this suite.
*/
this.result = {
id: this.id,
description: this.description,
fullName: this.getFullName(),
failedExpectations: []
failedExpectations: [],
deprecationWarnings: []
};
}
@@ -5273,6 +5311,10 @@ getJasmineRequireObj().Suite = function(j$) {
}
};
Suite.prototype.addDeprecationWarning = function(msg) {
this.result.deprecationWarnings.push(this.expectationResultFactory({ message: msg }));
};
function isAfterAll(children) {
return children && children[0].result.status;
}
@@ -5538,5 +5580,5 @@ getJasmineRequireObj().UserContext = function(j$) {
};
getJasmineRequireObj().version = function() {
return '2.9.0';
return '2.99.0';
};

View File

@@ -4,6 +4,6 @@
#
module Jasmine
module Core
VERSION = "2.9.0"
VERSION = "2.99.0"
end
end

View File

@@ -1,7 +1,7 @@
{
"name": "jasmine-core",
"license": "MIT",
"version": "2.9.0",
"version": "2.99.0",
"repository": {
"type": "git",
"url": "https://github.com/jasmine/jasmine.git"

15
release_notes/2.9.1.md Normal file
View File

@@ -0,0 +1,15 @@
# Jasmine Core 2.9.1 Release Notes
## Summary
This is a hotfix release to fix a breaking change from the 2.9.0 release
## Changes
* Clear timeouts when starting to process a milli instead of at the end
- Fixes #1482
------
_Release Notes generated with _[Anchorman](http://github.com/infews/anchorman)_

19
release_notes/2.99.md Normal file
View File

@@ -0,0 +1,19 @@
# Jasmine-Core 2.99 Release Notes
## Summary
This release is part of the upgrade path to Jasmine 3.0. It deprecates some functionality that will change.
## Changes
* Add ability to report deprecation warnings from within the suite and display them in the HTML reporter
* Add deprecation messages for things that will change/break in 3.0
* * done for async functionality will now add a failure if it is invoked with an Error
* * Env.catchExceptions and the query param are going away, in favor of a more fully functional fail fast handler
* * jasmine.Any(Object) will no longer match null
* * Unhandled errors during suite load will be caught and reported as failures by Jasmine
* * Calling execute more than once on the same spec will definitely fail in 3.0
------
_Release Notes generated with _[Anchorman](http://github.com/infews/anchorman)_

View File

@@ -254,6 +254,22 @@ describe("DelayedFunctionScheduler", function() {
expect(fn.calls.count()).toBe(1);
});
it("does not remove a function that hasn't been added yet", function() {
var scheduler = new jasmineUnderTest.DelayedFunctionScheduler(),
fn = jasmine.createSpy('fn'),
fnDelay = 10,
timeoutKey;
scheduler.removeFunctionWithId('foo');
scheduler.scheduleFunction(fn, fnDelay, [], false, 'foo');
expect(fn).not.toHaveBeenCalled();
scheduler.tick(fnDelay + 1);
expect(fn).toHaveBeenCalled();
});
it("updates the mockDate per scheduled time", function () {
var scheduler = new jasmineUnderTest.DelayedFunctionScheduler(),
tickDate = jasmine.createSpy('tickDate');

View File

@@ -222,6 +222,7 @@ describe("Spec", function() {
fullName: 'a suite with a spec',
failedExpectations: [],
passedExpectations: [],
deprecationWarnings: [],
pendingReason: ''
});
});

View File

@@ -2004,4 +2004,47 @@ describe("Env integration", function() {
env.execute();
});
it('should report deprecation warnings on the correct specs and suites', function(done) {
var env = new jasmineUnderTest.Env(),
reporter = jasmine.createSpyObj('reporter', ['jasmineDone', 'suiteDone', 'specDone']);
reporter.jasmineDone.and.callFake(function(result) {
expect(result.deprecationWarnings).toEqual([
jasmine.objectContaining({ message: 'top level deprecation' })
]);
expect(reporter.suiteDone).toHaveBeenCalledWith(jasmine.objectContaining({
fullName: 'suite',
deprecationWarnings: [
jasmine.objectContaining({ message: 'suite level deprecation' })
]
}));
expect(reporter.specDone).toHaveBeenCalledWith(jasmine.objectContaining({
fullName: 'suite spec',
deprecationWarnings: [
jasmine.objectContaining({ message: 'spec level deprecation' })
]
}));
done();
});
env.addReporter(reporter);
env.deprecated('top level deprecation');
env.describe('suite', function() {
env.beforeAll(function() {
env.deprecated('suite level deprecation');
});
env.it('spec', function() {
env.deprecated('spec level deprecation');
});
});
env.execute();
});
});

View File

@@ -208,6 +208,47 @@ describe("New HtmlReporter", function() {
});
});
describe('when there are deprecation warnings', function() {
it('displays the messages in their own alert bars', function() {
var env = new jasmineUnderTest.Env(),
container = document.createElement('div'),
getContainer = function() { return container; },
reporter = new jasmineUnderTest.HtmlReporter({
env: env,
getContainer: getContainer,
createElement: function() { return document.createElement.apply(document, arguments); },
createTextNode: function() { return document.createTextNode.apply(document, arguments); }
});
reporter.initialize();
reporter.jasmineStarted({});
reporter.specDone({
status: 'passed',
deprecationWarnings: [{ message: 'spec deprecation' }],
failedExpectations: [],
passedExpectations: []
});
reporter.suiteDone({
status: 'passed',
deprecationWarnings: [{ message: 'suite deprecation' }],
failedExpectations: []
});
reporter.jasmineDone({
deprecationWarnings: [{ message: 'global deprecation' }],
failedExpectations: []
});
var alertBars = container.querySelectorAll(".jasmine-alert .jasmine-bar");
expect(alertBars.length).toEqual(4);
expect(alertBars[1].innerHTML).toMatch(/spec deprecation/);
expect(alertBars[1].getAttribute("class")).toEqual('jasmine-bar jasmine-warning');
expect(alertBars[2].innerHTML).toMatch(/suite deprecation/);
expect(alertBars[3].innerHTML).toMatch(/global deprecation/);
});
});
describe("when Jasmine is done", function() {
it("adds a warning to the link title of specs that have no expectations", function() {
if (!window.console) {

View File

@@ -124,6 +124,7 @@ getJasmineRequireObj().DelayedFunctionScheduler = function(j$) {
}
do {
deletedKeys = [];
var newCurrentTime = scheduledLookup.shift();
tickDate(newCurrentTime - currentTime);
@@ -146,7 +147,6 @@ getJasmineRequireObj().DelayedFunctionScheduler = function(j$) {
}
funcToRun.funcToCall.apply(null, funcToRun.params || []);
});
deletedKeys = [];
} while (scheduledLookup.length > 0 &&
// checking first if we're out of time prevents setTimeout(0)
// scheduled in a funcToRun from forcing an extra iteration

View File

@@ -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;
};
@@ -234,6 +237,14 @@ getJasmineRequireObj().Env = function(j$) {
return seed;
};
this.deprecated = function(msg) {
var runnable = currentRunnable() || topSuite;
runnable.addDeprecationWarning(msg);
if(typeof console !== 'undefined' && typeof console.warn !== 'undefined') {
console.error('DEPRECATION: ' + msg);
}
};
var queueRunnerFactory = function(options) {
options.catchException = catchException;
options.clearStack = options.clearStack || clearStack;
@@ -241,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();
};
@@ -260,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;
@@ -326,10 +344,12 @@ getJasmineRequireObj().Env = function(j$) {
* @typedef JasmineDoneInfo
* @property {Order} order - Information about the ordering (random or not) of this execution of the suite.
* @property {Expectation[]} failedExpectations - List of expectations that failed in an {@link afterAll} at the global level.
* @property {Expectation[]} deprecationWarnings - List of deprecation warnings that occurred at the global level.
*/
reporter.jasmineDone({
order: order,
failedExpectations: topSuite.result.failedExpectations
failedExpectations: topSuite.result.failedExpectations,
deprecationWarnings: topSuite.result.deprecationWarnings
});
});
};
@@ -431,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);
@@ -556,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);

View File

@@ -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);

View File

@@ -25,6 +25,7 @@ getJasmineRequireObj().Spec = function(j$) {
* @property {String} fullName - The full description including all ancestors of this spec.
* @property {Expectation[]} failedExpectations - The list of expectations that failed during execution of this spec.
* @property {Expectation[]} passedExpectations - The list of expectations that passed during execution of this spec.
* @property {Expectation[]} deprecationWarnings - The list of deprecation warnings that occurred during execution this spec.
* @property {String} pendingReason - If the spec is {@link pending}, this will be the reason.
* @property {String} status - Once the spec has completed, this string represents the pass/fail status of this spec.
*/
@@ -34,6 +35,7 @@ getJasmineRequireObj().Spec = function(j$) {
fullName: this.getFullName(),
failedExpectations: [],
passedExpectations: [],
deprecationWarnings: [],
pendingReason: ''
};
}
@@ -149,6 +151,10 @@ getJasmineRequireObj().Spec = function(j$) {
return this.getSpecName(this);
};
Spec.prototype.addDeprecationWarning = function(msg) {
this.result.deprecationWarnings.push(this.expectationResultFactory({ message: msg }));
};
var extractCustomPendingMessage = function(e) {
var fullMessage = e.toString(),
boilerplateStart = fullMessage.indexOf(Spec.pendingSpecExceptionMessage),

View File

@@ -21,13 +21,15 @@ getJasmineRequireObj().Suite = function(j$) {
* @property {String} description - The description text passed to the {@link describe} that made this suite.
* @property {String} fullName - The full description including all ancestors of this suite.
* @property {Expectation[]} failedExpectations - The list of expectations that failed in an {@link afterAll} for this suite.
* @property {Expectation[]} deprecationWarnings - The list of deprecation warnings that occurred on this suite.
* @property {String} status - Once the suite has completed, this string represents the pass/fail status of this suite.
*/
this.result = {
id: this.id,
description: this.description,
fullName: this.getFullName(),
failedExpectations: []
failedExpectations: [],
deprecationWarnings: []
};
}
@@ -147,6 +149,10 @@ getJasmineRequireObj().Suite = function(j$) {
}
};
Suite.prototype.addDeprecationWarning = function(msg) {
this.result.deprecationWarnings.push(this.expectationResultFactory({ message: msg }));
};
function isAfterAll(children) {
return children && children[0].result.status;
}

View File

@@ -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';
}

View File

@@ -59,7 +59,8 @@ jasmineRequire.HtmlReporter = function(j$) {
results = [],
htmlReporterMain,
symbols,
failedSuites = [];
failedSuites = [],
deprecationWarnings = [];
this.initialize = function() {
clearPrior();
@@ -97,6 +98,7 @@ jasmineRequire.HtmlReporter = function(j$) {
}
stateBuilder.suiteDone(result);
addDeprecationWarnings(result);
};
this.specStarted = function(result) {
@@ -140,6 +142,8 @@ jasmineRequire.HtmlReporter = function(j$) {
failures.push(failure);
}
addDeprecationWarnings(result);
};
this.jasmineDone = function(doneResult) {
@@ -249,6 +253,14 @@ jasmineRequire.HtmlReporter = function(j$) {
alert.appendChild(createDom('span', {className: errorBarClassName}, errorBarMessagePrefix + failure.message));
}
addDeprecationWarnings(doneResult);
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));
}
var results = find('.jasmine-results');
results.appendChild(summary);
@@ -323,6 +335,17 @@ jasmineRequire.HtmlReporter = function(j$) {
return this;
function addDeprecationWarnings(result) {
if (result && result.deprecationWarnings) {
for(var i = 0; i < result.deprecationWarnings.length; i++) {
var warning = result.deprecationWarnings[i].message;
if (!j$.util.arrayContains(warning)) {
deprecationWarnings.push(warning);
}
}
}
}
function find(selector) {
return getContainer().querySelector('.jasmine_html-reporter ' + selector);
}

View File

@@ -216,6 +216,11 @@ body {
background-color: $failing-color;
}
&.jasmine-warning {
background-color: $pending-color;
color: $text-color;
}
&.jasmine-menu {
background-color: #fff;
color: $faint-text-color;