[IMP] web: better error logging for qunit tests

Before this commit, when a test in the qunit test suite failed, the
error displayed by the runbot was not really interesting.  It just said
that test_01_js failed.  With this commit, each assertion error is now
logged as an error, which means that they are displayed in the short
error log by the runbot.
This commit is contained in:
Géry Debongnie
2017-05-16 14:41:03 +02:00
parent 15a227375a
commit c3ca877d81
@@ -62,13 +62,18 @@ QUnit.done(function(result) {
* This logs various data in the console, which will be available in the log
* .txt file generated by the runbot.
*/
QUnit.log(function( result) {
QUnit.log(function (result) {
if (!result.result) {
console.log('"' + result.name + '"',
'in section', '"' + result.module + '"',
'failed:', result.message);
console.log('actual:', result.actual);
console.log('expected:', result.expected);
var info = '"QUnit test failed: "' + result.module + ' > ' + result.name + '"';
info += ' [message: "' + result.message + '"';
if (result.actual !== null) {
info += ', actual: "' + result.actual + '"';
}
if (result.expected !== null) {
info += ', expected: "' + result.expected + '"';
}
info += ']';
console.error(info);
}
});