Skip to content
This repository has been archived by the owner on Jan 19, 2021. It is now read-only.

Commit

Permalink
Merge pull request #294 from TestArmada/fix-bugs-with-nightwatch-logs
Browse files Browse the repository at this point in the history
fixed bugs with the nightwatch logs not showing up correctly
  • Loading branch information
g00dnatur3 authored Sep 11, 2020
2 parents 597c9e6 + cf7ae89 commit 6b8c520
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "testarmada-magellan",
"version": "11.0.14",
"version": "11.0.15",
"description": "Massively parallel automated testing",
"main": "src/main",
"directories": {
Expand Down
18 changes: 8 additions & 10 deletions src/util/childProcess.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ const STDOUT_WHITE_LIST = [
"\x1B[1;32m\x1B[40mWARN\x1B[0m",
"Test Suite",
"✖",
"✔"
"✔",
"Running:",
"OK."
];

// we slice the VERBOSE nighwatch stdout stream on the purple INFO text that has black background
Expand All @@ -59,19 +61,15 @@ module.exports = class ChildProcess {
transform(data, encoding, callback) {
let text = data.toString().trim();
if (text.length > 0 && self.isTextWhiteListed(text)) {
if (!process.env.DEBUG && text.includes("")) {
if (text.includes("✔") || text.includes("Running:") || text.includes("OK.")) {
// for successful chunks we really only want to keep specific lines
const lines = text.split("\n");
const buff = [];
const startsWithTerms = ["Running:", " ✔", "OK."];
const maxLineLength = 512;
const processLine = (line) => {
for (const term of startsWithTerms) {
// line could have an ERROR or WARN tag that is whitelisted we want to keep
if (self.isTextWhiteListed(line) || line.startsWith(term)) {
// limit the length of each line, goal here is to "limit" verbosity
buff.push(line.substring(0, maxLineLength));
}
if (self.isTextWhiteListed(line)) {
// limit the length of each line, goal here is to "limit" verbosity
buff.push(line.substring(0, maxLineLength));
}
};
lines.forEach(line => processLine(line));
Expand All @@ -80,7 +78,7 @@ module.exports = class ChildProcess {
text = text
.split("\n")
.filter((line) => !_.isEmpty(line.trim()))
.map((line) => `${clc.yellowBright(logStamp())} ${line}`)
.map((line) => `\n${clc.yellowBright(logStamp())} ${line}`)
.join("\n");
self.stdout += text + "\n";
self.addErrorMessageContext();
Expand Down

0 comments on commit 6b8c520

Please sign in to comment.