Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add speed in -R json option (#4226) #4434

Merged
merged 8 commits into from Sep 13, 2020
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/reporters/json-stream.js
Expand Up @@ -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
};
}

Expand Down
1 change: 1 addition & 0 deletions lib/reporters/json.js
Expand Up @@ -90,6 +90,7 @@ function clean(test) {
file: test.file,
duration: test.duration,
currentRetry: test.currentRetry(),
speed: test.speed,
err: cleanCycles(err)
};
}
Expand Down
10 changes: 9 additions & 1 deletion test/reporters/json-stream.spec.js
Expand Up @@ -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';
Expand Down Expand Up @@ -78,6 +80,8 @@ describe('JSON Stream reporter', function() {
expectedDuration +
',"currentRetry":' +
currentRetry +
',"speed":' +
dQuote(expectedSpeed) +
'}]\n'
);
});
Expand Down Expand Up @@ -111,6 +115,8 @@ describe('JSON Stream reporter', function() {
expectedDuration +
',"currentRetry":' +
currentRetry +
',"speed":' +
dQuote(expectedSpeed) +
',"err":' +
dQuote(expectedErrorMessage) +
',"stack":' +
Expand Down Expand Up @@ -147,6 +153,8 @@ describe('JSON Stream reporter', function() {
expectedDuration +
',"currentRetry":' +
currentRetry +
',"speed":' +
dQuote(expectedSpeed) +
',"err":' +
dQuote(expectedErrorMessage) +
',"stack":null}]\n'
Expand Down
27 changes: 27 additions & 0 deletions test/reporters/json.spec.js
Expand Up @@ -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() {
Expand Down Expand Up @@ -84,6 +85,32 @@ describe('JSON reporter', function() {
});
});

it('should have 1 test pass', function(done) {
var test = new Test(testTitle, function(done) {
done();
});
wwhurin marked this conversation as resolved.
Show resolved Hide resolved

test.file = testFile;
suite.addTest(test);

runner.run(function(failureCount) {
sinon.restore();
wwhurin marked this conversation as resolved.
Show resolved Hide resolved
expect(runner, 'to satisfy', {
testResults: {
passes: [
{
title: testTitle,
file: testFile,
speed: testSpeed
wwhurin marked this conversation as resolved.
Show resolved Hide resolved
}
]
}
});
expect(failureCount, 'to be', 0);
done();
});
});

it('should handle circular objects in errors', function(done) {
var testTitle = 'json test 1';
function CircleError() {
Expand Down