Skip to content

Commit 4887213

Browse files
GiovanniRafaelGSS
Giovanni
authored andcommitted
test_runner: added colors to dot reporter
PR-URL: #53450 Fixes: #51770 Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Chemi Atlow <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent bfbed0a commit 4887213

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

lib/internal/test_runner/reporter/dot.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ module.exports = async function* dot(source) {
1212
const failedTests = [];
1313
for await (const { type, data } of source) {
1414
if (type === 'test:pass') {
15-
yield '.';
15+
yield `${colors.green}.${colors.clear}`;
1616
}
1717
if (type === 'test:fail') {
18-
yield 'X';
18+
yield `${colors.red}X${colors.clear}`;
1919
ArrayPrototypePush(failedTests, data);
2020
}
2121
if ((type === 'test:fail' || type === 'test:pass') && ++count === columns) {

test/fixtures/test-runner/output/dot_output_custom_columns.js

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
// Flags: --test-reporter=dot
22
'use strict';
33
process.stdout.columns = 30;
4+
process.env.FORCE_COLOR = '1';
5+
delete process.env.NODE_DISABLE_COLORS;
6+
delete process.env.NO_COLOR;
47

58
const test = require('node:test');
69
const { setTimeout } = require('timers/promises');
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
..............................
2-
.........................................
3-
.............................
1+
[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c
2+
[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c
3+
[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c[32m.c

0 commit comments

Comments
 (0)