Skip to content

Commit

Permalink
fix: update to work with Karma 0.11
Browse files Browse the repository at this point in the history
Since Karma executes immediately, we don't have all the browsers in advance, the reporter has to listen on browser_start instead.
  • Loading branch information
vojtajina committed Aug 25, 2013
1 parent 16bd46f commit b744d6f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
11 changes: 6 additions & 5 deletions lib/reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 2 additions & 1 deletion test/reporter.spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down

0 comments on commit b744d6f

Please sign in to comment.