Skip to content

Commit

Permalink
Remove anonymous test handling in verbose reporter
Browse files Browse the repository at this point in the history
There are no more anonymous tests.
  • Loading branch information
novemberborn committed Feb 11, 2018
1 parent b1ffb5d commit b501fa2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 21 deletions.
2 changes: 1 addition & 1 deletion lib/logger.js
Expand Up @@ -24,7 +24,7 @@ class Logger {
}

test(test, runStatus) {
this.write(this.reporter.test(test, runStatus), runStatus);
this.write(this.reporter.test(test), runStatus);
}

unhandledError(err, runStatus) {
Expand Down
4 changes: 1 addition & 3 deletions lib/reporters/verbose.js
Expand Up @@ -24,7 +24,7 @@ class VerboseReporter {
return '';
}

test(test, runStatus) {
test(test) {
const lines = [];
if (test.error) {
lines.push(' ' + colors.error(figures.cross) + ' ' + test.title + ' ' + colors.error(test.error.message));
Expand All @@ -34,8 +34,6 @@ class VerboseReporter {
lines.push(' ' + colors.skip('- ' + test.title));
} else if (test.failing) {
lines.push(' ' + colors.error(figures.tick) + ' ' + colors.error(test.title));
} else if (runStatus.fileCount === 1 && runStatus.testCount === 1 && test.title === '[anonymous]') {
// No output
} else {
// Display duration only over a threshold
const threshold = 100;
Expand Down
23 changes: 6 additions & 17 deletions test/reporters/verbose.js
Expand Up @@ -70,7 +70,7 @@ test('passing test and duration less than threshold', t => {
const actualOutput = reporter.test({
title: 'passed',
duration: 90
}, createRunStatus());
});

const expectedOutput = ' ' + colors.green(figures.tick) + ' passed';

Expand All @@ -84,32 +84,21 @@ test('passing test and duration greater than threshold', t => {
const actualOutput = reporter.test({
title: 'passed',
duration: 150
}, createRunStatus());
});

const expectedOutput = ' ' + colors.green(figures.tick) + ' passed' + colors.dimGray(' (150ms)');

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

test('don\'t display test title if there is only one anonymous test', t => {
const reporter = createReporter();

const output = reporter.test({
title: '[anonymous]'
}, createRunStatus());

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

test('known failure test', t => {
const reporter = createReporter();

const actualOutput = reporter.test({
title: 'known failure',
failing: true
}, createRunStatus());
});

const expectedOutput = ' ' + colors.red(figures.tick) + ' ' + colors.red('known failure');

Expand All @@ -125,7 +114,7 @@ test('failing test', t => {
error: {
message: 'assertion failed'
}
}, createRunStatus());
});

const expectedOutput = ' ' + colors.red(figures.cross) + ' failed ' + colors.red('assertion failed');

Expand All @@ -139,7 +128,7 @@ test('skipped test', t => {
const actualOutput = reporter.test({
title: 'skipped',
skip: true
}, createRunStatus());
});

const expectedOutput = ' ' + colors.yellow('- skipped');

Expand All @@ -154,7 +143,7 @@ test('todo test', t => {
title: 'todo',
skip: true,
todo: true
}, createRunStatus());
});

const expectedOutput = ' ' + colors.blue('- todo');

Expand Down

0 comments on commit b501fa2

Please sign in to comment.