Build distribution for suite failed status changes

This commit is contained in:
slackersoft
2014-09-26 18:35:06 -07:00
parent eefa716530
commit a58fd20d82
2 changed files with 50 additions and 19 deletions

View File

@@ -84,7 +84,7 @@ jasmineRequire.HtmlReporter = function(j$) {
}; };
this.suiteDone = function(result) { this.suiteDone = function(result) {
if (result.failedExpectations && result.failedExpectations.length > 0) { if (result.status == 'failed') {
failedSuites.push(result); failedSuites.push(result);
} }

View File

@@ -727,7 +727,7 @@ getJasmineRequireObj().Env = function(j$) {
return runnablesExplictlySet; return runnablesExplictlySet;
}; };
var specFactory = function(description, fn, suite) { var specFactory = function(description, fn, suite, timeout) {
totalSpecsDefined++; totalSpecsDefined++;
var spec = new j$.Spec({ var spec = new j$.Spec({
id: getNextSpecId(), id: getNextSpecId(),
@@ -742,7 +742,11 @@ getJasmineRequireObj().Env = function(j$) {
expectationResultFactory: expectationResultFactory, expectationResultFactory: expectationResultFactory,
queueRunnerFactory: queueRunnerFactory, queueRunnerFactory: queueRunnerFactory,
userContext: function() { return suite.clonedSharedUserContext(); }, userContext: function() { return suite.clonedSharedUserContext(); },
queueableFn: { fn: fn, type: 'it', timeout: function() { return j$.DEFAULT_TIMEOUT_INTERVAL; } } queueableFn: {
fn: fn,
type: 'it',
timeout: function() { return timeout || j$.DEFAULT_TIMEOUT_INTERVAL; }
}
}); });
runnableLookupTable[spec.id] = spec; runnableLookupTable[spec.id] = spec;
@@ -766,20 +770,20 @@ getJasmineRequireObj().Env = function(j$) {
} }
}; };
this.it = function(description, fn) { this.it = function(description, fn, timeout) {
var spec = specFactory(description, fn, currentDeclarationSuite); var spec = specFactory(description, fn, currentDeclarationSuite, timeout);
currentDeclarationSuite.addChild(spec); currentDeclarationSuite.addChild(spec);
return spec; return spec;
}; };
this.xit = function(description, fn) { this.xit = function() {
var spec = this.it(description, fn); var spec = this.it.apply(this, arguments);
spec.pend(); spec.pend();
return spec; return spec;
}; };
this.fit = function(description, fn ){ this.fit = function(){
var spec = this.it(description, fn); var spec = this.it.apply(this, arguments);
focusedRunnables.push(spec.id); focusedRunnables.push(spec.id);
unfocusAncestor(); unfocusAncestor();
@@ -794,20 +798,36 @@ getJasmineRequireObj().Env = function(j$) {
return currentRunnable().expect(actual); return currentRunnable().expect(actual);
}; };
this.beforeEach = function(beforeEachFunction) { this.beforeEach = function(beforeEachFunction, timeout) {
currentDeclarationSuite.beforeEach({ fn: beforeEachFunction, type: 'beforeEach', timeout: function() { return j$.DEFAULT_TIMEOUT_INTERVAL; } }); currentDeclarationSuite.beforeEach({
fn: beforeEachFunction,
type: 'beforeEach',
timeout: function() { return timeout || j$.DEFAULT_TIMEOUT_INTERVAL; }
});
}; };
this.beforeAll = function(beforeAllFunction) { this.beforeAll = function(beforeAllFunction, timeout) {
currentDeclarationSuite.beforeAll({ fn: beforeAllFunction, type: 'beforeAll', timeout: function() { return j$.DEFAULT_TIMEOUT_INTERVAL; } }); currentDeclarationSuite.beforeAll({
fn: beforeAllFunction,
type: 'beforeAll',
timeout: function() { return timeout || j$.DEFAULT_TIMEOUT_INTERVAL; }
});
}; };
this.afterEach = function(afterEachFunction) { this.afterEach = function(afterEachFunction, timeout) {
currentDeclarationSuite.afterEach({ fn: afterEachFunction, type: 'afterEach', timeout: function() { return j$.DEFAULT_TIMEOUT_INTERVAL; } }); currentDeclarationSuite.afterEach({
fn: afterEachFunction,
type: 'afterEach',
timeout: function() { return timeout || j$.DEFAULT_TIMEOUT_INTERVAL; }
});
}; };
this.afterAll = function(afterAllFunction) { this.afterAll = function(afterAllFunction, timeout) {
currentDeclarationSuite.afterAll({ fn: afterAllFunction, type: 'afterAll', timeout: function() { return j$.DEFAULT_TIMEOUT_INTERVAL; } }); currentDeclarationSuite.afterAll({
fn: afterAllFunction,
type: 'afterAll',
timeout: function() { return timeout || j$.DEFAULT_TIMEOUT_INTERVAL; }
});
}; };
this.pending = function() { this.pending = function() {
@@ -1968,7 +1988,6 @@ getJasmineRequireObj().Suite = function() {
Suite.prototype.disable = function() { Suite.prototype.disable = function() {
this.disabled = true; this.disabled = true;
this.result.status = 'disabled';
}; };
Suite.prototype.beforeEach = function(fn) { Suite.prototype.beforeEach = function(fn) {
@@ -1991,6 +2010,18 @@ getJasmineRequireObj().Suite = function() {
this.children.push(child); this.children.push(child);
}; };
Suite.prototype.status = function() {
if (this.disabled) {
return 'disabled';
}
if (this.result.failedExpectations.length > 0) {
return 'failed';
} else {
return 'finished';
}
};
Suite.prototype.execute = function(onComplete) { Suite.prototype.execute = function(onComplete) {
var self = this; var self = this;
@@ -2021,7 +2052,7 @@ getJasmineRequireObj().Suite = function() {
}); });
function complete() { function complete() {
self.result.status = self.disabled ? 'disabled' : 'finished'; self.result.status = self.status();
self.resultCallback(self.result); self.resultCallback(self.result);
if (onComplete) { if (onComplete) {