Skip to content

Commit dab609e

Browse files
committed
Fix reporting of QUnit todo tests
The update to js-reporters 2.1.0 in the previous commit has fixed the most important problem, which is the build status reported by the `runEnd` event, handled via "_report" submission. However, the todo tests were still printed as errors in the output which is confusing. Before: ``` [Windows 8, Chrome 91.0] Error: "test.todo.each [0]" failed Expected: true Actual: false [Windows 8, Chrome 91.0] Passed: 332 tests, 321 passed, 0 failed, 7 skipped; ran for 1255ms ``` After: ``` [Windows 10, Firefox 88.0] Passed: 332 tests, 321 passed, 0 failed, 7 skipped; ran for 1910ms ``` Fixes browserstack#247.
1 parent 8d262e3 commit dab609e

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

lib/server.js

+18-8
Original file line numberDiff line numberDiff line change
@@ -387,17 +387,27 @@ exports.Server = function Server(bsClient, workers, config, callback) {
387387

388388
logger.trace('[%s] _progress', worker.id, CircularJSON.stringify(query));
389389

390-
if (query && query.test && query.test.errors) {
390+
if (query && query.test) {
391+
// Include all tests in the report
391392
var browserReport = getBrowserReport(browserInfo);
392393
browserReport.tests.push(query.test || {});
393394

394-
query.test.errors.forEach(function(error) {
395-
logger.info('[%s] ' + chalk.red('Error:'), browserInfo, formatTraceback({
396-
error: error,
397-
testName: query.test.name,
398-
suiteName: query.test.suiteName
399-
}));
400-
});
395+
// Only print errors of failed tests
396+
// (errors from todo tests are expected and will not be reported as
397+
// "failed" to the "_report" handler either, so printing them here
398+
// would create a confusing output with error printed but a success
399+
// status at the end)
400+
// https://github.com/browserstack/browserstack-runner/issues/247
401+
if (query.test.errors && query.test.status !== 'todo') {
402+
query.test.errors.forEach(function(error) {
403+
logger.info('[%s] ' + chalk.red('Error:'), browserInfo, formatTraceback({
404+
testName: query.test.name,
405+
suiteName: query.test.suiteName,
406+
status: query.test.status,
407+
error: error
408+
}));
409+
});
410+
}
401411
}
402412
response.end();
403413
},

0 commit comments

Comments
 (0)