From 1756415495aa514f11f66560bf3ebf5203844467 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Sun, 6 Jun 2021 06:15:35 -0400 Subject: [PATCH] tests: Avoid jQuery when reading Mocha output --- src/tests/frontend/travis/remote_runner.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/tests/frontend/travis/remote_runner.js b/src/tests/frontend/travis/remote_runner.js index 1e5453720..80b44f679 100644 --- a/src/tests/frontend/travis/remote_runner.js +++ b/src/tests/frontend/travis/remote_runner.js @@ -50,9 +50,17 @@ const sauceTestWorker = async.queue(async ({name, pfx, testSettings}) => { const deadline = Date.now() + 14.5 * 60 * 1000; // Slightly less than overall test timeout. // how many characters of the log have been sent to travis let logIndex = 0; + const remoteFn = (skipChars) => { + const console = document.getElementById('console'); // eslint-disable-line no-undef + if (console == null) return ''; + let text = ''; + for (const n of console.childNodes) { + if (n.nodeType === n.TEXT_NODE) text += n.data; + } + return text.substring(skipChars); + }; while (true) { - const remoteFn = ($, skipChars) => $('#console').text().substring(skipChars); - const consoleText = await browser.eval(`(${remoteFn})($, ${JSON.stringify(logIndex)})`); + const consoleText = await browser.eval(`(${remoteFn})(${JSON.stringify(logIndex)})`); (consoleText ? consoleText.split('\n') : []).forEach((line) => log(line, pfx)); logIndex += consoleText.length; const [finished, nFailedStr] = consoleText.match(finishedRegex) || [];