Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion lib/reporters/mini.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ function MiniReporter() {

this.passCount = 0;
this.failCount = 0;
this.skipCount = 0;
this.rejectionCount = 0;
this.exceptionCount = 0;
this.finished = false;
Expand All @@ -27,7 +28,8 @@ MiniReporter.prototype.test = function (test) {
var title;

if (test.skip) {
title = chalk.cyan('- ' + test.title);
title = chalk.yellow('- ' + test.title);
this.skipCount++;
} else if (test.error) {
title = chalk.red(test.title);
this.failCount++;
Expand Down Expand Up @@ -67,6 +69,10 @@ MiniReporter.prototype.finish = function () {
status += ' ' + chalk.green(this.passCount, 'passed');
}

if (this.skipCount > 0) {
status += ' ' + chalk.yellow(this.skipCount, 'skipped');
}

if (this.failCount > 0) {
status += ' ' + chalk.red(this.failCount, 'failed');
}
Expand Down
1 change: 1 addition & 0 deletions lib/reporters/tap.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ TapReporter.prototype.finish = function () {
'1..' + (this.api.passCount + this.api.failCount),
'# tests ' + (this.api.passCount + this.api.failCount),
'# pass ' + this.api.passCount,
'# skip ' + this.api.skipCount,
'# fail ' + (this.api.failCount + this.api.rejectionCount + this.api.exceptionCount),
''
];
Expand Down
4 changes: 4 additions & 0 deletions lib/reporters/verbose.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ VerboseReporter.prototype.finish = function () {
output += ' ' + chalk.green(this.api.passCount, plur('test', this.api.passCount), 'passed') + '\n';
}

if (this.api.skipCount > 0) {
output += ' ' + chalk.yellow(this.api.skipCount, plur('test', this.api.skipCount), 'skipped') + '\n';
}

if (this.api.rejectionCount > 0) {
output += ' ' + chalk.red(this.api.rejectionCount, 'unhandled', plur('rejection', this.api.rejectionCount)) + '\n';
}
Expand Down
32 changes: 31 additions & 1 deletion test/reporters/mini.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ test('skipped test', function (t) {

var expectedOutput = [
'',
' ' + chalk.cyan('- skipped'),
' ' + chalk.yellow('- skipped'),
'',
''
].join('\n');
Expand All @@ -84,6 +84,36 @@ test('results with passing tests', function (t) {
t.end();
});

test('results with skipped tests', function (t) {
var reporter = miniReporter();
reporter.passCount = 0;
reporter.skipCount = 1;
reporter.failCount = 0;

var actualOutput = reporter.finish();
var expectedOutput = [
'',
' ' + chalk.yellow('1 skipped'),
''
].join('\n');

t.is(actualOutput, expectedOutput);
t.end();
});

test('results with passing skipped tests', function (t) {
var reporter = miniReporter();
reporter.passCount = 1;
reporter.skipCount = 1;

var output = reporter.finish().split('\n');

t.is(output[0], '');
t.is(output[1], ' ' + chalk.green('1 passed') + ' ' + chalk.yellow('1 skipped'));
t.is(output[2], '');
t.end();
});

test('results with passing tests and rejections', function (t) {
var reporter = miniReporter();
reporter.passCount = 1;
Expand Down
2 changes: 2 additions & 0 deletions test/reporters/tap.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ test('results', function (t) {
var api = {
passCount: 1,
failCount: 2,
skipCount: 1,
rejectionCount: 3,
exceptionCount: 4
};
Expand All @@ -93,6 +94,7 @@ test('results', function (t) {
'1..' + (api.passCount + api.failCount),
'# tests ' + (api.passCount + api.failCount),
'# pass ' + api.passCount,
'# skip ' + api.skipCount,
'# fail ' + (api.failCount + api.rejectionCount + api.exceptionCount),
''
].join('\n');
Expand Down
17 changes: 17 additions & 0 deletions test/reporters/verbose.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,23 @@ test('results with passing tests', function (t) {
t.end();
});

test('results with skipped tests', function (t) {
var reporter = createReporter();
reporter.api.passCount = 1;
reporter.api.skipCount = 1;

var actualOutput = reporter.finish();
var expectedOutput = [
'',
' ' + chalk.green('1 test passed'),
' ' + chalk.yellow('1 test skipped'),
''
].join('\n');

t.is(actualOutput, expectedOutput);
t.end();
});

test('results with passing tests and rejections', function (t) {
var reporter = createReporter();
reporter.api.passCount = 1;
Expand Down