diff --git a/README.md b/README.md index 68de66d..de54f16 100644 --- a/README.md +++ b/README.md @@ -178,8 +178,20 @@ new HtmlReporter({ If you omit this, all specs will be sorted by timestamp (please be aware that sharded runs look ugly when sorted by default sort). -### Report for skipped test cases (optional) -You can define if you want report from skipped test cases using the `takeScreenShotsForSkippedSpecs` option: +### Exclude report for skipped test cases (optional) +You can set `excludeSkippedSpecs` to `true` to exclude reporting skipped test cases entirely. + +```javascript +new HtmlReporter({ + baseDirectory: `tmp/screenshots` + , excludeSkippedSpecs: true +}); +``` +Default is `false`. + +### Screenshots for skipped test cases (optional) + +You can define if you want report screenshots from skipped test cases using the `takeScreenShotsForSkippedSpecs` option: ```javascript new HtmlReporter({ diff --git a/index.js b/index.js index 6428e5c..a6e5538 100644 --- a/index.js +++ b/index.js @@ -166,6 +166,7 @@ function ScreenshotReporter(options) { this.jasmine2MetaDataBuilder = options.jasmine2MetaDataBuilder || jasmine2MetaDataBuilder; this.sortFunction = options.sortFunction || sortFunction; this.preserveDirectory = typeof options.preserveDirectory !== 'undefined' ? options.preserveDirectory : true; + this.excludeSkippedSpecs = options.excludeSkippedSpecs || false; this.takeScreenShotsForSkippedSpecs = options.takeScreenShotsForSkippedSpecs || false; this.gatherBrowserLogs = @@ -173,6 +174,7 @@ function ScreenshotReporter(options) { this.takeScreenShotsOnlyForFailedSpecs = options.takeScreenShotsOnlyForFailedSpecs || false; this.finalOptions = { + excludeSkippedSpecs: this.excludeSkippedSpecs, takeScreenShotsOnlyForFailedSpecs: this.takeScreenShotsOnlyForFailedSpecs, takeScreenShotsForSkippedSpecs: this.takeScreenShotsForSkippedSpecs, metaDataBuilder: this.metaDataBuilder, @@ -249,6 +251,10 @@ class Jasmine2Reporter { } async _asyncSpecDone(result) { + // Don't report if it's skipped and we don't need it + if ((result.status === 'pending' || result.status === 'disabled') && this._screenshotReporter.excludeSkippedSpecs) { + return; + } result.stopped = nowString();