From c3ca877d81e6d36af2977bbc6ce2ac5b068d05ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Tue, 16 May 2017 09:18:10 +0200 Subject: [PATCH] [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. --- addons/web/static/tests/helpers/qunit_config.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/addons/web/static/tests/helpers/qunit_config.js b/addons/web/static/tests/helpers/qunit_config.js index 3c6ca165036..641d3a6f09b 100644 --- a/addons/web/static/tests/helpers/qunit_config.js +++ b/addons/web/static/tests/helpers/qunit_config.js @@ -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); } });