grunt-parallel-spec-runner
Advanced tools
Comparing version 0.2.2 to 0.2.3
{ | ||
"name": "grunt-parallel-spec-runner", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"description": "Plugin used to configure and launch multiple spec ", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/RallySoftware/grunt-parallel-spec-runner.git", |
@@ -72,3 +72,9 @@ /* | ||
file: '_SpecRunner.' + ('0000' + specRunnerIndex).slice(-4) + '.html', | ||
specs: [] | ||
specs: [], | ||
summary: { | ||
test: '?', | ||
wins: 0, | ||
losses: 0 , | ||
failedSpecs: [] | ||
} | ||
}; | ||
@@ -100,7 +106,10 @@ } | ||
grunt: true, | ||
opts: {stdio: 'inherit'}, | ||
opts: {stdio: 'pipe'}, | ||
args: [targetName, 'replace:jasmine'] | ||
}; | ||
appendAdditionalOptions(spawnOptions.args); | ||
grunt.util.spawn(spawnOptions, doneFunction); | ||
var s = grunt.util.spawn(spawnOptions, doneFunction); | ||
s.stdout.on('data', function(data) { | ||
grunt.verbose.write(data); | ||
}); | ||
}; | ||
@@ -137,3 +146,3 @@ | ||
grunt: true, | ||
opts: {stdio: 'inherit'}, | ||
opts: {stdio: 'pipe'}, | ||
args: ['webdriver_jasmine_runner:' + options.target + ':' + specRunner.file] | ||
@@ -218,4 +227,76 @@ } | ||
return { | ||
getSummary: function(){ | ||
return summary; | ||
writeSummary: function(){ | ||
var ln = grunt.util.repeat(process.stdout.getWindowSize()[0], '-'), | ||
tab = '\t'; | ||
var summary = [], | ||
totalLosses = 0, | ||
totalWins = 0, | ||
totalTests = 0, | ||
totalFiles = 0, | ||
totalSeconds = 0, | ||
totalResult = '?'; | ||
grunt.log.writeln(ln); | ||
grunt.log.writeln('SpecRunner | Files | Tests | Seconds | Result'); | ||
grunt.log.writeln(ln); | ||
specRunners.forEach(function(specRunner){ | ||
var wins = specRunner.summary.wins; | ||
var losses = specRunner.summary.losses; | ||
var file = specRunner.file; | ||
if(wins > 0){ | ||
totalWins = totalWins + wins; | ||
} | ||
if(losses > 0){ | ||
file = file.red; | ||
} | ||
totalLosses = totalLosses + losses; | ||
totalFiles = totalFiles + specRunner.specs.length; | ||
totalTests = totalTests + specRunner.summary.tests; | ||
totalSeconds = totalSeconds + specRunner.summary.time; | ||
if(totalLosses > 0) | ||
{ | ||
totalResult = (totalLosses + ' of ' + totalWins + ' tests failed').red; | ||
} | ||
else{ | ||
totalResult = 'All ' + totalWins + ' tests passed'; | ||
} | ||
var row = file | ||
+ ' | ' + (' ' + specRunner.specs.length).slice(-4) + ' ' | ||
+ ' | ' + (' ' + specRunner.summary.tests).slice(-4) + ' ' | ||
+ ' | ' + (' ' + specRunner.summary.time).slice(-6) + ' ' | ||
+ ' | ' + specRunner.summary.message + ' '; | ||
grunt.log.writeln(row); | ||
if(options.verbose){ | ||
specRunner.specs.forEach(function(path){ | ||
if(specRunner.summary.failedSpecs.indexOf(path) != -1){ | ||
path = path.red; | ||
} | ||
grunt.log.writeln(' ' + path); | ||
}); | ||
} | ||
if(+losses > 0 && !options.verbose){ | ||
specRunner.summary.failedSpecs.forEach(function(path){ | ||
grunt.log.writeln(' ' + path.red); | ||
}); | ||
} | ||
}); | ||
grunt.log.writeln(ln); | ||
var row = | ||
' ' | ||
+ ' | ' + (' ' + totalFiles).slice(-4) + ' ' | ||
+ ' | ' + (' ' + totalTests).slice(-4) + ' ' | ||
+ ' | ' + (' ' + totalSeconds).slice(-6) + ' ' | ||
+ ' | ' + totalResult; | ||
grunt.log.writeln(row); | ||
grunt.log.writeln(ln); | ||
}, | ||
@@ -242,3 +323,3 @@ | ||
//TODO: add grunt-time plugin to measure execution time | ||
var startTime = new Date().getTime() / 1000; | ||
var startTime = new Date(); | ||
@@ -270,4 +351,2 @@ var options = this.options({ | ||
//options.specs = options.specs.splice(0, 10); | ||
//Use the user defined number of spec files per runner, or split the spec files among the available runners | ||
@@ -283,7 +362,5 @@ options.maxSpecFilesPerRunner = +grunt.option('maxSpecFilesPerRunner') > 0 ? +grunt.option('maxSpecFilesPerRunner') | ||
//TODO: output timing info from grunt-time task instead | ||
//TODO: cleanup/format output messages | ||
grunt.log.writeln('Summary Failures:' + specRunner.getSummary().failures); | ||
var endTime = new Date().getTime() / 1000; | ||
grunt.log.writeln("Total Execution Time:" + ((endTime - startTime) / 60) + ' Minutes'); | ||
specRunner.writeSummary(); | ||
var endTime = new Date(); | ||
grunt.log.writeln("Total Execution Time:" + Math.ceil((endTime - startTime)/1000/60).toFixed(2) + ' Minutes'); | ||
@@ -290,0 +367,0 @@ done(me.errorCount == 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
18224
415