diff --git a/index.js b/index.js
index 18ba4a9..2d9246e 100644
--- a/index.js
+++ b/index.js
@@ -86,6 +86,7 @@ function Jasmine2HTMLReporter(options) {
self.consolidateAll = self.consolidate !== false && (options.consolidateAll === UNDEFINED ? true : options.consolidateAll);
self.filePrefix = options.filePrefix || (self.consolidateAll ? 'htmlReport' : 'htmlReport-');
self.cleanDestination = options.cleanDestination === UNDEFINED ? true : options.cleanDestination;
+ self.showPassed = options.showPassed === UNDEFINED ? true : options.showPassed;
var suites = [],
currentSuite = null,
@@ -277,20 +278,22 @@ function Jasmine2HTMLReporter(options) {
for (var i = 0; i < suite._specs.length; i++) {
var spec = suite._specs[i];
- html += '
';
- html += specAsHtml(spec);
- html += '
';
- if (spec.screenshot !== UNDEFINED){
- html += '
';
- html += '
';
- html += '';
- }
- html += '
';
- var num_tests= spec.failedExpectations.length + spec.passedExpectations.length;
- var percentage = (spec.passedExpectations.length*100)/num_tests;
- html += '
Tests passed: ' + parseDecimalRoundAndFixed(percentage,2) + '%';
+ if (self.showPassed || spec.failedExpectations.length > 0) {
+ html += '
';
+ html += specAsHtml(spec);
+ html += '
';
+ if (spec.screenshot !== UNDEFINED){
+ html += '
';
+ html += '
';
+ html += '';
+ }
+ html += '
';
+ var num_tests= spec.failedExpectations.length + spec.passedExpectations.length;
+ var percentage = (spec.passedExpectations.length*100)/num_tests;
+ html += '
Tests passed: ' + parseDecimalRoundAndFixed(percentage,2) + '%';
+ html += '
';
html += '
';
- html += '
';
+ }
}
html += '\n ';
return html;
@@ -307,11 +310,13 @@ function Jasmine2HTMLReporter(options) {
html += expectation.message + '
✗';
html += '';
});
- _.each(spec.passedExpectations, function(expectation){
- html += '
';
- html += expectation.message + '✓';
- html += '';
- });
+ if (self.showPassed) {
+ _.each(spec.passedExpectations, function(expectation){
+ html += '
';
+ html += expectation.message + '✓';
+ html += '';
+ });
+ }
html += '
';
}
return html;