grunt-parallel-spec-runner
Advanced tools
Comparing version 0.3.18 to 0.3.19
{ | ||
"name": "grunt-parallel-spec-runner", | ||
"version": "0.3.18", | ||
"version": "0.3.19", | ||
"description": "Plugin used to configure and launch multiple spec ", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/RallySoftware/grunt-parallel-spec-runner.git", |
@@ -29,19 +29,36 @@ /* | ||
if(code !== 0 || (specRunner.summary.childProcess && specRunner.summary.childProcess.killed)){ | ||
if ((specRunner.summary.childProcess && specRunner.summary.childProcess.killed)) { | ||
grunt.log.writeln((specRunner.file + ':Killed due to unresponsiveness').yellow); | ||
var stdout = grunt.log.uncolor(result.stdout || '') | ||
if(/All \d+ tests passed!/.test(stdout)){ | ||
return; | ||
} | ||
if(String(error) !== 'Error'){ | ||
grunt.log.writeln(String(error).replace('tests failed:','tests failed')); | ||
if(options.verbose){ | ||
grunt.log.writeln('handleError:' + JSON.stringify({ | ||
specRunner: specRunner.file, | ||
error: error, | ||
result: result, | ||
code: code | ||
}, null, '\t').cyan) | ||
} | ||
var msg = grunt.log.uncolor(String(result)), | ||
if ((specRunner.summary.childProcess && specRunner.summary.childProcess.killed)) { | ||
grunt.log.writeln((specRunner.file + ':Killed due to unresponsiveness after ' + specRunner.summary.childProcess.timeSinceLastHeartbeat + ' seconds').yellow); | ||
specRunner.summary.retry = true; | ||
retriesRequired = true; | ||
return; | ||
} | ||
var msg = stdout, | ||
pat = /\d+ of \d+ tests failed:/; | ||
if(pat.test(msg)) { | ||
msg = msg.match(pat)[0].replace('tests failed:', 'tests failed'); | ||
grunt.log.writeln(msg.red); | ||
msg = String(result).substring(String(result).lastIndexOf('tests failed:')) | ||
.replace('tests failed:', '') | ||
grunt.log.writeln(msg.yellow); | ||
grunt.log.writeln((specRunner.file + ':' + msg).yellow); | ||
msg = stdout.substring(stdout.lastIndexOf('tests failed:')).replace('tests failed:', '') | ||
grunt.log.writeln((specRunner.file + ':' + msg).yellow); | ||
specRunner.specs.forEach(function(path){ | ||
if(String(result).indexOf(path) != -1 && | ||
if(stdout.indexOf(path) != -1 && | ||
specRunner.summary.failedSpecs.indexOf(path) == -1){ | ||
@@ -53,3 +70,3 @@ specRunner.summary.failedSpecs.push(path); | ||
else { | ||
grunt.log.writeln(String(result).yellow); | ||
grunt.log.writeln((specRunner.file + ':' + String(result)).yellow); | ||
} | ||
@@ -152,6 +169,5 @@ specRunner.summary.retry = true; | ||
if (timeSinceLastHeartbeat > options.idleTimeout) { | ||
grunt.log.writeln((specRunner.file + ':Last heartbeat:' + Math.ceil(timeSinceLastHeartbeat/1000) + ' seconds ago').yellow); | ||
//TODO: kill driver instance, and local selenium server | ||
//then kill child process, to prevent orphan windows and selenium servers | ||
specRunner.summary.childProcess.timeSinceLastHeartbeat = Math.ceil(timeSinceLastHeartbeat/1000); | ||
specRunner.summary.childProcess.kill('SIGKILL') | ||
@@ -204,3 +220,3 @@ } | ||
grunt: true, | ||
opts: {stdio: 'pipe'}, | ||
opts: {stdout: 'pipe', stderr: 'pipe'}, | ||
args: ['webdriver_jasmine_runner:' + options.target + ':' + specRunner.file] | ||
@@ -222,2 +238,6 @@ } | ||
var s = specRunner.summary.childProcess = grunt.util.spawn(opts, df); | ||
s.stderr.on('data', function(data) { | ||
specRunner.summary.retry = true; | ||
retriesRequired = true; | ||
}); | ||
@@ -229,19 +249,5 @@ //Capture bits of data used for the summary | ||
var msg = grunt.log.uncolor(String(data)); | ||
var pat = /^([\.F]+\s\d+\s\/\s\d+\s\(\d+\))$/m; | ||
var msg = grunt.log.uncolor(String(data)), | ||
pat = /Running tests for .*/; | ||
if(pat.test(msg)) { | ||
var done = +msg.match(/\d+/)[0]; | ||
if(done != specRunner.summary.tests) { | ||
msg = String(data).replace(/([\.F]+)/,'Progress... '); | ||
pat = /\([1-9][0-9]{0,}\)$/m; | ||
if(pat.test(msg)){ | ||
var s = msg.match(pat)[0]; | ||
msg = msg.replace(s, s.red); | ||
} | ||
grunt.verbose.or.writeln((specRunner.file + ':' + msg).replace(/\n/, '')); | ||
} | ||
} | ||
pat = /Running Jasmine tests for .*/; | ||
if(pat.test(msg)) { | ||
grunt.verbose.or.writeln(specRunner.file + ':' + msg); | ||
@@ -253,18 +259,10 @@ } | ||
msg = msg.match(pat)[0].replace('tests failed:', 'tests failed'); | ||
//grunt.verbose.or.writeln((specRunner.file + ':' + msg).red); | ||
specRunner.summary.wins = +msg.match(/\d+/g)[1]; | ||
specRunner.summary.losses = +msg.match(/\d+/g)[0]; | ||
specRunner.summary.message = msg.replace(':', '').red; | ||
specRunner.summary.message = msg.red; | ||
} | ||
pat = /error/i; | ||
if(pat.test(msg) && !/Done, without errors\./.test(msg)) { | ||
grunt.verbose.or.writeln((specRunner.file + ':').red); | ||
grunt.verbose.or.writeln(msg.red); | ||
} | ||
pat = /All \d+ tests passed!/; | ||
if(pat.test(msg)) { | ||
msg = msg.match(pat)[0]; | ||
grunt.verbose.or.writeln(specRunner.file + ':' + msg); | ||
specRunner.summary.wins = +msg.match(/\d+/g)[0]; | ||
@@ -279,3 +277,2 @@ specRunner.summary.losses = 0; | ||
msg = msg.match(pat)[0]; | ||
grunt.verbose.or.writeln(specRunner.file + ':' + msg); | ||
specRunner.summary.start = new Date(); | ||
@@ -282,0 +279,0 @@ specRunner.summary.tests = +msg.match(/\d+/g)[0]; |
220338
549