Skip to content

Commit 4887213

Browse files
GiovanniRafaelGSS
authored andcommitted
test_runner: added colors to dot reporter
PR-URL: #53450Fixes: #51770 Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Chemi Atlow <chemi@atlow.co.il> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent bfbed0a commit 4887213

3 files changed

Lines changed: 8 additions & 5 deletions

File tree

‎lib/internal/test_runner/reporter/dot.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ module.exports = async function* dot(source) {
1212
constfailedTests=[];
1313
forawait(const{ type, data }ofsource){
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‎

Lines changed: 3 additions & 0 deletions
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+
deleteprocess.env.NODE_DISABLE_COLORS;
6+
deleteprocess.env.NO_COLOR;
47

58
consttest=require('node:test');
69
const{ setTimeout }=require('timers/promises');
Lines changed: 3 additions & 3 deletions
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)