import * as colors from 'colors' ; import { AnsiEscape } from '../AnsiEscape' ; describe ( 'AnsiEscape' , ( ) => { let initialColorsEnabled ; beforeAll ( ( ) => { initialColorsEnabled = colors . enabled ; colors . enable ( ) ; } ) ; afterAll ( ( ) => { if ( ! initialColorsEnabled ) { colors . disable ( ) ; } } ) ; test ( 'calls removeCodes() successfully' , ( ) => { const coloredInput = colors . rainbow ( 'Hello, world!' ) ; const decoloredInput = AnsiEscape . removeCodes ( coloredInput ) ; expect ( coloredInput ) . not . toBe ( decoloredInput ) ; expect ( decoloredInput ) . toBe ( 'Hello, world!' ) ; } ) ; } ) ;