[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.
This commit is contained in:
Xavier Morel
2021-06-29 05:34:16 +00:00
parent 438c6efdd7
commit c6855cdcf8
+3 -9
View File
@@ -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