Skip to content

Commit

Permalink
fix(BaseReporter): log message correctly with just one browser (#3045)
Browse files Browse the repository at this point in the history
  • Loading branch information
Teamop authored and johnjbarton committed Jun 15, 2018
1 parent a19b8d4 commit c1eb236
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/reporters/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ const BaseReporter = function (formatError, reportSlow, useColors, browserConsol
}

this.onRunComplete = (browsers, results) => {
if (browsers.length > 1 && !results.error && !results.disconnected) {
if (browsers.length >= 1 && !results.error && !results.disconnected) {
if (!results.failed) {
this.write(this.TOTAL_SUCCESS, results.success)
} else {
Expand Down
12 changes: 10 additions & 2 deletions test/unit/reporters/base.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
describe('reporter', () => {
const BaseReporter = require('../../../lib/reporters/base')

describe('Progress', () => {
describe('Base', () => {
let reporter
let adapter = reporter = null

Expand Down Expand Up @@ -181,13 +181,21 @@ describe('reporter', () => {
return writeSpy.should.have.been.called
})

return it('should format log messages correctly for multi browsers', () => {
it('should format log messages correctly for multi browsers', () => {
const writeSpy = sinon.spy(reporter, 'writeCommonMsg')

reporter._browsers = ['Chrome', 'Firefox']
reporter.onBrowserLog('Chrome', 'Message', 'LOG')

return expect(writeSpy).to.have.been.calledWith('Chrome LOG: Message\n')
})

it('should log messages correctly when complete with just one browser', () => {
const writeSpy = sinon.spy(reporter, 'write')
const mockResults = {error: false, disconnected: false}

reporter.onRunComplete(['Chrome'], mockResults)
return writeSpy.should.have.been.called
})
})
})

0 comments on commit c1eb236

Please sign in to comment.