Skip to content

Commit 6d03c37

Browse files
committed
Clean up output a bit more
1 parent 828c859 commit 6d03c37

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/lib/patch.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,20 @@ import chalk from 'chalk';
22

33
let { write } = process.stdout;
44
process.stdout.write = msg => {
5+
// Strip + prettify console forwarded output:
56
let matches = msg.match(/^LOG ([A-Z]+): ([\s\S]*)$/);
67
if (matches) {
78
msg = chalk.bgBlueBright.white(' '+matches[1]+': ') + ' ' + chalk.blue(matches[2]);
89
}
10+
11+
// Strip browser prefix from the output since there's only one:
12+
if (msg.match(/^[\n\s]*HeadlessChrome/)) {
13+
let color = /\bSUCCESS\b/.test(msg) ? 'greenBright' : 'magenta';
14+
msg = chalk[color](msg.replace(/^[\n\s]*.*?: /g, ''));
15+
}
16+
17+
// Ignore total output since we only have one browser:
18+
if (msg.match(/\u001b\[32mTOTAL: /)) return;
19+
920
return write.call(process.stdout, msg);
1021
};

0 commit comments

Comments
 (0)