diff --git a/lib/reporters/json-stream.js b/lib/reporters/json-stream.js index 8caa8adfce..87cf607282 100644 --- a/lib/reporters/json-stream.js +++ b/lib/reporters/json-stream.js @@ -84,7 +84,8 @@ function clean(test) { fullTitle: test.fullTitle(), file: test.file, duration: test.duration, - currentRetry: test.currentRetry() + currentRetry: test.currentRetry(), + speed: test.speed }; } diff --git a/lib/reporters/json.js b/lib/reporters/json.js index a46776ba9c..a314cd3805 100644 --- a/lib/reporters/json.js +++ b/lib/reporters/json.js @@ -90,6 +90,7 @@ function clean(test) { file: test.file, duration: test.duration, currentRetry: test.currentRetry(), + speed: test.speed, err: cleanCycles(err) }; } diff --git a/test/reporters/json-stream.spec.js b/test/reporters/json-stream.spec.js index 613b9279f8..58694e3f19 100644 --- a/test/reporters/json-stream.spec.js +++ b/test/reporters/json-stream.spec.js @@ -23,12 +23,14 @@ describe('JSON Stream reporter', function() { var expectedFile = 'someTest.spec.js'; var expectedDuration = 1000; var currentRetry = 1; + var expectedSpeed = 'fast'; var expectedTest = makeExpectedTest( expectedTitle, expectedFullTitle, expectedFile, expectedDuration, - currentRetry + currentRetry, + expectedSpeed ); var expectedErrorMessage = 'error message'; var expectedErrorStack = 'error stack'; @@ -78,6 +80,8 @@ describe('JSON Stream reporter', function() { expectedDuration + ',"currentRetry":' + currentRetry + + ',"speed":' + + dQuote(expectedSpeed) + '}]\n' ); }); @@ -111,6 +115,8 @@ describe('JSON Stream reporter', function() { expectedDuration + ',"currentRetry":' + currentRetry + + ',"speed":' + + dQuote(expectedSpeed) + ',"err":' + dQuote(expectedErrorMessage) + ',"stack":' + @@ -147,6 +153,8 @@ describe('JSON Stream reporter', function() { expectedDuration + ',"currentRetry":' + currentRetry + + ',"speed":' + + dQuote(expectedSpeed) + ',"err":' + dQuote(expectedErrorMessage) + ',"stack":null}]\n' diff --git a/test/reporters/json.spec.js b/test/reporters/json.spec.js index a92be62273..3eca1e9175 100644 --- a/test/reporters/json.spec.js +++ b/test/reporters/json.spec.js @@ -84,6 +84,29 @@ describe('JSON reporter', function() { }); }); + it('should have 1 test pass', function(done) { + const test = new Test(testTitle, () => {}); + + test.file = testFile; + suite.addTest(test); + + runner.run(function(failureCount) { + expect(runner, 'to satisfy', { + testResults: { + passes: [ + { + title: testTitle, + file: testFile, + speed: /(slow|medium|fast)/ + } + ] + } + }); + expect(failureCount, 'to be', 0); + done(); + }); + }); + it('should handle circular objects in errors', function(done) { var testTitle = 'json test 1'; function CircleError() {