JsApiReporter suiteResults only includes suite results

- It was including suite starts also

[#79533268]
This commit is contained in:
Gerg
2014-10-08 22:33:36 -07:00
parent 9ad15eeaba
commit 8880729250
3 changed files with 17 additions and 7 deletions

View File

@@ -564,6 +564,7 @@ getJasmineRequireObj().Env = function(j$) {
options.catchException = catchException;
options.clearStack = options.clearStack || clearStack;
options.timer = {setTimeout: realSetTimeout, clearTimeout: realClearTimeout};
options.fail = self.fail;
new j$.QueueRunner(options).execute();
};
@@ -744,7 +745,6 @@ getJasmineRequireObj().Env = function(j$) {
userContext: function() { return suite.clonedSharedUserContext(); },
queueableFn: {
fn: fn,
type: 'it',
timeout: function() { return timeout || j$.DEFAULT_TIMEOUT_INTERVAL; }
}
});
@@ -801,7 +801,6 @@ getJasmineRequireObj().Env = function(j$) {
this.beforeEach = function(beforeEachFunction, timeout) {
currentDeclarationSuite.beforeEach({
fn: beforeEachFunction,
type: 'beforeEach',
timeout: function() { return timeout || j$.DEFAULT_TIMEOUT_INTERVAL; }
});
};
@@ -809,7 +808,6 @@ getJasmineRequireObj().Env = function(j$) {
this.beforeAll = function(beforeAllFunction, timeout) {
currentDeclarationSuite.beforeAll({
fn: beforeAllFunction,
type: 'beforeAll',
timeout: function() { return timeout || j$.DEFAULT_TIMEOUT_INTERVAL; }
});
};
@@ -817,7 +815,6 @@ getJasmineRequireObj().Env = function(j$) {
this.afterEach = function(afterEachFunction, timeout) {
currentDeclarationSuite.afterEach({
fn: afterEachFunction,
type: 'afterEach',
timeout: function() { return timeout || j$.DEFAULT_TIMEOUT_INTERVAL; }
});
};
@@ -825,7 +822,6 @@ getJasmineRequireObj().Env = function(j$) {
this.afterAll = function(afterAllFunction, timeout) {
currentDeclarationSuite.afterAll({
fn: afterAllFunction,
type: 'afterAll',
timeout: function() { return timeout || j$.DEFAULT_TIMEOUT_INTERVAL; }
});
};
@@ -890,7 +886,7 @@ getJasmineRequireObj().JsApiReporter = function() {
suites_hash = {};
this.suiteStarted = function(result) {
storeSuite(result);
suites_hash[result.id] = result;
};
this.suiteDone = function(result) {
@@ -1728,6 +1724,7 @@ getJasmineRequireObj().QueueRunner = function(j$) {
this.catchException = attrs.catchException || function() { return true; };
this.userContext = attrs.userContext || {};
this.timer = attrs.timeout || {setTimeout: setTimeout, clearTimeout: clearTimeout};
this.fail = attrs.fail || function() {};
}
QueueRunner.prototype.execute = function() {
@@ -1773,6 +1770,11 @@ getJasmineRequireObj().QueueRunner = function(j$) {
}),
timeoutId;
next.fail = function() {
self.fail.apply(null, arguments);
next();
};
if (queueableFn.timeout) {
timeoutId = Function.prototype.apply.apply(self.timer.setTimeout, [j$.getGlobal(), [function() {
var error = new Error('Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.');

View File

@@ -182,6 +182,9 @@ describe("JsApiReporter", function() {
var reporter, suiteResult1, suiteResult2;
beforeEach(function() {
reporter = new j$.JsApiReporter({});
suiteStarted1 = {
id: 1
};
suiteResult1 = {
id: 1,
status: 'failed',
@@ -192,10 +195,15 @@ describe("JsApiReporter", function() {
status: 'finished'
};
reporter.suiteStarted(suiteStarted1);
reporter.suiteDone(suiteResult1);
reporter.suiteDone(suiteResult2);
});
it('should not include suite starts', function(){
expect(reporter.suiteResults(0,3).length).toEqual(2);
});
it("should return a slice of results", function() {
expect(reporter.suiteResults(0, 1)).toEqual([suiteResult1]);
expect(reporter.suiteResults(1, 1)).toEqual([suiteResult2]);

View File

@@ -34,7 +34,7 @@ getJasmineRequireObj().JsApiReporter = function() {
suites_hash = {};
this.suiteStarted = function(result) {
storeSuite(result);
suites_hash[result.id] = result;
};
this.suiteDone = function(result) {