Skip to content

Commit

Permalink
Merge pull request #34 from bloof-bb/master
Browse files Browse the repository at this point in the history
Adding option to exclude skipped specs using excludeSkippedSpecs parameter
  • Loading branch information
Evilweed authored Dec 28, 2017
2 parents 4e3c6cd + cc48d98 commit 77473dc
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
6 changes: 6 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,15 @@ 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 =
options.gatherBrowserLogs || true;
this.takeScreenShotsOnlyForFailedSpecs =
options.takeScreenShotsOnlyForFailedSpecs || false;
this.finalOptions = {
excludeSkippedSpecs: this.excludeSkippedSpecs,
takeScreenShotsOnlyForFailedSpecs: this.takeScreenShotsOnlyForFailedSpecs,
takeScreenShotsForSkippedSpecs: this.takeScreenShotsForSkippedSpecs,
metaDataBuilder: this.metaDataBuilder,
Expand Down Expand Up @@ -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();

Expand Down

0 comments on commit 77473dc

Please sign in to comment.