diff --git a/src/adapter.js b/src/adapter.js index 7bd18ee..6cb3366 100644 --- a/src/adapter.js +++ b/src/adapter.js @@ -230,7 +230,8 @@ function KarmaReporter(tc, jasmineEnv) { skipped : skipped, success : specResult.failedExpectations.length === 0, suite : [], - time : skipped ? 0 : new Date().getTime() - specResult.startTime + time : skipped ? 0 : new Date().getTime() - specResult.startTime, + executedExpectationsCount : specResult.failedExpectations.length + specResult.passedExpectations.length }; // generate ordered list of (nested) suite names diff --git a/test/adapter.spec.js b/test/adapter.spec.js index 51f9b26..2790a25 100644 --- a/test/adapter.spec.js +++ b/test/adapter.spec.js @@ -96,13 +96,39 @@ describe('jasmine adapter', function(){ }); + it('should report executedExpectCount 0 if no expectations', function(){ + karma.result.and.callFake(function(result){ + expect(result.executedExpectationsCount).toBe(0); + }); + + reporter.specDone(spec.result); + + expect(karma.result).toHaveBeenCalled(); + }); + + it('should report fail result', function(){ karma.result.and.callFake(function(result){ expect(result.success).toBe(false); expect(result.log.length).toBe(1); + expect(result.executedExpectationsCount).toBe(1); + }); + + spec.result.failedExpectations.push( {} ); + reporter.specDone(spec.result); + + expect(karma.result).toHaveBeenCalled(); + }); + + + it('should report executedExpectCount as sum of passed and failed expectations', function(){ + karma.result.and.callFake(function(result){ + expect(result.executedExpectationsCount).toBe(2); }); + spec.result.passedExpectations.push( {} ); spec.result.failedExpectations.push( {} ); + reporter.specDone(spec.result); expect(karma.result).toHaveBeenCalled();