Remove jasmine.CATCH_EXCEPTIONS
- HTMLReporters should be rewritten to make this sort of thing easier. - Fix HTMLReporter try/catch switch - We can't really call resultCallback & throw, so that's been reverted for now.
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
jasmine.HtmlReporter = function(_doc, jasmine, yieldForRender) {
|
||||
jasmine.HtmlReporter = function(_doc, jasmine, env, options) {
|
||||
options = options || {};
|
||||
var self = this;
|
||||
this.jasmine = jasmine || window.jasmine;
|
||||
var doc = _doc || window.document;
|
||||
|
||||
|
||||
var reporterView;
|
||||
|
||||
var dom = {};
|
||||
@@ -20,7 +22,7 @@ jasmine.HtmlReporter = function(_doc, jasmine, yieldForRender) {
|
||||
doc.body.appendChild(dom.reporter);
|
||||
setExceptionHandling();
|
||||
|
||||
reporterView = new self.jasmine.HtmlReporter.ReporterView(dom, self.jasmine);
|
||||
reporterView = new self.jasmine.HtmlReporter.ReporterView(dom, self.jasmine, env.catchingExceptions());
|
||||
reporterView.addSpecs(specs, self.specFilter);
|
||||
};
|
||||
|
||||
@@ -37,7 +39,7 @@ jasmine.HtmlReporter = function(_doc, jasmine, yieldForRender) {
|
||||
|
||||
var lastYieldForRender = 0;
|
||||
var refreshInterval = 250;
|
||||
yieldForRender = yieldForRender || function(fn) {
|
||||
var yieldForRender = options.yieldForRender || function(fn) {
|
||||
var now = Date.now();
|
||||
var delta = (now - lastYieldForRender);
|
||||
if (delta > refreshInterval) {
|
||||
@@ -116,7 +118,7 @@ jasmine.HtmlReporter = function(_doc, jasmine, yieldForRender) {
|
||||
}
|
||||
|
||||
function searchWithCatch() {
|
||||
var params = jasmine.HtmlReporter.parameters(window.document);
|
||||
var params = self.jasmine.HtmlReporter.parameters(window.document);
|
||||
var removed = false;
|
||||
var i = 0;
|
||||
|
||||
@@ -127,7 +129,7 @@ jasmine.HtmlReporter = function(_doc, jasmine, yieldForRender) {
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if (self.jasmine.CATCH_EXCEPTIONS) {
|
||||
if (env.catchingExceptions()) {
|
||||
params.push("catch=false");
|
||||
}
|
||||
|
||||
@@ -139,7 +141,7 @@ jasmine.HtmlReporter = function(_doc, jasmine, yieldForRender) {
|
||||
|
||||
if (noTryCatch()) {
|
||||
chxCatch.setAttribute('checked', true);
|
||||
self.jasmine.CATCH_EXCEPTIONS = false;
|
||||
env.catchExceptions(false);
|
||||
}
|
||||
chxCatch.onclick = function() {
|
||||
window.location.search = searchWithCatch();
|
||||
|
||||
@@ -46,7 +46,7 @@ jasmine.HtmlReporterHelpers.appendToSummary = function(child, childElement) {
|
||||
|
||||
if (parent) {
|
||||
if (typeof this.views.suites[parent.id] == 'undefined') {
|
||||
this.views.suites[parent.id] = new this.jasmine.HtmlReporter.SuiteView(parent, this.dom, this.views, this.jasmine);
|
||||
this.views.suites[parent.id] = new this.jasmine.HtmlReporter.SuiteView(parent, this.dom, this.views, this.jasmine, this.catchExceptions);
|
||||
}
|
||||
parentDiv = this.views.suites[parent.id].element;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
jasmine.HtmlReporter.ReporterView = function(dom, jasmine) {
|
||||
jasmine.HtmlReporter.ReporterView = function(dom, jasmine, catchExceptions) {
|
||||
this.startedAt = new Date();
|
||||
this.runningSpecCount = 0;
|
||||
this.completeSpecCount = 0;
|
||||
@@ -32,7 +32,7 @@ jasmine.HtmlReporter.ReporterView = function(dom, jasmine) {
|
||||
|
||||
for (var i = 0; i < specs.length; i++) {
|
||||
var spec = specs[i];
|
||||
this.views.specs[spec.id] = new this.jasmine.HtmlReporter.SpecView(spec, dom, this.views, this.jasmine);
|
||||
this.views.specs[spec.id] = new this.jasmine.HtmlReporter.SpecView(spec, dom, this.views, this.jasmine, catchExceptions);
|
||||
if (specFilter(spec)) {
|
||||
this.runningSpecCount++;
|
||||
}
|
||||
@@ -82,14 +82,14 @@ jasmine.HtmlReporter.ReporterView = function(dom, jasmine) {
|
||||
|
||||
// currently running UI
|
||||
if (isUndefined(this.runningAlert)) {
|
||||
this.runningAlert = this.createDom('a', { href: this.jasmine.HtmlReporter.sectionLink(null, this.jasmine.CATCH_EXCEPTIONS), className: "runningAlert bar" });
|
||||
this.runningAlert = this.createDom('a', { href: this.jasmine.HtmlReporter.sectionLink(null, catchExceptions), className: "runningAlert bar" });
|
||||
dom.alert.appendChild(this.runningAlert);
|
||||
}
|
||||
this.runningAlert.innerHTML = "Running " + this.completeSpecCount + " of " + specPluralizedFor(this.totalSpecCount);
|
||||
|
||||
// skipped specs UI
|
||||
if (isUndefined(this.skippedAlert)) {
|
||||
this.skippedAlert = this.createDom('a', { href: this.jasmine.HtmlReporter.sectionLink(null, this.jasmine.CATCH_EXCEPTIONS), className: "skippedAlert bar" });
|
||||
this.skippedAlert = this.createDom('a', { href: this.jasmine.HtmlReporter.sectionLink(null, catchExceptions), className: "skippedAlert bar" });
|
||||
}
|
||||
|
||||
this.skippedAlert.innerHTML = "Skipping " + this.skippedCount + " of " + specPluralizedFor(this.totalSpecCount) + " - run all";
|
||||
@@ -100,7 +100,7 @@ jasmine.HtmlReporter.ReporterView = function(dom, jasmine) {
|
||||
|
||||
// passing specs UI
|
||||
if (isUndefined(this.passedAlert)) {
|
||||
this.passedAlert = this.createDom('span', { href: this.jasmine.HtmlReporter.sectionLink(null, this.jasmine.CATCH_EXCEPTIONS), className: "passingAlert bar" });
|
||||
this.passedAlert = this.createDom('span', { href: this.jasmine.HtmlReporter.sectionLink(null, catchExceptions), className: "passingAlert bar" });
|
||||
}
|
||||
this.passedAlert.innerHTML = "Passing " + specPluralizedFor(this.passedCount);
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
jasmine.HtmlReporter.SpecView = function(spec, dom, views, jasmine) {
|
||||
jasmine.HtmlReporter.SpecView = function(spec, dom, views, jasmine, catchExceptions) {
|
||||
this.spec = spec;
|
||||
this.dom = dom;
|
||||
this.views = views;
|
||||
this.jasmine = jasmine || {};
|
||||
this.catchExceptions = catchExceptions;
|
||||
|
||||
this.symbol = this.createDom('li', { className: 'pending' });
|
||||
this.dom.symbolSummary.appendChild(this.symbol);
|
||||
@@ -10,7 +11,9 @@ jasmine.HtmlReporter.SpecView = function(spec, dom, views, jasmine) {
|
||||
this.summary = this.createDom('div', { className: 'specSummary' },
|
||||
this.createDom('a', {
|
||||
className: 'description',
|
||||
href: this.jasmine.HtmlReporter.sectionLink(this.spec.getFullName(), this.jasmine.CATCH_EXCEPTIONS),
|
||||
//TODO: sectionLink is a dependency passed in that knows about catchingExceptions
|
||||
//so we don't pass catchExceptions everywhere.
|
||||
href: this.jasmine.HtmlReporter.sectionLink(this.spec.getFullName(), catchExceptions),
|
||||
title: this.spec.getFullName()
|
||||
}, this.spec.description)
|
||||
);
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
jasmine.HtmlReporter.SuiteView = function(suite, dom, views, jasmine) {
|
||||
jasmine.HtmlReporter.SuiteView = function(suite, dom, views, jasmine, catchExceptions) {
|
||||
this.suite = suite;
|
||||
this.dom = dom;
|
||||
this.views = views;
|
||||
this.jasmine = jasmine || {};
|
||||
this.catchExceptions = catchExceptions;
|
||||
|
||||
this.element = this.createDom('div', { className: 'suite' },
|
||||
this.createDom('a', { className: 'description', href: this.jasmine.HtmlReporter.sectionLink(this.suite.getFullName(), this.jasmine.CATCH_EXCEPTIONS) }, this.suite.description)
|
||||
this.createDom('a', { className: 'description', href: this.jasmine.HtmlReporter.sectionLink(this.suite.getFullName(), catchExceptions) }, this.suite.description)
|
||||
);
|
||||
|
||||
this.appendToSummary(this.suite, this.element);
|
||||
|
||||
Reference in New Issue
Block a user