diff --git a/src/adapter.js b/src/adapter.js index ebfd82f..a2b0fd7 100644 --- a/src/adapter.js +++ b/src/adapter.js @@ -179,6 +179,7 @@ function KarmaReporter (tc, jasmineEnv) { this.jasmineStarted = function (data) { // TODO(vojta): Do not send spec names when polling. tc.info({ + event: 'jasmineStarted', total: data.totalSpecsDefined, specs: getAllSpecNames(jasmineEnv.topSuite()) }) @@ -198,6 +199,10 @@ function KarmaReporter (tc, jasmineEnv) { this.suiteStarted = function (result) { currentSuite = currentSuite.addChild(result.description) + tc.info({ + event: 'suiteStarted', + result: result + }) } this.suiteDone = function (result) { @@ -212,6 +217,11 @@ function KarmaReporter (tc, jasmineEnv) { handleGlobalErrors(result) currentSuite = currentSuite.parent + + tc.info({ + event: 'suiteDone', + result: result + }) } this.specStarted = function () { diff --git a/test/adapter.spec.js b/test/adapter.spec.js index 1bc48dd..1a4c245 100644 --- a/test/adapter.spec.js +++ b/test/adapter.spec.js @@ -85,6 +85,10 @@ describe('jasmine adapter', function () { }) it('should report success result', function () { + spyOn(karma, 'info').and.callFake(function (info) { + expect(info.event).toBe('suiteStarted') + expect(info.result).toBeDefined() + }) karma.result.and.callFake(function (result) { expect(result.id).toBe(spec.id) expect(result.description).toBe('contains spec with an expectation') @@ -100,6 +104,20 @@ describe('jasmine adapter', function () { expect(karma.result).toHaveBeenCalled() }) + it('should report suiteDone result', function () { + const infoSpy = spyOn(karma, 'info') + // The stateful adapter needs a started event. + reporter.suiteStarted(parentSuite.result) + + infoSpy.and.callFake(function (info) { + expect(info.event).toBe('suiteDone') + expect(info.result).toBeDefined() + expect(info.result.description).toBe('Parent Suite') + }) + + reporter.suiteDone(parentSuite.result) + }) + it('should report disabled status', function () { spec.result.status = 'disabled'