Skip to content

Commit

Permalink
trim succeeding tests
Browse files Browse the repository at this point in the history
because saucelabs barfs on output > 64k

adapted from
axemclion/grunt-saucelabs#109 (comment)
  • Loading branch information
gordonwoodhull committed Dec 23, 2015
1 parent fa68f16 commit ebaf8c9
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
37 changes: 37 additions & 0 deletions spec/helpers/load-jsreporter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// reporter for saucelabs
jasmine.getEnv().addReporter(new jasmine.JSReporter2());

(function () {
var oldJSReport = window.jasmine.getJSReport;
window.jasmine.getJSReport = function () {
var results = oldJSReport();
if (results) {
return {
durationSec: results.durationSec,
suites: removePassingTests(results.suites),
passed: results.passed
};
} else {
return null;
}
};

function removePassingTests (suites) {
return suites.filter(specFailed)
.map(mapSuite);
}

function mapSuite (suite) {
var result = {};
for (var s in suite) {
result[s] = suite[s];
}
result.specs = suite.specs.filter(specFailed);
result.suites = removePassingTests(suite.suites);
return result;
}

function specFailed (item) {
return !item.passed;
}
})();
2 changes: 0 additions & 2 deletions spec/helpers/spec-helper.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
/* global parseTranslate */
// reporter for saucelabs
jasmine.getEnv().addReporter(new jasmine.JSReporter2());
beforeEach(function () {
d3.select('body').append('div').attr('id', 'test-content');
jasmine.clock().install();
Expand Down

0 comments on commit ebaf8c9

Please sign in to comment.