From c6855cdcf844fb49cdf8aae7bacecca1fef01b88 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Fri, 23 Apr 2021 05:38:27 +0000 Subject: [PATCH] [IMP] qunit: avoid splitting `console.error` calls The Chrome runner may only show the first one, which may or may not be useful on its own. --- addons/web/static/tests/helpers/cleanup.js | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/addons/web/static/tests/helpers/cleanup.js b/addons/web/static/tests/helpers/cleanup.js index 814410d0392..d68bc467ee3 100644 --- a/addons/web/static/tests/helpers/cleanup.js +++ b/addons/web/static/tests/helpers/cleanup.js @@ -79,24 +79,18 @@ QUnit.on("OdooAfterTestHook", function (info) { (e) => e.tagName === bodyChild.tagName && bodyChild.getAttribute(e.attr) === e.value ); if (!tolerated) { - console.error(`Test ${info.moduleName} > ${info.testName}`); console.error( - "Body still contains undesirable elements:" + - "\nInvalid element:\n" + - bodyChild.outerHTML - ); +`Test ${info.moduleName} > ${info.testName}: body still contains undesirable elements: + ${bodyChild.outerHTML}`); QUnit.pushFailure(`Body still contains undesirable elements`); } if (!tolerated || !tolerated.keep) { toRemove.push(bodyChild); } } - // check for leftovers in #qunit-fixture + // cleanup leftovers in #qunit-fixture const qunitFixture = document.getElementById("qunit-fixture"); if (qunitFixture.children.length) { - // console.error('#qunit-fixture still contains elements:' + - // '\n#qunit-fixture HTML:\n' + qunitFixture.outerHTML); - // QUnit.pushFailure(`#qunit-fixture still contains elements`); toRemove.push(...qunitFixture.children); } // remove unwanted elements if not in debug