karma-parallel
Advanced tools
Comparing version 0.2.3 to 0.2.4
@@ -14,4 +14,4 @@ 'use strict'; | ||
config.shardStrategy = config.shardStrategy || 'round-robin'; | ||
config.aggregatedReporterTest = ('aggregatedReporterTest' in config) ? config.aggregatedReporterTest : /coverage|istanbul/i; | ||
config.executors = config.executors || Math.max(1, require('os').cpus().length - 1); | ||
config.aggregatedReporterTest = ('aggregatedReporterTest' in config) ? config.aggregatedReporterTest : /coverage|istanbul|junit/i; | ||
config.executors = Math.max(1, config.executors || require('os').cpus().length - 1); | ||
return config; | ||
@@ -18,0 +18,0 @@ } |
@@ -9,2 +9,33 @@ // jshint node:true | ||
class AggegatedBrowserLastResult { | ||
constructor() { | ||
this._realLastResults = {}; | ||
} | ||
get total() { | ||
return _.sum( | ||
_.map(this._realLastResults, 'total') | ||
); | ||
} | ||
get failed() { | ||
return _.sum( | ||
_.map(this._realLastResults, 'failed') | ||
); | ||
} | ||
get netTime() { | ||
return _.max( | ||
_.map(this._realLastResults, 'netTime') | ||
); | ||
} | ||
get disconnected() { | ||
return _.some( | ||
_.map(this._realLastResults, 'disconnected') | ||
); | ||
} | ||
get error() { | ||
return _.some( | ||
_.map(this._realLastResults, 'error') | ||
); | ||
} | ||
} | ||
const AggregatedCoverageReporter = function(injector, logger, config, baseReporterDecorator, formatError) { | ||
@@ -39,10 +70,9 @@ const log = logger.create('reporter:parallel-coverage'); | ||
name: browser.name, | ||
id: config.browserIdAlias[browser.name] | ||
fullName: browser.fullName, | ||
id: config.browserIdAlias[browser.name], | ||
lastResult: new AggegatedBrowserLastResult() | ||
}); | ||
const getStartedBrowserCount = (aggregate) => | ||
_.chain(aggregate.real) | ||
.filter((browser) => browser === UNSTARTED) | ||
.size() | ||
.value(); | ||
_.size(aggregate.real); | ||
@@ -67,5 +97,6 @@ const getFinishedBrowserCount = (aggregate) => | ||
this.onRunStart = function() { | ||
this.onRunStart = function(browsers) { | ||
aggregatedBrowserState = {}; | ||
callThrough('onRunStart'); | ||
// Browsers will be an empty collection on newer versions of karma | ||
callThrough('onRunStart', browsers); | ||
}; | ||
@@ -78,2 +109,3 @@ | ||
delete aggregate.alias.lastResult._realLastResults[browser.id]; | ||
aggregate.real[browser.id] = UNSTARTED; | ||
@@ -91,2 +123,3 @@ | ||
if (aggregate) { | ||
aggregate.alias.lastResult._realLastResults[browser.id] = browser.lastResult; | ||
// TODO: Does result have any other info that needs to be aggregated or removed? | ||
@@ -102,2 +135,3 @@ callThrough('onSpecComplete', aggregate.alias, result); | ||
if (aggregate) { | ||
aggregate.alias.lastResult._realLastResults[browser.id] = browser.lastResult; | ||
aggregate.real[browser.id] = result; | ||
@@ -125,2 +159,4 @@ if (getFinishedBrowserCount(aggregate) === config.executors) { | ||
.value(); | ||
// Reset out state after completion | ||
aggregatedBrowserState = null; | ||
callThrough('onRunComplete', aggregatedBrowsers, results); | ||
@@ -127,0 +163,0 @@ }; |
@@ -28,2 +28,3 @@ { | ||
"karma-jasmine": "^1.1.1", | ||
"karma-junit-reporter": "^1.2.0", | ||
"karma-mocha": "^1.3.0", | ||
@@ -66,2 +67,3 @@ "mocha": "^5.0.1", | ||
"karma:jasmine": "karma start karma-confs/jasmine.conf.js", | ||
"karma:jasmine-junit": "karma start karma-confs/jasmine-junit.conf.js", | ||
"karma:jasmine-focused": "karma start karma-confs/jasmine-focused.conf.js", | ||
@@ -71,2 +73,3 @@ "karma:jasmine-coverage": "karma start karma-confs/jasmine-coverage.conf.js", | ||
"karma:mocha": "karma start karma-confs/mocha.conf.js", | ||
"karma:mocha-junit": "karma start karma-confs/mocha-junit.conf.js", | ||
"karma:mocha-focused": "karma start karma-confs/mocha-focused.conf.js", | ||
@@ -79,3 +82,3 @@ "karma:mocha-coverage": "karma start karma-confs/mocha-coverage.conf.js", | ||
}, | ||
"version": "0.2.3" | ||
"version": "0.2.4" | ||
} |
@@ -73,5 +73,4 @@ # karma-parallel | ||
`parallelOptions.aggregatedReporterTest [(reporter)=>boolean|regex=/coverage|istanbul/i]`: This is an | ||
optional regex or function used to determine if a reporter needs to only received aggregated events from the browser shards. It is used to ensure coverage reporting is accurate | ||
amongst all the shards of a browser. Set to null to disable aggregated reporting. | ||
`parallelOptions.aggregatedReporterTest [(reporter)=>boolean|regex=/coverage|istanbul|junit/i]`: This is an | ||
optional regex or function used to determine if a reporter needs to only received aggregated events from the browser shards. It is used to ensure coverage reporting is accurate amongst all the shards of a browser. It is also useful for some programatic reporters such as junit reporters that need to operate on a single set of test outputs and not once for each shard. Set to null to disable aggregated reporting. | ||
@@ -78,0 +77,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
40007
40
748
15
110