99 logger ,
1010 shouldLog ,
1111 getLabels ,
12+ getSymbols ,
1213} from '../logger.js' ;
1314import { isUnicodeSupported } from '../isUnicodeSupported.js' ;
1415
@@ -72,6 +73,7 @@ describe('lib/logger', () => {
7273 expect ( labels . warning ) . toBe ( '⚠ WARNING' ) ;
7374 expect ( labels . error ) . toBe ( '✖ ERROR' ) ;
7475 expect ( labels . info ) . toBe ( 'ℹ INFO' ) ;
76+ expect ( labels . debug ) . toBe ( '⚙ DEBUG' ) ;
7577 } ) ;
7678
7779 it ( 'returns ASCII labels when unicode is not supported' , ( ) => {
@@ -82,6 +84,41 @@ describe('lib/logger', () => {
8284 expect ( labels . warning ) . toBe ( '[WARNING]' ) ;
8385 expect ( labels . error ) . toBe ( '[ERROR]' ) ;
8486 expect ( labels . info ) . toBe ( '[INFO]' ) ;
87+ expect ( labels . debug ) . toBe ( '[DEBUG]' ) ;
88+ } ) ;
89+ } ) ;
90+
91+ describe ( 'getSymbols()' , ( ) => {
92+ const originalEnv = process . env ;
93+ const originalPlatform = process . platform ;
94+
95+ afterEach ( ( ) => {
96+ process . env = originalEnv ;
97+ Object . defineProperty ( process , 'platform' , {
98+ value : originalPlatform ,
99+ } ) ;
100+ } ) ;
101+
102+ it ( 'returns symbol-only labels when unicode is supported' , ( ) => {
103+ Object . defineProperty ( process , 'platform' , { value : 'darwin' } ) ;
104+ process . env = { ...originalEnv , TERM : 'xterm-256color' } ;
105+ const symbols = getSymbols ( ) ;
106+ expect ( symbols . success ) . toBe ( '✔' ) ;
107+ expect ( symbols . warning ) . toBe ( '⚠' ) ;
108+ expect ( symbols . error ) . toBe ( '✖' ) ;
109+ expect ( symbols . info ) . toBe ( 'ℹ' ) ;
110+ expect ( symbols . debug ) . toBe ( '⚙' ) ;
111+ } ) ;
112+
113+ it ( 'returns ASCII labels when unicode is not supported' , ( ) => {
114+ Object . defineProperty ( process , 'platform' , { value : 'linux' } ) ;
115+ process . env = { ...originalEnv , TERM : 'linux' } ;
116+ const symbols = getSymbols ( ) ;
117+ expect ( symbols . success ) . toBe ( '[SUCCESS]' ) ;
118+ expect ( symbols . warning ) . toBe ( '[WARNING]' ) ;
119+ expect ( symbols . error ) . toBe ( '[ERROR]' ) ;
120+ expect ( symbols . info ) . toBe ( '[INFO]' ) ;
121+ expect ( symbols . debug ) . toBe ( '[DEBUG]' ) ;
85122 } ) ;
86123 } ) ;
87124
0 commit comments