Skip to content

Commit

Permalink
fix(reporters): cannot read property map of undefined
Browse files Browse the repository at this point in the history
Fixes #1662
  • Loading branch information
maksimr authored and dignifiedquire committed Jan 14, 2017
1 parent 79bc193 commit 305df2c
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/reporters/progress.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ var ProgressReporter = function (formatError, reportSlow, useColors, browserCons
BaseReporter.call(this, formatError, reportSlow, useColors, browserConsoleLogOptions)

this.EXCLUSIVELY_USE_COLORS = false
this._browsers = []

this.writeCommonMsg = function (msg) {
this.write(this._remove() + msg + this._render())
Expand Down
43 changes: 43 additions & 0 deletions test/unit/reporters/progress.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
describe('reporter', function () {
var ProgressReporter = require('../../../lib/reporters/progress')

describe('Progress', function () {
var reporter
var formatError

beforeEach(function () {
formatError = sinon.spy()
reporter = new ProgressReporter(formatError, null, false, {terminal: true})
})

it('should turn off colors', function () {
expect(reporter.EXCLUSIVELY_USE_COLORS).to.equal(false)
})

it('should prepare state on run tests', function () {
sinon.stub(reporter, 'write')
sinon.stub(reporter, 'renderBrowser')

reporter.onRunStart()
reporter.onBrowserStart(createBrowserMock())

reporter.onRunStart()

expect(reporter._browsers.length).to.equal(0)
expect(reporter._isRendered).to.equal(false)
})

it('should not throw exception if browser exit with error without run tests', function () {
sinon.stub(reporter, 'write')
sinon.stub(reporter, 'renderBrowser')

expect(function () {
reporter.onBrowserError(createBrowserMock())
}).to.not.throw()
})

function createBrowserMock () {
return {}
}
})
})

0 comments on commit 305df2c

Please sign in to comment.