Skip to content

Commit 305df2c

Browse files
maksimrdignifiedquire
authored andcommitted
fix(reporters): cannot read property map of undefined
Fixes #1662
1 parent 79bc193 commit 305df2c

2 files changed

Lines changed: 44 additions & 0 deletions

File tree

lib/reporters/progress.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ var ProgressReporter = function (formatError, reportSlow, useColors, browserCons
44
BaseReporter.call(this, formatError, reportSlow, useColors, browserConsoleLogOptions)
55

66
this.EXCLUSIVELY_USE_COLORS = false
7+
this._browsers = []
78

89
this.writeCommonMsg = function (msg) {
910
this.write(this._remove() + msg + this._render())
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
describe('reporter', function () {
2+
var ProgressReporter = require('../../../lib/reporters/progress')
3+
4+
describe('Progress', function () {
5+
var reporter
6+
var formatError
7+
8+
beforeEach(function () {
9+
formatError = sinon.spy()
10+
reporter = new ProgressReporter(formatError, null, false, {terminal: true})
11+
})
12+
13+
it('should turn off colors', function () {
14+
expect(reporter.EXCLUSIVELY_USE_COLORS).to.equal(false)
15+
})
16+
17+
it('should prepare state on run tests', function () {
18+
sinon.stub(reporter, 'write')
19+
sinon.stub(reporter, 'renderBrowser')
20+
21+
reporter.onRunStart()
22+
reporter.onBrowserStart(createBrowserMock())
23+
24+
reporter.onRunStart()
25+
26+
expect(reporter._browsers.length).to.equal(0)
27+
expect(reporter._isRendered).to.equal(false)
28+
})
29+
30+
it('should not throw exception if browser exit with error without run tests', function () {
31+
sinon.stub(reporter, 'write')
32+
sinon.stub(reporter, 'renderBrowser')
33+
34+
expect(function () {
35+
reporter.onBrowserError(createBrowserMock())
36+
}).to.not.throw()
37+
})
38+
39+
function createBrowserMock () {
40+
return {}
41+
}
42+
})
43+
})

0 commit comments

Comments
 (0)