Skip to content

Commit

Permalink
Update index.js
Browse files Browse the repository at this point in the history
  • Loading branch information
ryan-ohern authored May 9, 2017
1 parent f3fd61b commit f2d2aa9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ function Jasmine2HTMLReporter(options) {
self.fileName = options.fileName === UNDEFINED ? 'htmlReport' : options.fileName;
self.cleanDestination = options.cleanDestination === UNDEFINED ? true : options.cleanDestination;
self.showPassed = options.showPassed === UNDEFINED ? true : options.showPassed;
self.reportPassedTest = options.reportPassedTest === UNDEFINED ? true : options.reportPassedTest;

var suites = [],
currentSuite = null,
Expand Down Expand Up @@ -235,11 +236,15 @@ function Jasmine2HTMLReporter(options) {
}

var output = '';
var testFailed = false;
for (var i = 0; i < suites.length; i++) {
output += self.getOrWriteNestedOutput(suites[i]);
if (suites[i]._failures > 0) {
testFailed = true;
}
}
// if we have anything to write here, write out the consolidated file
if (output) {
if ((output && self.reportPassedTest) || (output && !self.reportPassedTest && testFailed)) {
wrapOutputAndWriteFile(getReportFilename(), output);
}
//log("Specs skipped but not reported (entire suite skipped or targeted to specific specs)", totalSpecsDefined - totalSpecsExecuted + totalSpecsDisabled);
Expand Down

1 comment on commit f2d2aa9

@ryan-ohern
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added optional parameter to not generate a html report if there are failures in any spec

Please sign in to comment.