diff --git a/src/reporters/TapReporter.js b/src/reporters/TapReporter.js index 54e085a01..02cc67304 100644 --- a/src/reporters/TapReporter.js +++ b/src/reporters/TapReporter.js @@ -205,7 +205,7 @@ export default class TapReporter { // Skip this if we're past "runEnd" as it would look odd if (!this.ended) { 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); } @@ -222,29 +222,29 @@ 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)); } } - onRunEnd (runSuite) { + onRunEnd (runEnd) { this.ended = true; - this.log(`1..${runSuite.testCounts.total}`); - this.log(`# pass ${runSuite.testCounts.passed}`); - this.log(kleur.yellow(`# skip ${runSuite.testCounts.skipped}`)); - this.log(kleur.cyan(`# todo ${runSuite.testCounts.todo}`)); - this.log(kleur.red(`# fail ${runSuite.testCounts.failed}`)); + 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}`)}`); } logAssertion (error, severity) { diff --git a/test/cli/TapReporter.js b/test/cli/TapReporter.js index f91e552e5..157c63a58 100644 --- a/test/cli/TapReporter.js +++ b/test/cli/TapReporter.js @@ -66,7 +66,7 @@ QUnit.module('TapReporter', hooks => { }); QUnit.test('output ok for a skipped test', assert => { - const expected = kleur.yellow('ok 1 # SKIP name'); + const expected = 'ok 1 ' + kleur.yellow('# SKIP name'); emitter.emit('testEnd', { name: 'name', @@ -81,7 +81,7 @@ QUnit.module('TapReporter', hooks => { }); QUnit.test('output not ok for a todo test', assert => { - const expected = kleur.cyan('not ok 1 # TODO name'); + const expected = 'not ok 1 ' + kleur.cyan('# TODO name'); emitter.emit('testEnd', { name: 'name', @@ -96,7 +96,7 @@ QUnit.module('TapReporter', hooks => { }); QUnit.test('output not ok for a failing test', assert => { - const expected = kleur.red('not ok 1 name'); + const expected = 'not ok 1 ' + kleur.red('name'); emitter.emit('testEnd', { name: 'name', @@ -124,7 +124,7 @@ QUnit.module('TapReporter', hooks => { assertions: [] }); - assert.strictEqual(buffer, `${kleur.red('not ok 1 name')} + assert.strictEqual(buffer, 'not ok 1 ' + kleur.red('name') + ` --- message: first error severity: failed @@ -148,7 +148,7 @@ QUnit.module('TapReporter', hooks => { QUnit.test('output global failure (string)', assert => { emitter.emit('error', 'Boo'); - assert.strictEqual(buffer, `${kleur.red('not ok 1 global failure')} + assert.strictEqual(buffer, 'not ok 1 ' + kleur.red('global failure') + ` --- message: Boo severity: failed @@ -163,7 +163,7 @@ Bail out! Boo mockStack(err); emitter.emit('error', err); - assert.strictEqual(buffer, `${kleur.red('not ok 1 global failure')} + assert.strictEqual(buffer, 'not ok 1 ' + kleur.red('global failure') + ` --- message: ReferenceError: Boo is not defined severity: failed @@ -418,9 +418,9 @@ Bail out! ReferenceError: Boo is not defined assert.strictEqual(buffer, `1..6 # pass 3 -${kleur.yellow('# skip 1')} -${kleur.cyan('# todo 0')} -${kleur.red('# fail 2')} +# ${kleur.yellow('skip 1')} +# ${kleur.cyan('todo 0')} +# ${kleur.red('fail 2')} ` ); });