File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed
Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -33,9 +33,8 @@ describe('[Logging]', () => {
3333 }
3434 } )
3535
36- // This test breaks for no obvious reason and we don't run it in CI anyway.
37- // Running the client confirms that logging is using correct color schemes.
38- it . skip ( 'should colorize key=value pairs' , ( ) => {
36+ // must be run with `FORCE_COLOR='1' npx vitest test/logging.spec.ts`
37+ it . skipIf ( process . env . FORCE_COLOR !== '1' ) ( 'should colorize key=value pairs' , ( ) => {
3938 if ( process . env . GITHUB_ACTION !== undefined ) {
4039 assert . isTrue ( true , 'no color functionality in ci' )
4140 return
@@ -44,9 +43,15 @@ describe('[Logging]', () => {
4443 level : 'info' ,
4544 message : 'test key=value' ,
4645 } ) as any
47- assert . strictEqual (
48- message ,
49- 'test \x1B[38;2;0;128;0mkey\x1B[39m=value ' , // cspell:disable-line
46+
47+ // matches either ESC[32m (basic green) or ESC[38;2;0;128;0m (true-color green)
48+ function hasGreen ( str : string ) : boolean {
49+ // eslint-disable-next-line
50+ return / \x1B \[ (?: 3 2 | 3 8 ; 2 ; 0 ; 1 2 8 ; 0 ) m / . test ( str )
51+ }
52+
53+ assert . isTrue (
54+ hasGreen ( message ) , // cspell:disable-line
5055 'key=value pairs should be colorized' ,
5156 )
5257 } )
You can’t perform that action at this time.
0 commit comments