From e89b839357f8784b47756ce099862fef51612cdb Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Tue, 30 Jul 2013 19:46:45 -0500 Subject: [PATCH 1/2] Fixed missing junit failure output (#76) --- tasks/jasmine/reporters/PhantomReporter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/jasmine/reporters/PhantomReporter.js b/tasks/jasmine/reporters/PhantomReporter.js index 4a7c646..faf0261 100644 --- a/tasks/jasmine/reporters/PhantomReporter.js +++ b/tasks/jasmine/reporters/PhantomReporter.js @@ -239,7 +239,7 @@ phantom.sendMessage = function() { if (spec.results().failedCount) { failures++; var resultsItems = spec.results().items_; - for (var ii = 0; ii < resultsItems; ii++) { + for (var ii = 0; ii < resultsItems.length; ii++) { var expectation = resultsItems[ii]; if (!expectation.passed()) { failureMessages.push(expectation.message); From 0c26688e6f5983d3100ed6066ca34875927e221e Mon Sep 17 00:00:00 2001 From: Brian Ng Date: Tue, 30 Jul 2013 22:53:55 -0500 Subject: [PATCH 2/2] Slight refactor --- tasks/jasmine/reporters/PhantomReporter.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tasks/jasmine/reporters/PhantomReporter.js b/tasks/jasmine/reporters/PhantomReporter.js index faf0261..6ba04c0 100644 --- a/tasks/jasmine/reporters/PhantomReporter.js +++ b/tasks/jasmine/reporters/PhantomReporter.js @@ -236,10 +236,14 @@ phantom.sendMessage = function() { var testcases = map(suite.specs(), function(spec) { var failureMessages = []; - if (spec.results().failedCount) { + var specResults = spec.results(); + var resultsItems = specResults.items_; + var resultsItemCount = resultsItems.length; + + if (specResults.failedCount) { failures++; - var resultsItems = spec.results().items_; - for (var ii = 0; ii < resultsItems.length; ii++) { + + for (var ii = 0; ii < resultsItemCount; ii++) { var expectation = resultsItems[ii]; if (!expectation.passed()) { failureMessages.push(expectation.message); @@ -247,7 +251,7 @@ phantom.sendMessage = function() { } } return { - assertions: spec.results().items_.length, + assertions: resultsItemCount, className: getNestedSuiteName(spec.suite), name: spec.description, time: spec.duration / 1000,