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 #291 from TestArmada/fix-bug-with-stdout-white-list
Browse files Browse the repository at this point in the history
made-whitelist-more-specific
  • Loading branch information
g00dnatur3 authored Sep 1, 2020
2 parents 7c8c597 + 2dd3686 commit c53c725
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 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.12",
"version": "11.0.13",
"description": "Massively parallel automated testing",
"main": "src/main",
"directories": {
Expand Down
7 changes: 6 additions & 1 deletion src/util/childProcess.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@ const ADDED_ERROR_MESSAGE_CONTEXT = "If running on saucelabs, perhaps " +

// if the "this.handler.stdout" stream of the childprocess does not
// include atleast one of these tokens then it will not be included in the "this.stdout"
const STDOUT_WHITE_LIST = ["ERROR", "WARN", "Test Suite", "✖"];
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
const SLICE_ON_TEXT = "\x1B[1;35m\x1B[40mINFO\x1B[0m";
Expand Down
12 changes: 6 additions & 6 deletions test/utils/child_process.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,15 @@ describe('Child process', () => {
cp.teardown();
});

test('should append data to stdout', (done) => {
test('should append data to stdout if contains whitelisted data', (done) => {
const cp = new ChildProcess(newHandler());

cp.handler.stdout.write('WARN fake data');
cp.handler.stdout.end('WARN real data');
const warnTag = '\x1B[1;32m\x1B[40mWARN\x1B[0m'
cp.handler.stdout.end(`${warnTag} sample data`);

// wait for the write to flow thru the slicer and filter transforms
setTimeout(() => {
expect(cp.stdout).toContain('fake data');
expect(cp.stdout).toContain('real data');
expect(cp.stdout).toContain(`${warnTag} sample data`);
done();
}, 0)

Expand All @@ -80,7 +79,8 @@ describe('Child process', () => {
test('should add context to error message', (done) => {
const cp = new ChildProcess(newHandler());

cp.handler.stdout.end('ERROR Connection refused! Is selenium server started?');
const errorTag = '\x1B[1;33mERROR\x1B[0m';
cp.handler.stdout.end(`${errorTag} Connection refused! Is selenium server started?`);

// wait for the write to flow thru the slicer and filter transforms
setTimeout(() => {
Expand Down

0 comments on commit c53c725

Please sign in to comment.