diff --git a/src/core/reporters/TapReporter.js b/src/core/reporters/TapReporter.js index 8ae7caf18..e4f3aa183 100644 --- a/src/core/reporters/TapReporter.js +++ b/src/core/reporters/TapReporter.js @@ -210,7 +210,7 @@ export default class TapReporter { if (!this.ended) { this.onRunStart(); this.testCount = this.testCount + 1; - this.log(kleur.red(`not ok ${this.testCount} global failure`)); + this.log(`not ok ${this.testCount} ${kleur.red('global failure')}`); this.logError(error); } @@ -227,16 +227,16 @@ export default class TapReporter { this.log(`ok ${this.testCount} ${test.fullName.join(' > ')}`); } else if (test.status === 'skipped') { this.log( - kleur.yellow(`ok ${this.testCount} # SKIP ${test.fullName.join(' > ')}`) + `ok ${this.testCount} ${kleur.yellow(`# SKIP ${test.fullName.join(' > ')}`)}` ); } else if (test.status === 'todo') { this.log( - kleur.cyan(`not ok ${this.testCount} # TODO ${test.fullName.join(' > ')}`) + `not ok ${this.testCount} ${kleur.cyan(`# TODO ${test.fullName.join(' > ')}`)}` ); test.errors.forEach((error) => this.logAssertion(error, 'todo')); } else { this.log( - kleur.red(`not ok ${this.testCount} ${test.fullName.join(' > ')}`) + `not ok ${this.testCount} ${kleur.red(test.fullName.join(' > '))}` ); test.errors.forEach((error) => this.logAssertion(error)); } @@ -247,9 +247,9 @@ export default class TapReporter { this.log(`1..${runEnd.testCounts.total}`); this.log(`# pass ${runEnd.testCounts.passed}`); - this.log(kleur.yellow(`# skip ${runEnd.testCounts.skipped}`)); - this.log(kleur.cyan(`# todo ${runEnd.testCounts.todo}`)); - this.log(kleur.red(`# fail ${runEnd.testCounts.failed}`)); + this.log(`# ${kleur.yellow(`skip ${runEnd.testCounts.skipped}`)}`); + this.log(`# ${kleur.cyan(`todo ${runEnd.testCounts.todo}`)}`); + this.log(`# ${kleur.red(`fail ${runEnd.testCounts.failed}`)}`); } logAssertion (error, severity) { diff --git a/test/main/TapReporter.js b/test/main/TapReporter.js index 44ba65462..a598a7f4e 100644 --- a/test/main/TapReporter.js +++ b/test/main/TapReporter.js @@ -85,7 +85,7 @@ QUnit.module('TapReporter', function (hooks) { }); QUnit.test('output ok for a skipped test', function (assert) { - var expected = kleur.yellow('ok 1 # SKIP name'); + var expected = 'ok 1 ' + kleur.yellow('# SKIP name'); emitter.emit('testEnd', { name: 'name', @@ -100,7 +100,7 @@ QUnit.module('TapReporter', function (hooks) { }); QUnit.test('output not ok for a todo test', function (assert) { - var expected = kleur.cyan('not ok 1 # TODO name'); + var expected = 'not ok 1 ' + kleur.cyan('# TODO name'); emitter.emit('testEnd', { name: 'name', @@ -115,7 +115,7 @@ QUnit.module('TapReporter', function (hooks) { }); QUnit.test('output not ok for a failing test', function (assert) { - var expected = kleur.red('not ok 1 name'); + var expected = 'not ok 1 ' + kleur.red('name'); emitter.emit('testEnd', { name: 'name', @@ -143,7 +143,7 @@ QUnit.module('TapReporter', function (hooks) { assertions: [] }); - assert.strictEqual(buffer, kleur.red('not ok 1 name') + '\n' + assert.strictEqual(buffer, 'not ok 1 ' + kleur.red('name') + '\n' + ' ---\n' + ' message: first error\n' + ' severity: failed\n' @@ -168,7 +168,7 @@ QUnit.module('TapReporter', function (hooks) { emitter.clear(); emitter.emit('error', 'Boo'); - assert.strictEqual(buffer, kleur.red('not ok 1 global failure') + '\n' + assert.strictEqual(buffer, 'not ok 1 ' + kleur.red('global failure') + '\n' + ' ---\n' + ' message: Boo\n' + ' severity: failed\n' @@ -184,7 +184,7 @@ QUnit.module('TapReporter', function (hooks) { emitter.clear(); emitter.emit('error', err); - assert.strictEqual(buffer, kleur.red('not ok 1 global failure') + '\n' + assert.strictEqual(buffer, 'not ok 1 ' + kleur.red('global failure') + '\n' + ' ---\n' + ' message: ReferenceError: Boo is not defined\n' + ' severity: failed\n' @@ -437,7 +437,7 @@ QUnit.module('TapReporter', function (hooks) { }); assert.strictEqual(buffer, '1..6\n' -+ '# pass 3\n' + kleur.yellow('# skip 1') + '\n' + kleur.cyan('# todo 0') + '\n' + kleur.red('# fail 2') + '\n' ++ '# pass 3\n# ' + kleur.yellow('skip 1') + '\n# ' + kleur.cyan('todo 0') + '\n# ' + kleur.red('fail 2') + '\n' ); }); });