Replace old "catch exceptions" logic with proper fail fast with error reporting
- Option is called stopOnSpecFailure [#85966014] - See #414 - See jasmine/jasmine-npm#16
This commit is contained in:
@@ -73,8 +73,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||||||
|
|
||||||
var filterSpecs = !!queryString.getParam("spec");
|
var filterSpecs = !!queryString.getParam("spec");
|
||||||
|
|
||||||
var catchingExceptions = queryString.getParam("catch");
|
var stoppingOnSpecFailure = queryString.getParam("failFast");
|
||||||
env.catchExceptions(typeof catchingExceptions === "undefined" ? true : catchingExceptions);
|
env.stopOnSpecFailure(typeof stoppingOnSpecFailure === "undefined" ? true : stoppingOnSpecFailure);
|
||||||
|
|
||||||
var throwingExpectationFailures = queryString.getParam("throwFailures");
|
var throwingExpectationFailures = queryString.getParam("throwFailures");
|
||||||
env.throwOnExpectationFailure(throwingExpectationFailures);
|
env.throwOnExpectationFailure(throwingExpectationFailures);
|
||||||
@@ -96,7 +96,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||||||
*/
|
*/
|
||||||
var htmlReporter = new jasmine.HtmlReporter({
|
var htmlReporter = new jasmine.HtmlReporter({
|
||||||
env: env,
|
env: env,
|
||||||
onRaiseExceptionsClick: function() { queryString.navigateWithNewParam("catch", !env.catchingExceptions()); },
|
onStopExecutionClick: function() { queryString.navigateWithNewParam("failFast", !env.stoppingOnSpecFailure()); },
|
||||||
onThrowExpectationsClick: function() { queryString.navigateWithNewParam("throwFailures", !env.throwingExpectationFailures()); },
|
onThrowExpectationsClick: function() { queryString.navigateWithNewParam("throwFailures", !env.throwingExpectationFailures()); },
|
||||||
onRandomClick: function() { queryString.navigateWithNewParam("random", !env.randomTests()); },
|
onRandomClick: function() { queryString.navigateWithNewParam("random", !env.randomTests()); },
|
||||||
addToExistingQueryString: function(key, value) { return queryString.fullStringWithNewParam(key, value); },
|
addToExistingQueryString: function(key, value) { return queryString.fullStringWithNewParam(key, value); },
|
||||||
|
|||||||
@@ -51,8 +51,8 @@
|
|||||||
|
|
||||||
var filterSpecs = !!queryString.getParam("spec");
|
var filterSpecs = !!queryString.getParam("spec");
|
||||||
|
|
||||||
var catchingExceptions = queryString.getParam("catch");
|
var stoppingOnSpecFailure = queryString.getParam("failFast");
|
||||||
env.catchExceptions(typeof catchingExceptions === "undefined" ? true : catchingExceptions);
|
env.stopOnSpecFailure(typeof stoppingOnSpecFailure === "undefined" ? true : stoppingOnSpecFailure);
|
||||||
|
|
||||||
var throwingExpectationFailures = queryString.getParam("throwFailures");
|
var throwingExpectationFailures = queryString.getParam("throwFailures");
|
||||||
env.throwOnExpectationFailure(throwingExpectationFailures);
|
env.throwOnExpectationFailure(throwingExpectationFailures);
|
||||||
@@ -74,7 +74,7 @@
|
|||||||
*/
|
*/
|
||||||
var htmlReporter = new jasmine.HtmlReporter({
|
var htmlReporter = new jasmine.HtmlReporter({
|
||||||
env: env,
|
env: env,
|
||||||
onRaiseExceptionsClick: function() { queryString.navigateWithNewParam("catch", !env.catchingExceptions()); },
|
onStopExecutionClick: function() { queryString.navigateWithNewParam("failFast", !env.stoppingOnSpecFailure()); },
|
||||||
onThrowExpectationsClick: function() { queryString.navigateWithNewParam("throwFailures", !env.throwingExpectationFailures()); },
|
onThrowExpectationsClick: function() { queryString.navigateWithNewParam("throwFailures", !env.throwingExpectationFailures()); },
|
||||||
onRandomClick: function() { queryString.navigateWithNewParam("random", !env.randomTests()); },
|
onRandomClick: function() { queryString.navigateWithNewParam("random", !env.randomTests()); },
|
||||||
addToExistingQueryString: function(key, value) { return queryString.fullStringWithNewParam(key, value); },
|
addToExistingQueryString: function(key, value) { return queryString.fullStringWithNewParam(key, value); },
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|||||||
getContainer = options.getContainer,
|
getContainer = options.getContainer,
|
||||||
createElement = options.createElement,
|
createElement = options.createElement,
|
||||||
createTextNode = options.createTextNode,
|
createTextNode = options.createTextNode,
|
||||||
onRaiseExceptionsClick = options.onRaiseExceptionsClick || function() {},
|
onStopExecutionClick = options.onStopExecutionClick || function() {},
|
||||||
onThrowExpectationsClick = options.onThrowExpectationsClick || function() {},
|
onThrowExpectationsClick = options.onThrowExpectationsClick || function() {},
|
||||||
onRandomClick = options.onRandomClick || function() {},
|
onRandomClick = options.onRandomClick || function() {},
|
||||||
addToExistingQueryString = options.addToExistingQueryString || defaultQueryString,
|
addToExistingQueryString = options.addToExistingQueryString || defaultQueryString,
|
||||||
@@ -322,13 +322,13 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|||||||
var optionsMenuDom = createDom('div', { className: 'jasmine-run-options' },
|
var optionsMenuDom = createDom('div', { className: 'jasmine-run-options' },
|
||||||
createDom('span', { className: 'jasmine-trigger' }, 'Options'),
|
createDom('span', { className: 'jasmine-trigger' }, 'Options'),
|
||||||
createDom('div', { className: 'jasmine-payload' },
|
createDom('div', { className: 'jasmine-payload' },
|
||||||
createDom('div', { className: 'jasmine-exceptions' },
|
createDom('div', { className: 'jasmine-stop-on-failure' },
|
||||||
createDom('input', {
|
createDom('input', {
|
||||||
className: 'jasmine-raise',
|
className: 'jasmine-fail-fast',
|
||||||
id: 'jasmine-raise-exceptions',
|
id: 'jasmine-fail-fast',
|
||||||
type: 'checkbox'
|
type: 'checkbox'
|
||||||
}),
|
}),
|
||||||
createDom('label', { className: 'jasmine-label', 'for': 'jasmine-raise-exceptions' }, 'raise exceptions')),
|
createDom('label', { className: 'jasmine-label', 'for': 'jasmine-fail-fast' }, 'stop execution on spec failure')),
|
||||||
createDom('div', { className: 'jasmine-throw-failures' },
|
createDom('div', { className: 'jasmine-throw-failures' },
|
||||||
createDom('input', {
|
createDom('input', {
|
||||||
className: 'jasmine-throw',
|
className: 'jasmine-throw',
|
||||||
@@ -346,10 +346,9 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
var raiseCheckbox = optionsMenuDom.querySelector('#jasmine-raise-exceptions');
|
var failFastCheckbox = optionsMenuDom.querySelector('#jasmine-fail-fast');
|
||||||
|
failFastCheckbox.checked = env.stoppingOnSpecFailure();
|
||||||
raiseCheckbox.checked = !env.catchingExceptions();
|
failFastCheckbox.onclick = onStopExecutionClick;
|
||||||
raiseCheckbox.onclick = onRaiseExceptionsClick;
|
|
||||||
|
|
||||||
var throwCheckbox = optionsMenuDom.querySelector('#jasmine-throw-failures');
|
var throwCheckbox = optionsMenuDom.querySelector('#jasmine-throw-failures');
|
||||||
throwCheckbox.checked = env.throwingExpectationFailures();
|
throwCheckbox.checked = env.throwingExpectationFailures();
|
||||||
|
|||||||
@@ -563,7 +563,9 @@ getJasmineRequireObj().Spec = function(j$) {
|
|||||||
onException: function () {
|
onException: function () {
|
||||||
self.onException.apply(self, arguments);
|
self.onException.apply(self, arguments);
|
||||||
},
|
},
|
||||||
onComplete: onComplete,
|
onComplete: function() {
|
||||||
|
onComplete(self.result.status === 'failed' && new j$.StopExecutionError('spec failed'));
|
||||||
|
},
|
||||||
userContext: this.userContext()
|
userContext: this.userContext()
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -712,8 +714,6 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
|
|
||||||
var totalSpecsDefined = 0;
|
var totalSpecsDefined = 0;
|
||||||
|
|
||||||
var catchExceptions = true;
|
|
||||||
|
|
||||||
var realSetTimeout = j$.getGlobal().setTimeout;
|
var realSetTimeout = j$.getGlobal().setTimeout;
|
||||||
var realClearTimeout = j$.getGlobal().clearTimeout;
|
var realClearTimeout = j$.getGlobal().clearTimeout;
|
||||||
var clearStack = j$.getClearStack(j$.getGlobal());
|
var clearStack = j$.getClearStack(j$.getGlobal());
|
||||||
@@ -725,6 +725,7 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
var currentlyExecutingSuites = [];
|
var currentlyExecutingSuites = [];
|
||||||
var currentDeclarationSuite = null;
|
var currentDeclarationSuite = null;
|
||||||
var throwOnExpectationFailure = false;
|
var throwOnExpectationFailure = false;
|
||||||
|
var stopOnSpecFailure = false;
|
||||||
var random = true;
|
var random = true;
|
||||||
var seed = null;
|
var seed = null;
|
||||||
var handlingLoadErrors = true;
|
var handlingLoadErrors = true;
|
||||||
@@ -859,23 +860,9 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
return buildExpectationResult(attrs);
|
return buildExpectationResult(attrs);
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: fix this naming, and here's where the value comes in
|
|
||||||
this.catchExceptions = function(value) {
|
|
||||||
catchExceptions = !!value;
|
|
||||||
return catchExceptions;
|
|
||||||
};
|
|
||||||
|
|
||||||
this.catchingExceptions = function() {
|
|
||||||
return catchExceptions;
|
|
||||||
};
|
|
||||||
|
|
||||||
var maximumSpecCallbackDepth = 20;
|
var maximumSpecCallbackDepth = 20;
|
||||||
var currentSpecCallbackDepth = 0;
|
var currentSpecCallbackDepth = 0;
|
||||||
|
|
||||||
var catchException = function(e) {
|
|
||||||
return j$.Spec.isPendingSpecException(e) || catchExceptions;
|
|
||||||
};
|
|
||||||
|
|
||||||
this.throwOnExpectationFailure = function(value) {
|
this.throwOnExpectationFailure = function(value) {
|
||||||
throwOnExpectationFailure = !!value;
|
throwOnExpectationFailure = !!value;
|
||||||
};
|
};
|
||||||
@@ -884,6 +871,14 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
return throwOnExpectationFailure;
|
return throwOnExpectationFailure;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.stopOnSpecFailure = function(value) {
|
||||||
|
stopOnSpecFailure = !!value;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.stoppingOnSpecFailure = function() {
|
||||||
|
return stopOnSpecFailure;
|
||||||
|
};
|
||||||
|
|
||||||
this.randomizeTests = function(value) {
|
this.randomizeTests = function(value) {
|
||||||
random = !!value;
|
random = !!value;
|
||||||
};
|
};
|
||||||
@@ -907,12 +902,17 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
var queueRunnerFactory = function(options, args) {
|
var queueRunnerFactory = function(options, args) {
|
||||||
options.catchException = catchException;
|
var failFast = false;
|
||||||
|
if (options.isLeaf) {
|
||||||
|
failFast = throwOnExpectationFailure;
|
||||||
|
} else if (!options.isReporter) {
|
||||||
|
failFast = stopOnSpecFailure;
|
||||||
|
}
|
||||||
options.clearStack = options.clearStack || clearStack;
|
options.clearStack = options.clearStack || clearStack;
|
||||||
options.timeout = {setTimeout: realSetTimeout, clearTimeout: realClearTimeout};
|
options.timeout = {setTimeout: realSetTimeout, clearTimeout: realClearTimeout};
|
||||||
options.fail = self.fail;
|
options.fail = self.fail;
|
||||||
options.globalErrors = globalErrors;
|
options.globalErrors = globalErrors;
|
||||||
options.completeOnFirstError = throwOnExpectationFailure && options.isLeaf;
|
options.completeOnFirstError = failFast;
|
||||||
options.onException = options.onException || function(e) {
|
options.onException = options.onException || function(e) {
|
||||||
(currentRunnable() || topSuite).onException(e);
|
(currentRunnable() || topSuite).onException(e);
|
||||||
};
|
};
|
||||||
@@ -4447,6 +4447,9 @@ getJasmineRequireObj().pp = function(j$) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
getJasmineRequireObj().QueueRunner = function(j$) {
|
getJasmineRequireObj().QueueRunner = function(j$) {
|
||||||
|
function StopExecutionError() {}
|
||||||
|
StopExecutionError.prototype = new Error();
|
||||||
|
j$.StopExecutionError = StopExecutionError;
|
||||||
|
|
||||||
function once(fn) {
|
function once(fn) {
|
||||||
var called = false;
|
var called = false;
|
||||||
@@ -4466,12 +4469,12 @@ getJasmineRequireObj().QueueRunner = function(j$) {
|
|||||||
this.onComplete = attrs.onComplete || function() {};
|
this.onComplete = attrs.onComplete || function() {};
|
||||||
this.clearStack = attrs.clearStack || function(fn) {fn();};
|
this.clearStack = attrs.clearStack || function(fn) {fn();};
|
||||||
this.onException = attrs.onException || function() {};
|
this.onException = attrs.onException || function() {};
|
||||||
this.catchException = attrs.catchException || function() { return true; };
|
|
||||||
this.userContext = attrs.userContext || new j$.UserContext();
|
this.userContext = attrs.userContext || new j$.UserContext();
|
||||||
this.timeout = attrs.timeout || {setTimeout: setTimeout, clearTimeout: clearTimeout};
|
this.timeout = attrs.timeout || {setTimeout: setTimeout, clearTimeout: clearTimeout};
|
||||||
this.fail = attrs.fail || function() {};
|
this.fail = attrs.fail || function() {};
|
||||||
this.globalErrors = attrs.globalErrors || { pushListener: function() {}, popListener: function() {} };
|
this.globalErrors = attrs.globalErrors || { pushListener: function() {}, popListener: function() {} };
|
||||||
this.completeOnFirstError = !!attrs.completeOnFirstError;
|
this.completeOnFirstError = !!attrs.completeOnFirstError;
|
||||||
|
this.errored = false;
|
||||||
|
|
||||||
if (typeof(this.onComplete) !== 'function') {
|
if (typeof(this.onComplete) !== 'function') {
|
||||||
throw new Error('invalid onComplete ' + JSON.stringify(this.onComplete));
|
throw new Error('invalid onComplete ' + JSON.stringify(this.onComplete));
|
||||||
@@ -4517,8 +4520,10 @@ getJasmineRequireObj().QueueRunner = function(j$) {
|
|||||||
cleanup();
|
cleanup();
|
||||||
|
|
||||||
if (j$.isError_(err)) {
|
if (j$.isError_(err)) {
|
||||||
self.fail(err);
|
if (!(err instanceof StopExecutionError)) {
|
||||||
errored = true;
|
self.fail(err);
|
||||||
|
}
|
||||||
|
self.errored = errored = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function runNext() {
|
function runNext() {
|
||||||
@@ -4541,7 +4546,7 @@ getJasmineRequireObj().QueueRunner = function(j$) {
|
|||||||
|
|
||||||
next.fail = function nextFail() {
|
next.fail = function nextFail() {
|
||||||
self.fail.apply(null, arguments);
|
self.fail.apply(null, arguments);
|
||||||
errored = true;
|
self.errored = errored = true;
|
||||||
next();
|
next();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -4570,8 +4575,8 @@ getJasmineRequireObj().QueueRunner = function(j$) {
|
|||||||
return { completedSynchronously: false };
|
return { completedSynchronously: false };
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
handleException(e, queueableFn);
|
onException(e);
|
||||||
errored = true;
|
self.errored = errored = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup();
|
cleanup();
|
||||||
@@ -4579,22 +4584,13 @@ getJasmineRequireObj().QueueRunner = function(j$) {
|
|||||||
|
|
||||||
function onException(e) {
|
function onException(e) {
|
||||||
self.onException(e);
|
self.onException(e);
|
||||||
errored = true;
|
self.errored = errored = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function onPromiseRejection(e) {
|
function onPromiseRejection(e) {
|
||||||
onException(e);
|
onException(e);
|
||||||
next();
|
next();
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleException(e, queueableFn) {
|
|
||||||
onException(e);
|
|
||||||
if (!self.catchException(e)) {
|
|
||||||
//TODO: set a var when we catch an exception and
|
|
||||||
//use a finally block to close the loop in a nice way..
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
QueueRunner.prototype.run = function(recursiveIndex) {
|
QueueRunner.prototype.run = function(recursiveIndex) {
|
||||||
@@ -4610,6 +4606,8 @@ getJasmineRequireObj().QueueRunner = function(j$) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.errored = result.errored;
|
||||||
|
|
||||||
if (this.completeOnFirstError && result.errored) {
|
if (this.completeOnFirstError && result.errored) {
|
||||||
this.skipToCleanup(iterativeIndex);
|
this.skipToCleanup(iterativeIndex);
|
||||||
return;
|
return;
|
||||||
@@ -4618,7 +4616,7 @@ getJasmineRequireObj().QueueRunner = function(j$) {
|
|||||||
|
|
||||||
this.clearStack(function() {
|
this.clearStack(function() {
|
||||||
self.globalErrors.popListener(self.handleFinalError);
|
self.globalErrors.popListener(self.handleFinalError);
|
||||||
self.onComplete();
|
self.onComplete(self.errored && new StopExecutionError());
|
||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -4671,7 +4669,8 @@ getJasmineRequireObj().ReportDispatcher = function(j$) {
|
|||||||
|
|
||||||
queueRunnerFactory({
|
queueRunnerFactory({
|
||||||
queueableFns: fns,
|
queueableFns: fns,
|
||||||
onComplete: onComplete
|
onComplete: onComplete,
|
||||||
|
isReporter: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -158,6 +158,29 @@ describe("QueueRunner", function() {
|
|||||||
expect(queueableFn2.fn).toHaveBeenCalled();
|
expect(queueableFn2.fn).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("does not cause an explicit fail if execution is being stopped", function() {
|
||||||
|
var err = new jasmineUnderTest.StopExecutionError('foo'),
|
||||||
|
queueableFn1 = { fn: function(done) {
|
||||||
|
setTimeout(function() { done(err); }, 100);
|
||||||
|
} },
|
||||||
|
queueableFn2 = { fn: jasmine.createSpy('fn2') },
|
||||||
|
failFn = jasmine.createSpy('fail'),
|
||||||
|
queueRunner = new jasmineUnderTest.QueueRunner({
|
||||||
|
queueableFns: [queueableFn1, queueableFn2],
|
||||||
|
fail: failFn
|
||||||
|
});
|
||||||
|
|
||||||
|
queueRunner.execute();
|
||||||
|
|
||||||
|
expect(failFn).not.toHaveBeenCalled();
|
||||||
|
expect(queueableFn2.fn).not.toHaveBeenCalled();
|
||||||
|
|
||||||
|
jasmine.clock().tick(100);
|
||||||
|
|
||||||
|
expect(failFn).not.toHaveBeenCalled();
|
||||||
|
expect(queueableFn2.fn).toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
it("sets a timeout if requested for asynchronous functions so they don't go on forever", function() {
|
it("sets a timeout if requested for asynchronous functions so they don't go on forever", function() {
|
||||||
var timeout = 3,
|
var timeout = 3,
|
||||||
beforeFn = { fn: function(done) { }, type: 'before', timeout: function() { return timeout; } },
|
beforeFn = { fn: function(done) { }, type: 'before', timeout: function() { return timeout; } },
|
||||||
@@ -442,20 +465,6 @@ describe("QueueRunner", function() {
|
|||||||
expect(onExceptionCallback).toHaveBeenCalledWith(jasmine.any(Error));
|
expect(onExceptionCallback).toHaveBeenCalledWith(jasmine.any(Error));
|
||||||
});
|
});
|
||||||
|
|
||||||
it("rethrows an exception if told to", function() {
|
|
||||||
var queueableFn = { fn: function() {
|
|
||||||
throw new Error('fake error');
|
|
||||||
} },
|
|
||||||
queueRunner = new jasmineUnderTest.QueueRunner({
|
|
||||||
queueableFns: [queueableFn],
|
|
||||||
catchException: function(e) { return false; }
|
|
||||||
});
|
|
||||||
|
|
||||||
expect(function() {
|
|
||||||
queueRunner.execute();
|
|
||||||
}).toThrowError('fake error');
|
|
||||||
});
|
|
||||||
|
|
||||||
it("continues running the functions even after an exception is thrown in an async spec", function() {
|
it("continues running the functions even after an exception is thrown in an async spec", function() {
|
||||||
var queueableFn = { fn: function(done) { throw new Error("error"); } },
|
var queueableFn = { fn: function(done) { throw new Error("error"); } },
|
||||||
nextQueueableFn = { fn: jasmine.createSpy("nextFunction") },
|
nextQueueableFn = { fn: jasmine.createSpy("nextFunction") },
|
||||||
|
|||||||
@@ -21,7 +21,8 @@ describe("ReportDispatcher", function() {
|
|||||||
dispatcher.foo(123, 456, completeCallback);
|
dispatcher.foo(123, 456, completeCallback);
|
||||||
|
|
||||||
expect(queueRunnerFactory).toHaveBeenCalledWith(jasmine.objectContaining({
|
expect(queueRunnerFactory).toHaveBeenCalledWith(jasmine.objectContaining({
|
||||||
queueableFns: [{fn: jasmine.any(Function)}, {fn: jasmine.any(Function)}]
|
queueableFns: [{fn: jasmine.any(Function)}, {fn: jasmine.any(Function)}],
|
||||||
|
isReporter: true
|
||||||
}));
|
}));
|
||||||
|
|
||||||
var fns = queueRunnerFactory.calls.mostRecent().args[0].queueableFns;
|
var fns = queueRunnerFactory.calls.mostRecent().args[0].queueableFns;
|
||||||
@@ -38,7 +39,8 @@ describe("ReportDispatcher", function() {
|
|||||||
dispatcher.bar('a', 'b', completeCallback);
|
dispatcher.bar('a', 'b', completeCallback);
|
||||||
|
|
||||||
expect(queueRunnerFactory).toHaveBeenCalledWith(jasmine.objectContaining({
|
expect(queueRunnerFactory).toHaveBeenCalledWith(jasmine.objectContaining({
|
||||||
queueableFns: [{fn: jasmine.any(Function)}, {fn: jasmine.any(Function)}]
|
queueableFns: [{fn: jasmine.any(Function)}, {fn: jasmine.any(Function)}],
|
||||||
|
isReporter: true
|
||||||
}));
|
}));
|
||||||
|
|
||||||
fns = queueRunnerFactory.calls.mostRecent().args[0].queueableFns;
|
fns = queueRunnerFactory.calls.mostRecent().args[0].queueableFns;
|
||||||
@@ -72,7 +74,8 @@ describe("ReportDispatcher", function() {
|
|||||||
dispatcher.foo(123, 456, completeCallback);
|
dispatcher.foo(123, 456, completeCallback);
|
||||||
|
|
||||||
expect(queueRunnerFactory).toHaveBeenCalledWith(jasmine.objectContaining({
|
expect(queueRunnerFactory).toHaveBeenCalledWith(jasmine.objectContaining({
|
||||||
queueableFns: [{fn: jasmine.any(Function)}]
|
queueableFns: [{fn: jasmine.any(Function)}],
|
||||||
|
isReporter: true
|
||||||
}));
|
}));
|
||||||
|
|
||||||
var fns = queueRunnerFactory.calls.mostRecent().args[0].queueableFns;
|
var fns = queueRunnerFactory.calls.mostRecent().args[0].queueableFns;
|
||||||
@@ -92,7 +95,8 @@ describe("ReportDispatcher", function() {
|
|||||||
dispatcher.foo(123, 456, completeCallback);
|
dispatcher.foo(123, 456, completeCallback);
|
||||||
|
|
||||||
expect(queueRunnerFactory).toHaveBeenCalledWith(jasmine.objectContaining({
|
expect(queueRunnerFactory).toHaveBeenCalledWith(jasmine.objectContaining({
|
||||||
queueableFns: [{fn: jasmine.any(Function)}]
|
queueableFns: [{fn: jasmine.any(Function)}],
|
||||||
|
isReporter: true
|
||||||
}));
|
}));
|
||||||
|
|
||||||
var fns = queueRunnerFactory.calls.mostRecent().args[0].queueableFns;
|
var fns = queueRunnerFactory.calls.mostRecent().args[0].queueableFns;
|
||||||
@@ -111,7 +115,8 @@ describe("ReportDispatcher", function() {
|
|||||||
dispatcher.addReporter(reporter1);
|
dispatcher.addReporter(reporter1);
|
||||||
dispatcher.foo(123, completeCallback);
|
dispatcher.foo(123, completeCallback);
|
||||||
expect(queueRunnerFactory).toHaveBeenCalledWith(jasmine.objectContaining({
|
expect(queueRunnerFactory).toHaveBeenCalledWith(jasmine.objectContaining({
|
||||||
queueableFns: [{fn: jasmine.any(Function)}]
|
queueableFns: [{fn: jasmine.any(Function)}],
|
||||||
|
isReporter: true
|
||||||
}));
|
}));
|
||||||
|
|
||||||
var fns = queueRunnerFactory.calls.mostRecent().args[0].queueableFns;
|
var fns = queueRunnerFactory.calls.mostRecent().args[0].queueableFns;
|
||||||
@@ -123,7 +128,8 @@ describe("ReportDispatcher", function() {
|
|||||||
dispatcher.bar(456, completeCallback);
|
dispatcher.bar(456, completeCallback);
|
||||||
|
|
||||||
expect(queueRunnerFactory).toHaveBeenCalledWith(jasmine.objectContaining({
|
expect(queueRunnerFactory).toHaveBeenCalledWith(jasmine.objectContaining({
|
||||||
queueableFns: [{fn: jasmine.any(Function)}]
|
queueableFns: [{fn: jasmine.any(Function)}],
|
||||||
|
isReporter: true
|
||||||
}));
|
}));
|
||||||
|
|
||||||
fns = queueRunnerFactory.calls.mostRecent().args[0].queueableFns;
|
fns = queueRunnerFactory.calls.mostRecent().args[0].queueableFns;
|
||||||
|
|||||||
@@ -157,7 +157,7 @@ describe("Spec", function() {
|
|||||||
spec.execute('cally-back', true);
|
spec.execute('cally-back', true);
|
||||||
|
|
||||||
expect(fakeQueueRunner).toHaveBeenCalledWith(jasmine.objectContaining({
|
expect(fakeQueueRunner).toHaveBeenCalledWith(jasmine.objectContaining({
|
||||||
onComplete: 'cally-back',
|
onComplete: jasmine.any(Function),
|
||||||
queueableFns: [{fn: jasmine.any(Function)}],
|
queueableFns: [{fn: jasmine.any(Function)}],
|
||||||
cleanupFns: [{fn: jasmine.any(Function)}]
|
cleanupFns: [{fn: jasmine.any(Function)}]
|
||||||
}));
|
}));
|
||||||
@@ -224,6 +224,23 @@ describe("Spec", function() {
|
|||||||
expect(done).toHaveBeenCalled();
|
expect(done).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("should call the done callback with an error if the spec is failed", function() {
|
||||||
|
var done = jasmine.createSpy('done callback'),
|
||||||
|
spec = new jasmineUnderTest.Spec({
|
||||||
|
queueableFn: { fn: function() {} },
|
||||||
|
catchExceptions: function() { return false; },
|
||||||
|
resultCallback: function() {},
|
||||||
|
queueRunnerFactory: function(attrs) {
|
||||||
|
spec.result.status = 'failed';
|
||||||
|
attrs.onComplete();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
spec.execute(done);
|
||||||
|
|
||||||
|
expect(done).toHaveBeenCalledWith(jasmine.any(jasmineUnderTest.StopExecutionError));
|
||||||
|
});
|
||||||
|
|
||||||
it("#status returns passing by default", function() {
|
it("#status returns passing by default", function() {
|
||||||
var spec = new jasmineUnderTest.Spec({queueableFn: { fn: jasmine.createSpy("spec body")} });
|
var spec = new jasmineUnderTest.Spec({queueableFn: { fn: jasmine.createSpy("spec body")} });
|
||||||
expect(spec.status()).toBe('passed');
|
expect(spec.status()).toBe('passed');
|
||||||
|
|||||||
@@ -947,4 +947,30 @@ describe("spec running", function () {
|
|||||||
env.execute();
|
env.execute();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("when stopOnSpecFailure is on", function() {
|
||||||
|
it("does not run further specs when one fails", function(done) {
|
||||||
|
var actions = [];
|
||||||
|
|
||||||
|
env.it('fails', function() {
|
||||||
|
actions.push('fails');
|
||||||
|
env.expect(1).toBe(2);
|
||||||
|
});
|
||||||
|
|
||||||
|
env.it('does not run', function() {
|
||||||
|
actions.push('does not run');
|
||||||
|
});
|
||||||
|
|
||||||
|
env.randomizeTests(false);
|
||||||
|
env.stopOnSpecFailure(true);
|
||||||
|
|
||||||
|
var assertions = function() {
|
||||||
|
expect(actions).toEqual(['fails']);
|
||||||
|
done();
|
||||||
|
};
|
||||||
|
|
||||||
|
env.addReporter({ jasmineDone: assertions });
|
||||||
|
env.execute();
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -436,8 +436,8 @@ describe("HtmlReporter", function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("UI for raising/catching exceptions", function() {
|
describe("UI for stop on spec failure", function() {
|
||||||
it("should be unchecked if the env is catching", function() {
|
it("should be unchecked for full execution", function() {
|
||||||
var env = new jasmineUnderTest.Env(),
|
var env = new jasmineUnderTest.Env(),
|
||||||
container = document.createElement("div"),
|
container = document.createElement("div"),
|
||||||
getContainer = function() {
|
getContainer = function() {
|
||||||
@@ -457,11 +457,11 @@ describe("HtmlReporter", function() {
|
|||||||
reporter.initialize();
|
reporter.initialize();
|
||||||
reporter.jasmineDone({});
|
reporter.jasmineDone({});
|
||||||
|
|
||||||
var raisingExceptionsUI = container.querySelector(".jasmine-raise");
|
var stopOnFailureUI = container.querySelector(".jasmine-fail-fast");
|
||||||
expect(raisingExceptionsUI.checked).toBe(false);
|
expect(stopOnFailureUI.checked).toBe(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should be checked if the env is not catching", function() {
|
it("should be checked if stopping short", function() {
|
||||||
var env = new jasmineUnderTest.Env(),
|
var env = new jasmineUnderTest.Env(),
|
||||||
container = document.createElement("div"),
|
container = document.createElement("div"),
|
||||||
getContainer = function() {
|
getContainer = function() {
|
||||||
@@ -478,25 +478,26 @@ describe("HtmlReporter", function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
env.stopOnSpecFailure(true);
|
||||||
|
|
||||||
reporter.initialize();
|
reporter.initialize();
|
||||||
env.catchExceptions(false);
|
|
||||||
reporter.jasmineDone({});
|
reporter.jasmineDone({});
|
||||||
|
|
||||||
var raisingExceptionsUI = container.querySelector(".jasmine-raise");
|
var stopOnFailureUI = container.querySelector(".jasmine-fail-fast");
|
||||||
expect(raisingExceptionsUI.checked).toBe(true);
|
expect(stopOnFailureUI.checked).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should affect the query param for catching exceptions", function() {
|
it("should trigger the callback when changed", function() {
|
||||||
var env = new jasmineUnderTest.Env(),
|
var env = new jasmineUnderTest.Env(),
|
||||||
container = document.createElement("div"),
|
container = document.createElement("div"),
|
||||||
exceptionsClickHandler = jasmine.createSpy("raise exceptions checked"),
|
failFastHandler = jasmine.createSpy('failFast'),
|
||||||
getContainer = function() {
|
getContainer = function() {
|
||||||
return container;
|
return container;
|
||||||
},
|
},
|
||||||
reporter = new jasmineUnderTest.HtmlReporter({
|
reporter = new jasmineUnderTest.HtmlReporter({
|
||||||
env: env,
|
env: env,
|
||||||
|
onStopExecutionClick: failFastHandler,
|
||||||
getContainer: getContainer,
|
getContainer: getContainer,
|
||||||
onRaiseExceptionsClick: exceptionsClickHandler,
|
|
||||||
createElement: function() {
|
createElement: function() {
|
||||||
return document.createElement.apply(document, arguments);
|
return document.createElement.apply(document, arguments);
|
||||||
},
|
},
|
||||||
@@ -505,12 +506,15 @@ describe("HtmlReporter", function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
env.stopOnSpecFailure(true);
|
||||||
|
|
||||||
reporter.initialize();
|
reporter.initialize();
|
||||||
reporter.jasmineDone({});
|
reporter.jasmineDone({});
|
||||||
|
|
||||||
var input = container.querySelector(".jasmine-raise");
|
var stopOnFailureUI = container.querySelector(".jasmine-fail-fast");
|
||||||
input.click();
|
stopOnFailureUI.click();
|
||||||
expect(exceptionsClickHandler).toHaveBeenCalled();
|
|
||||||
|
expect(failFastHandler).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -13,8 +13,6 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
|
|
||||||
var totalSpecsDefined = 0;
|
var totalSpecsDefined = 0;
|
||||||
|
|
||||||
var catchExceptions = true;
|
|
||||||
|
|
||||||
var realSetTimeout = j$.getGlobal().setTimeout;
|
var realSetTimeout = j$.getGlobal().setTimeout;
|
||||||
var realClearTimeout = j$.getGlobal().clearTimeout;
|
var realClearTimeout = j$.getGlobal().clearTimeout;
|
||||||
var clearStack = j$.getClearStack(j$.getGlobal());
|
var clearStack = j$.getClearStack(j$.getGlobal());
|
||||||
@@ -26,6 +24,7 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
var currentlyExecutingSuites = [];
|
var currentlyExecutingSuites = [];
|
||||||
var currentDeclarationSuite = null;
|
var currentDeclarationSuite = null;
|
||||||
var throwOnExpectationFailure = false;
|
var throwOnExpectationFailure = false;
|
||||||
|
var stopOnSpecFailure = false;
|
||||||
var random = true;
|
var random = true;
|
||||||
var seed = null;
|
var seed = null;
|
||||||
var handlingLoadErrors = true;
|
var handlingLoadErrors = true;
|
||||||
@@ -160,23 +159,9 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
return buildExpectationResult(attrs);
|
return buildExpectationResult(attrs);
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: fix this naming, and here's where the value comes in
|
|
||||||
this.catchExceptions = function(value) {
|
|
||||||
catchExceptions = !!value;
|
|
||||||
return catchExceptions;
|
|
||||||
};
|
|
||||||
|
|
||||||
this.catchingExceptions = function() {
|
|
||||||
return catchExceptions;
|
|
||||||
};
|
|
||||||
|
|
||||||
var maximumSpecCallbackDepth = 20;
|
var maximumSpecCallbackDepth = 20;
|
||||||
var currentSpecCallbackDepth = 0;
|
var currentSpecCallbackDepth = 0;
|
||||||
|
|
||||||
var catchException = function(e) {
|
|
||||||
return j$.Spec.isPendingSpecException(e) || catchExceptions;
|
|
||||||
};
|
|
||||||
|
|
||||||
this.throwOnExpectationFailure = function(value) {
|
this.throwOnExpectationFailure = function(value) {
|
||||||
throwOnExpectationFailure = !!value;
|
throwOnExpectationFailure = !!value;
|
||||||
};
|
};
|
||||||
@@ -185,6 +170,14 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
return throwOnExpectationFailure;
|
return throwOnExpectationFailure;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.stopOnSpecFailure = function(value) {
|
||||||
|
stopOnSpecFailure = !!value;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.stoppingOnSpecFailure = function() {
|
||||||
|
return stopOnSpecFailure;
|
||||||
|
};
|
||||||
|
|
||||||
this.randomizeTests = function(value) {
|
this.randomizeTests = function(value) {
|
||||||
random = !!value;
|
random = !!value;
|
||||||
};
|
};
|
||||||
@@ -208,12 +201,17 @@ getJasmineRequireObj().Env = function(j$) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
var queueRunnerFactory = function(options, args) {
|
var queueRunnerFactory = function(options, args) {
|
||||||
options.catchException = catchException;
|
var failFast = false;
|
||||||
|
if (options.isLeaf) {
|
||||||
|
failFast = throwOnExpectationFailure;
|
||||||
|
} else if (!options.isReporter) {
|
||||||
|
failFast = stopOnSpecFailure;
|
||||||
|
}
|
||||||
options.clearStack = options.clearStack || clearStack;
|
options.clearStack = options.clearStack || clearStack;
|
||||||
options.timeout = {setTimeout: realSetTimeout, clearTimeout: realClearTimeout};
|
options.timeout = {setTimeout: realSetTimeout, clearTimeout: realClearTimeout};
|
||||||
options.fail = self.fail;
|
options.fail = self.fail;
|
||||||
options.globalErrors = globalErrors;
|
options.globalErrors = globalErrors;
|
||||||
options.completeOnFirstError = throwOnExpectationFailure && options.isLeaf;
|
options.completeOnFirstError = failFast;
|
||||||
options.onException = options.onException || function(e) {
|
options.onException = options.onException || function(e) {
|
||||||
(currentRunnable() || topSuite).onException(e);
|
(currentRunnable() || topSuite).onException(e);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
getJasmineRequireObj().QueueRunner = function(j$) {
|
getJasmineRequireObj().QueueRunner = function(j$) {
|
||||||
|
function StopExecutionError() {}
|
||||||
|
StopExecutionError.prototype = new Error();
|
||||||
|
j$.StopExecutionError = StopExecutionError;
|
||||||
|
|
||||||
function once(fn) {
|
function once(fn) {
|
||||||
var called = false;
|
var called = false;
|
||||||
@@ -18,12 +21,12 @@ getJasmineRequireObj().QueueRunner = function(j$) {
|
|||||||
this.onComplete = attrs.onComplete || function() {};
|
this.onComplete = attrs.onComplete || function() {};
|
||||||
this.clearStack = attrs.clearStack || function(fn) {fn();};
|
this.clearStack = attrs.clearStack || function(fn) {fn();};
|
||||||
this.onException = attrs.onException || function() {};
|
this.onException = attrs.onException || function() {};
|
||||||
this.catchException = attrs.catchException || function() { return true; };
|
|
||||||
this.userContext = attrs.userContext || new j$.UserContext();
|
this.userContext = attrs.userContext || new j$.UserContext();
|
||||||
this.timeout = attrs.timeout || {setTimeout: setTimeout, clearTimeout: clearTimeout};
|
this.timeout = attrs.timeout || {setTimeout: setTimeout, clearTimeout: clearTimeout};
|
||||||
this.fail = attrs.fail || function() {};
|
this.fail = attrs.fail || function() {};
|
||||||
this.globalErrors = attrs.globalErrors || { pushListener: function() {}, popListener: function() {} };
|
this.globalErrors = attrs.globalErrors || { pushListener: function() {}, popListener: function() {} };
|
||||||
this.completeOnFirstError = !!attrs.completeOnFirstError;
|
this.completeOnFirstError = !!attrs.completeOnFirstError;
|
||||||
|
this.errored = false;
|
||||||
|
|
||||||
if (typeof(this.onComplete) !== 'function') {
|
if (typeof(this.onComplete) !== 'function') {
|
||||||
throw new Error('invalid onComplete ' + JSON.stringify(this.onComplete));
|
throw new Error('invalid onComplete ' + JSON.stringify(this.onComplete));
|
||||||
@@ -69,8 +72,10 @@ getJasmineRequireObj().QueueRunner = function(j$) {
|
|||||||
cleanup();
|
cleanup();
|
||||||
|
|
||||||
if (j$.isError_(err)) {
|
if (j$.isError_(err)) {
|
||||||
self.fail(err);
|
if (!(err instanceof StopExecutionError)) {
|
||||||
errored = true;
|
self.fail(err);
|
||||||
|
}
|
||||||
|
self.errored = errored = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function runNext() {
|
function runNext() {
|
||||||
@@ -93,7 +98,7 @@ getJasmineRequireObj().QueueRunner = function(j$) {
|
|||||||
|
|
||||||
next.fail = function nextFail() {
|
next.fail = function nextFail() {
|
||||||
self.fail.apply(null, arguments);
|
self.fail.apply(null, arguments);
|
||||||
errored = true;
|
self.errored = errored = true;
|
||||||
next();
|
next();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -122,8 +127,8 @@ getJasmineRequireObj().QueueRunner = function(j$) {
|
|||||||
return { completedSynchronously: false };
|
return { completedSynchronously: false };
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
handleException(e, queueableFn);
|
onException(e);
|
||||||
errored = true;
|
self.errored = errored = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup();
|
cleanup();
|
||||||
@@ -131,22 +136,13 @@ getJasmineRequireObj().QueueRunner = function(j$) {
|
|||||||
|
|
||||||
function onException(e) {
|
function onException(e) {
|
||||||
self.onException(e);
|
self.onException(e);
|
||||||
errored = true;
|
self.errored = errored = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function onPromiseRejection(e) {
|
function onPromiseRejection(e) {
|
||||||
onException(e);
|
onException(e);
|
||||||
next();
|
next();
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleException(e, queueableFn) {
|
|
||||||
onException(e);
|
|
||||||
if (!self.catchException(e)) {
|
|
||||||
//TODO: set a var when we catch an exception and
|
|
||||||
//use a finally block to close the loop in a nice way..
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
QueueRunner.prototype.run = function(recursiveIndex) {
|
QueueRunner.prototype.run = function(recursiveIndex) {
|
||||||
@@ -162,6 +158,8 @@ getJasmineRequireObj().QueueRunner = function(j$) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.errored = result.errored;
|
||||||
|
|
||||||
if (this.completeOnFirstError && result.errored) {
|
if (this.completeOnFirstError && result.errored) {
|
||||||
this.skipToCleanup(iterativeIndex);
|
this.skipToCleanup(iterativeIndex);
|
||||||
return;
|
return;
|
||||||
@@ -170,7 +168,7 @@ getJasmineRequireObj().QueueRunner = function(j$) {
|
|||||||
|
|
||||||
this.clearStack(function() {
|
this.clearStack(function() {
|
||||||
self.globalErrors.popListener(self.handleFinalError);
|
self.globalErrors.popListener(self.handleFinalError);
|
||||||
self.onComplete();
|
self.onComplete(self.errored && new StopExecutionError());
|
||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -43,7 +43,8 @@ getJasmineRequireObj().ReportDispatcher = function(j$) {
|
|||||||
|
|
||||||
queueRunnerFactory({
|
queueRunnerFactory({
|
||||||
queueableFns: fns,
|
queueableFns: fns,
|
||||||
onComplete: onComplete
|
onComplete: onComplete,
|
||||||
|
isReporter: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -82,7 +82,9 @@ getJasmineRequireObj().Spec = function(j$) {
|
|||||||
onException: function () {
|
onException: function () {
|
||||||
self.onException.apply(self, arguments);
|
self.onException.apply(self, arguments);
|
||||||
},
|
},
|
||||||
onComplete: onComplete,
|
onComplete: function() {
|
||||||
|
onComplete(self.result.status === 'failed' && new j$.StopExecutionError('spec failed'));
|
||||||
|
},
|
||||||
userContext: this.userContext()
|
userContext: this.userContext()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|||||||
getContainer = options.getContainer,
|
getContainer = options.getContainer,
|
||||||
createElement = options.createElement,
|
createElement = options.createElement,
|
||||||
createTextNode = options.createTextNode,
|
createTextNode = options.createTextNode,
|
||||||
onRaiseExceptionsClick = options.onRaiseExceptionsClick || function() {},
|
onStopExecutionClick = options.onStopExecutionClick || function() {},
|
||||||
onThrowExpectationsClick = options.onThrowExpectationsClick || function() {},
|
onThrowExpectationsClick = options.onThrowExpectationsClick || function() {},
|
||||||
onRandomClick = options.onRandomClick || function() {},
|
onRandomClick = options.onRandomClick || function() {},
|
||||||
addToExistingQueryString = options.addToExistingQueryString || defaultQueryString,
|
addToExistingQueryString = options.addToExistingQueryString || defaultQueryString,
|
||||||
@@ -292,13 +292,13 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|||||||
var optionsMenuDom = createDom('div', { className: 'jasmine-run-options' },
|
var optionsMenuDom = createDom('div', { className: 'jasmine-run-options' },
|
||||||
createDom('span', { className: 'jasmine-trigger' }, 'Options'),
|
createDom('span', { className: 'jasmine-trigger' }, 'Options'),
|
||||||
createDom('div', { className: 'jasmine-payload' },
|
createDom('div', { className: 'jasmine-payload' },
|
||||||
createDom('div', { className: 'jasmine-exceptions' },
|
createDom('div', { className: 'jasmine-stop-on-failure' },
|
||||||
createDom('input', {
|
createDom('input', {
|
||||||
className: 'jasmine-raise',
|
className: 'jasmine-fail-fast',
|
||||||
id: 'jasmine-raise-exceptions',
|
id: 'jasmine-fail-fast',
|
||||||
type: 'checkbox'
|
type: 'checkbox'
|
||||||
}),
|
}),
|
||||||
createDom('label', { className: 'jasmine-label', 'for': 'jasmine-raise-exceptions' }, 'raise exceptions')),
|
createDom('label', { className: 'jasmine-label', 'for': 'jasmine-fail-fast' }, 'stop execution on spec failure')),
|
||||||
createDom('div', { className: 'jasmine-throw-failures' },
|
createDom('div', { className: 'jasmine-throw-failures' },
|
||||||
createDom('input', {
|
createDom('input', {
|
||||||
className: 'jasmine-throw',
|
className: 'jasmine-throw',
|
||||||
@@ -316,10 +316,9 @@ jasmineRequire.HtmlReporter = function(j$) {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
var raiseCheckbox = optionsMenuDom.querySelector('#jasmine-raise-exceptions');
|
var failFastCheckbox = optionsMenuDom.querySelector('#jasmine-fail-fast');
|
||||||
|
failFastCheckbox.checked = env.stoppingOnSpecFailure();
|
||||||
raiseCheckbox.checked = !env.catchingExceptions();
|
failFastCheckbox.onclick = onStopExecutionClick;
|
||||||
raiseCheckbox.onclick = onRaiseExceptionsClick;
|
|
||||||
|
|
||||||
var throwCheckbox = optionsMenuDom.querySelector('#jasmine-throw-failures');
|
var throwCheckbox = optionsMenuDom.querySelector('#jasmine-throw-failures');
|
||||||
throwCheckbox.checked = env.throwingExpectationFailures();
|
throwCheckbox.checked = env.throwingExpectationFailures();
|
||||||
|
|||||||
Reference in New Issue
Block a user