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

Show how many tests were skipped by --fail-fast #1221

Merged
merged 1 commit into from
Feb 6, 2017
Merged
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
3 changes: 2 additions & 1 deletion lib/reporters/mini.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,8 @@ class MiniReporter {
}

if (runStatus.failFastEnabled === true && runStatus.remainingCount > 0 && runStatus.failCount > 0) {
status += '\n\n ' + colors.information('`--fail-fast` is on. Any number of tests may have been skipped');
const remaining = 'At least ' + runStatus.remainingCount + ' ' + plur('test was', 'tests were', runStatus.remainingCount) + ' skipped.';
status += '\n\n ' + colors.information('`--fail-fast` is on. ' + remaining);
}

if (runStatus.hasExclusive === true && runStatus.remainingCount > 0) {
Expand Down
3 changes: 2 additions & 1 deletion lib/reporters/verbose.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ class VerboseReporter {
}

if (runStatus.failFastEnabled === true && runStatus.remainingCount > 0 && runStatus.failCount > 0) {
output += '\n\n\n ' + colors.information('`--fail-fast` is on. Any number of tests may have been skipped');
const remaining = 'At least ' + runStatus.remainingCount + ' ' + plur('test was', 'tests were', runStatus.remainingCount) + ' skipped.';
output += '\n\n\n ' + colors.information('`--fail-fast` is on. ' + remaining);
}

if (runStatus.hasExclusive === true && runStatus.remainingCount > 0) {
Expand Down
19 changes: 18 additions & 1 deletion test/reporters/mini.js
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,24 @@ test('results when fail-fast is enabled', t => {
compareLineOutput(t, output, [
'',
'',
' ' + colors.information('`--fail-fast` is on. Any number of tests may have been skipped')
' ' + colors.information('`--fail-fast` is on. At least 1 test was skipped.')
]);
t.end();
});

test('results when fail-fast is enabled with multiple skipped tests', t => {
const reporter = miniReporter();
const runStatus = {
remainingCount: 2,
failCount: 1,
failFastEnabled: true
};

const output = reporter.finish(runStatus);
compareLineOutput(t, output, [
'',
'',
' ' + colors.information('`--fail-fast` is on. At least 2 tests were skipped.')
]);
t.end();
});
Expand Down
26 changes: 25 additions & 1 deletion test/reporters/verbose.js
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,31 @@ test('results when fail-fast is enabled', t => {
' ' + chalk.red('1 test failed') + time,
'',
'',
' ' + colors.information('`--fail-fast` is on. Any number of tests may have been skipped'),
' ' + colors.information('`--fail-fast` is on. At least 1 test was skipped.'),
''
].join('\n');

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

test('results when fail-fast is enabled with multiple skipped tests', t => {
const reporter = new VerboseReporter();
const runStatus = createRunStatus();
runStatus.remainingCount = 2;
runStatus.failCount = 1;
runStatus.failFastEnabled = true;
runStatus.tests = [{
title: 'failed test'
}];

const output = reporter.finish(runStatus);
const expectedOutput = [
'',
' ' + chalk.red('1 test failed') + time,
'',
'',
' ' + colors.information('`--fail-fast` is on. At least 2 tests were skipped.'),
''
].join('\n');

Expand Down