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

Commit c53c725

Browse files
authored
Merge pull request #291 from TestArmada/fix-bug-with-stdout-white-list
made-whitelist-more-specific
2 parents 7c8c597 + 2dd3686 commit c53c725

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "testarmada-magellan",
3-
"version": "11.0.12",
3+
"version": "11.0.13",
44
"description": "Massively parallel automated testing",
55
"main": "src/main",
66
"directories": {

src/util/childProcess.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,12 @@ const ADDED_ERROR_MESSAGE_CONTEXT = "If running on saucelabs, perhaps " +
2929

3030
// if the "this.handler.stdout" stream of the childprocess does not
3131
// include atleast one of these tokens then it will not be included in the "this.stdout"
32-
const STDOUT_WHITE_LIST = ["ERROR", "WARN", "Test Suite", "✖"];
32+
const STDOUT_WHITE_LIST = [
33+
"\x1B[1;33mERROR\x1B[0m",
34+
"\x1B[1;32m\x1B[40mWARN\x1B[0m",
35+
"Test Suite",
36+
"✖"
37+
];
3338

3439
// we slice the VERBOSE nighwatch stdout stream on the purple INFO text that has black background
3540
const SLICE_ON_TEXT = "\x1B[1;35m\x1B[40mINFO\x1B[0m";

test/utils/child_process.test.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,15 @@ describe('Child process', () => {
6262
cp.teardown();
6363
});
6464

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

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

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

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

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

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

0 commit comments

Comments
 (0)