diff --git a/lib/reporter.js b/lib/reporter.js index a301560..bbcd61f 100644 --- a/lib/reporter.js +++ b/lib/reporter.js @@ -63,11 +63,12 @@ var CoverageReporter = function(rootConfig, emitter, helper, logger) { } } - this.onRunStart = function(browsers) { - collectors = {}; - browsers.forEach(function(browser) { - collectors[browser.id] = new istanbul.Collector(); - }); + this.onRunStart = function() { + collectors = Object.create(null); + }; + + this.onBrowserStart = function(browser) { + collectors[browser.id] = new istanbul.Collector(); }; this.onBrowserComplete = function(browser, result) { diff --git a/test/reporter.spec.coffee b/test/reporter.spec.coffee index 7447f05..9f7aaa0 100644 --- a/test/reporter.spec.coffee +++ b/test/reporter.spec.coffee @@ -118,7 +118,8 @@ describe 'reporter', -> fakeOpera = makeBrowser 'bbb', 'Opera/9.80 Mac OS X Version/12.00', browsers, emitter browsers.add fakeChrome browsers.add fakeOpera - reporter.onRunStart browsers + reporter.onRunStart() + browsers.forEach (b) -> reporter.onBrowserStart b mockFs.writeFile.reset() mockMkdir.reset()