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 #292 from TestArmada/fix-bug-wth-steps-not-showing
Browse files Browse the repository at this point in the history
fix bug with successful steps not showing in log
  • Loading branch information
g00dnatur3 authored Sep 11, 2020
2 parents c53c725 + ffc9b82 commit 597c9e6
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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.13",
"version": "11.0.14",
"description": "Massively parallel automated testing",
"main": "src/main",
"directories": {
Expand Down
22 changes: 21 additions & 1 deletion src/util/childProcess.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ const STDOUT_WHITE_LIST = [
"\x1B[1;33mERROR\x1B[0m",
"\x1B[1;32m\x1B[40mWARN\x1B[0m",
"Test Suite",
"✖"
"✖",
"✔"
];

// we slice the VERBOSE nighwatch stdout stream on the purple INFO text that has black background
Expand All @@ -58,6 +59,24 @@ 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("✔")) {
// 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));
}
}
};
lines.forEach(line => processLine(line));
text = buff.join("\n");
}
text = text
.split("\n")
.filter((line) => !_.isEmpty(line.trim()))
Expand All @@ -74,6 +93,7 @@ module.exports = class ChildProcess {
this.emitter = new EventEmitter();
this.emitter.stdout = stdoutFilter;
this.emitter.stderr = handler.stderr;
this.emitter.infoSlicer = infoSlicer;

// pipe the stdout stream into the slicer and then into the filter
this.handler.stdout.pipe(infoSlicer).pipe(stdoutFilter);
Expand Down

0 comments on commit 597c9e6

Please sign in to comment.