Browse Source

Removed unused code in mini reporter (#1169)

replace-snapshot
Jarle Hansen 8 years ago
committed by Vadim Demedes
parent
commit
c84694bb89
  1. 6
      lib/reporters/mini.js
  2. 31
      test/reporters/mini.js

6
lib/reporters/mini.js

@ -180,11 +180,7 @@ MiniReporter.prototype.finish = function (runStatus) {
var errorTitle = ' ' + test.error.message + '\n';
var isPowerAssert = test.error.message.split('\n').length > 1;
if (test.error) {
description = stripFirstLine(test.error.stack).trimRight();
} else {
description = JSON.stringify(test);
}
description = stripFirstLine(test.error.stack).trimRight();
if (isPowerAssert) {
description = stripFirstLine(description).replace(/ {3}/g, ' ');

31
test/reporters/mini.js

@ -383,6 +383,37 @@ test('results with errors', function (t) {
t.end();
});
test('results with unhandled errors', function (t) {
var reporter = miniReporter();
reporter.failCount = 2;
var err = new Error('failure one');
err.stack = beautifyStack(err.stack);
var runStatus = {
errors: [
{title: 'failed one', error: err},
{title: 'failed two'}
]
};
var output = reporter.finish(runStatus);
var expectedStack = colors.error(' failure two\n') + colors.errorStack('stack line with trailing whitespace');
compareLineOutput(t, output, [
'',
' ' + chalk.red('2 failed'),
'',
' ' + chalk.white('failed one'),
/failure/,
/test\/reporters\/mini\.js/,
compareLineOutput.SKIP_UNTIL_EMPTY_LINE,
'',
''
].concat(expectedStack.split('\n')));
t.end();
});
test('results with 1 previous failure', function (t) {
var reporter = miniReporter();
reporter.todoCount = 1;

Loading…
Cancel
Save