From d8c7939ef48b2cdb4b2fe28669a014a45aea365a Mon Sep 17 00:00:00 2001 From: KIM HYO RIN Date: Tue, 1 Sep 2020 23:58:18 +0900 Subject: [PATCH 1/8] issue 4226 : add print speed in json --- lib/reporters/json.js | 1 + 1 file changed, 1 insertion(+) 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) }; } From 223f928a6ddd6798865ab9061c6ddc2505121657 Mon Sep 17 00:00:00 2001 From: KIM HYO RIN Date: Sun, 6 Sep 2020 17:11:09 +0900 Subject: [PATCH 2/8] add print speed json-stream and json-stream.spec.js --- lib/reporters/json-stream.js | 3 ++- test/reporters/json-stream.spec.js | 10 +++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) 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/test/reporters/json-stream.spec.js b/test/reporters/json-stream.spec.js index 613b9279f8..2c5ca7b6fd 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' From 162b1353b6e42ac138298c9b7829e514a1e71857 Mon Sep 17 00:00:00 2001 From: KIM HYO RIN Date: Sun, 6 Sep 2020 17:12:09 +0900 Subject: [PATCH 3/8] add print speed json-stream and json-stream.spec.js --- test/reporters/json-stream.spec.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/reporters/json-stream.spec.js b/test/reporters/json-stream.spec.js index 2c5ca7b6fd..58694e3f19 100644 --- a/test/reporters/json-stream.spec.js +++ b/test/reporters/json-stream.spec.js @@ -29,7 +29,7 @@ describe('JSON Stream reporter', function() { expectedFullTitle, expectedFile, expectedDuration, - currentRetry, + currentRetry, expectedSpeed ); var expectedErrorMessage = 'error message'; @@ -81,7 +81,7 @@ describe('JSON Stream reporter', function() { ',"currentRetry":' + currentRetry + ',"speed":' + - dQuote(expectedSpeed) + + dQuote(expectedSpeed) + '}]\n' ); }); @@ -116,7 +116,7 @@ describe('JSON Stream reporter', function() { ',"currentRetry":' + currentRetry + ',"speed":' + - dQuote(expectedSpeed) + + dQuote(expectedSpeed) + ',"err":' + dQuote(expectedErrorMessage) + ',"stack":' + @@ -154,7 +154,7 @@ describe('JSON Stream reporter', function() { ',"currentRetry":' + currentRetry + ',"speed":' + - dQuote(expectedSpeed) + + dQuote(expectedSpeed) + ',"err":' + dQuote(expectedErrorMessage) + ',"stack":null}]\n' From 156eeff7287a5396953819d9194538ac744fb708 Mon Sep 17 00:00:00 2001 From: KIM HYO RIN Date: Sun, 6 Sep 2020 17:45:33 +0900 Subject: [PATCH 4/8] add pass test case in json.spec.js --- test/reporters/json.spec.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/test/reporters/json.spec.js b/test/reporters/json.spec.js index a92be62273..7681628165 100644 --- a/test/reporters/json.spec.js +++ b/test/reporters/json.spec.js @@ -11,6 +11,7 @@ describe('JSON reporter', function() { var runner; var testTitle = 'json test 1'; var testFile = 'someTest.spec.js'; + var testSpeed = 'fast'; var noop = function() {}; beforeEach(function() { @@ -84,6 +85,32 @@ describe('JSON reporter', function() { }); }); + it('should have 1 test pass', function(done) { + var test = new Test(testTitle, function(done) { + done(); + }); + + test.file = testFile; + suite.addTest(test); + + runner.run(function(failureCount) { + sinon.restore(); + expect(runner, 'to satisfy', { + testResults: { + passes: [ + { + title: testTitle, + file: testFile, + speed: testSpeed + } + ] + } + }); + expect(failureCount, 'to be', 0); + done(); + }); + }); + it('should handle circular objects in errors', function(done) { var testTitle = 'json test 1'; function CircleError() { From 6895928648c0c03352ee56a80fa6c908949ed705 Mon Sep 17 00:00:00 2001 From: Kim Hyo Rin Date: Thu, 10 Sep 2020 19:31:34 +0900 Subject: [PATCH 5/8] Update test/reporters/json.spec.js Co-authored-by: Christopher Hiller --- test/reporters/json.spec.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/test/reporters/json.spec.js b/test/reporters/json.spec.js index 7681628165..4e767ecb36 100644 --- a/test/reporters/json.spec.js +++ b/test/reporters/json.spec.js @@ -86,9 +86,7 @@ describe('JSON reporter', function() { }); it('should have 1 test pass', function(done) { - var test = new Test(testTitle, function(done) { - done(); - }); + const test = new Test(testTitle, () => {}); test.file = testFile; suite.addTest(test); From 986029a5dcb4ef109ea1611317503da082b2632f Mon Sep 17 00:00:00 2001 From: Kim Hyo Rin Date: Thu, 10 Sep 2020 19:36:44 +0900 Subject: [PATCH 6/8] Update test/reporters/json.spec.js Co-authored-by: Christopher Hiller --- test/reporters/json.spec.js | 1 - 1 file changed, 1 deletion(-) diff --git a/test/reporters/json.spec.js b/test/reporters/json.spec.js index 4e767ecb36..9f82a61b4a 100644 --- a/test/reporters/json.spec.js +++ b/test/reporters/json.spec.js @@ -92,7 +92,6 @@ describe('JSON reporter', function() { suite.addTest(test); runner.run(function(failureCount) { - sinon.restore(); expect(runner, 'to satisfy', { testResults: { passes: [ From 882ca30fc020a6a5a72dd51072f3a72ef78959a4 Mon Sep 17 00:00:00 2001 From: Kim Hyo Rin Date: Thu, 10 Sep 2020 22:28:46 +0900 Subject: [PATCH 7/8] Update test/reporters/json.spec.js Co-authored-by: Christopher Hiller --- test/reporters/json.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/reporters/json.spec.js b/test/reporters/json.spec.js index 9f82a61b4a..107d6231a2 100644 --- a/test/reporters/json.spec.js +++ b/test/reporters/json.spec.js @@ -98,7 +98,7 @@ describe('JSON reporter', function() { { title: testTitle, file: testFile, - speed: testSpeed + speed: /(slow|medium|fast)/ } ] } From 019cd982547fb2ce663f99a55fc35cfaf51708ba Mon Sep 17 00:00:00 2001 From: Kim Hyo Rin Date: Thu, 10 Sep 2020 22:29:36 +0900 Subject: [PATCH 8/8] remove the testSpeed --- test/reporters/json.spec.js | 1 - 1 file changed, 1 deletion(-) diff --git a/test/reporters/json.spec.js b/test/reporters/json.spec.js index 107d6231a2..3eca1e9175 100644 --- a/test/reporters/json.spec.js +++ b/test/reporters/json.spec.js @@ -11,7 +11,6 @@ describe('JSON reporter', function() { var runner; var testTitle = 'json test 1'; var testFile = 'someTest.spec.js'; - var testSpeed = 'fast'; var noop = function() {}; beforeEach(function() {