File tree Expand file tree Collapse file tree 4 files changed +29
-12
lines changed
fixtures/test-runner/output Expand file tree Collapse file tree 4 files changed +29
-12
lines changed Original file line number Diff line number Diff line change @@ -24,18 +24,16 @@ module.exports = {
24
24
stream . getColorDepth ( ) > 2 : true ) ;
25
25
} ,
26
26
refresh ( ) {
27
- if ( process . stderr . isTTY ) {
28
- const hasColors = module . exports . shouldColorize ( process . stderr ) ;
29
- module . exports . blue = hasColors ? '\u001b[34m' : '' ;
30
- module . exports . green = hasColors ? '\u001b[32m' : '' ;
31
- module . exports . white = hasColors ? '\u001b[39m' : '' ;
32
- module . exports . yellow = hasColors ? '\u001b[33m' : '' ;
33
- module . exports . red = hasColors ? '\u001b[31m' : '' ;
34
- module . exports . gray = hasColors ? '\u001b[90m' : '' ;
35
- module . exports . clear = hasColors ? '\u001bc' : '' ;
36
- module . exports . reset = hasColors ? '\u001b[0m' : '' ;
37
- module . exports . hasColors = hasColors ;
38
- }
27
+ const hasColors = module . exports . shouldColorize ( process . stderr ) ;
28
+ module . exports . blue = hasColors ? '\u001b[34m' : '' ;
29
+ module . exports . green = hasColors ? '\u001b[32m' : '' ;
30
+ module . exports . white = hasColors ? '\u001b[39m' : '' ;
31
+ module . exports . yellow = hasColors ? '\u001b[33m' : '' ;
32
+ module . exports . red = hasColors ? '\u001b[31m' : '' ;
33
+ module . exports . gray = hasColors ? '\u001b[90m' : '' ;
34
+ module . exports . clear = hasColors ? '\u001bc' : '' ;
35
+ module . exports . reset = hasColors ? '\u001b[0m' : '' ;
36
+ module . exports . hasColors = hasColors ;
39
37
} ,
40
38
} ;
41
39
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+
3
+ process . env . FORCE_COLOR = 1 ;
4
+
5
+ const test = require ( 'node:test' ) ;
6
+ test ( 'passing test' , ( ) => { } ) ;
Original file line number Diff line number Diff line change
1
+ [32m✔ passing test [90m(1.312459ms)[39m[39m
2
+ [34mℹ tests 1[39m
3
+ [34mℹ suites 0[39m
4
+ [34mℹ pass 1[39m
5
+ [34mℹ fail 0[39m
6
+ [34mℹ cancelled 0[39m
7
+ [34mℹ skipped 0[39m
8
+ [34mℹ todo 0[39m
9
+ [34mℹ duration_ms *[39m
Original file line number Diff line number Diff line change @@ -203,6 +203,10 @@ const tests = [
203
203
name : 'test-runner/output/arbitrary-output.js' ,
204
204
flags : [ '--test-reporter=tap' ] ,
205
205
} ,
206
+ {
207
+ name : 'test-runner/output/non-tty-forced-color-output.js' ,
208
+ flags : [ '--test-reporter=spec' ] ,
209
+ } ,
206
210
{
207
211
name : 'test-runner/output/async-test-scheduling.mjs' ,
208
212
flags : [ '--test-reporter=tap' ] ,
You can’t perform that action at this time.
0 commit comments