Added explicit map implementation too, for further IE compatibility

This commit is contained in:
Tim Perry 2013-03-28 12:59:27 +00:00
parent f22ec9c178
commit 9a773a188a

View File

@ -82,9 +82,17 @@ phantom.sendMessage = function() {
return this.results_[specId]; return this.results_[specId];
}; };
function map(values, f) {
var result = [];
for (var ii = 0; ii < values.length; ii++) {
result.push(f(values[ii]));
}
return result;
}
PhantomReporter.prototype.reportRunnerResults = function(runner) { PhantomReporter.prototype.reportRunnerResults = function(runner) {
this.finished = true; this.finished = true;
var specIds = runner.specs().map(function(a){return a.id;}); var specIds = map(runner.specs(), function(a){return a.id;});
var summary = this.resultsForSpecs(specIds); var summary = this.resultsForSpecs(specIds);
phantom.sendMessage('jasmine.reportRunnerResults',summary); phantom.sendMessage('jasmine.reportRunnerResults',summary);
phantom.sendMessage('jasmine.reportJUnitResults', this.generateJUnitSummary(runner)); phantom.sendMessage('jasmine.reportJUnitResults', this.generateJUnitSummary(runner));
@ -218,10 +226,10 @@ phantom.sendMessage = function() {
PhantomReporter.prototype.generateJUnitSummary = function(runner) { PhantomReporter.prototype.generateJUnitSummary = function(runner) {
var consolidatedSuites = {}, var consolidatedSuites = {},
suites = runner.suites().map(function(suite) { suites = map(runner.suites(), function(suite) {
var failures = 0; var failures = 0;
var testcases = suite.specs().map(function(spec) { var testcases = map(suite.specs(), function(spec) {
var failureMessages = []; var failureMessages = [];
if (spec.results().failedCount) { if (spec.results().failedCount) {
failures++; failures++;