Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

travis-841337: Ease error reporting

Make detailedResultLog return a string rather than outputting it
directly to console.log.

Signed-off-by: Joe Walker <jwalker@mozilla.com>
  • Loading branch information...
commit 7dc9ab1f1b5956f4fee2dcc432ad8eaf96ad63fb 1 parent 79a1a96
@joewalker joewalker authored
View
2  lib/gclitest/index.js
@@ -123,7 +123,7 @@ exports.createDisplay = function(options) {
if (isPhantomjs) {
document.complete = true;
- examiner.detailedResultLog();
+ console.log(examiner.detailedResultLog());
}
console.log('Finished running unit tests. ' +
View
2  lib/server/commands/test.js
@@ -61,7 +61,7 @@ var testCmdSpec = {
isUnamdized: main.useUnamd
};
examiner.run(options).then(function() {
- examiner.detailedResultLog();
+ console.log(examiner.detailedResultLog());
});
}
});
View
21 lib/test/examiner.js
@@ -140,34 +140,37 @@ Object.defineProperty(examiner, 'status', {
});
/**
- * Output a test summary to console.log
+ * Return a test summary
*/
examiner.detailedResultLog = function() {
+ var reply = '';
Object.keys(this.suites).forEach(function(suiteName) {
var suite = examiner._suites[suiteName];
- console.log(suite.name + ': ' + suite.status.name +
+ reply += suite.name + ': ' + suite.status.name +
' (funcs=' + Object.keys(suite.tests).length +
', checks=' + suite.checks +
- ', skipped=' + suite.skippedCount + ')');
+ ', skipped=' + suite.skippedCount + ')\n';
Object.keys(suite.tests).forEach(function(testName) {
var test = suite.tests[testName];
if (test.status !== stati.pass) {
- console.log('- ' + test.name + ': ' + test.status.name);
+ reply += '- ' + test.name + ': ' + test.status.name + '\n';
test.failures.forEach(function(failure) {
- console.log(' - ' + failure.message);
+ reply += ' - ' + failure.message + '\n';
if (failure.params) {
- console.log(' - P1: ' + failure.p1);
- console.log(' - P2: ' + failure.p2);
+ reply += ' - P1: ' + failure.p1 + '\n';
+ reply += ' - P2: ' + failure.p2 + '\n';
}
}, this);
}
}, this);
}, this);
- console.log('');
- console.log('Summary: ' + this.status.name + ' (' + this.checks + ' checks)');
+ reply += '\n';
+ reply += 'Summary: ' + this.status.name + ' (' + this.checks + ' checks)\n';
+
+ return reply;
};
/**
Please sign in to comment.
Something went wrong with that request. Please try again.