11'use strict' ;
2+
3+ const stripAnsi = require ( 'strip-ansi' ) ;
24const { run } = require ( '../utils/test-utils' ) ;
35const { existsSync, readFile } = require ( 'fs' ) ;
46const { resolve } = require ( 'path' ) ;
@@ -111,8 +113,8 @@ describe('json', () => {
111113 const { exitCode, stderr, stdout } = run ( __dirname , [ '--json' , '--config' , 'logging.config.js' ] ) ;
112114
113115 expect ( exitCode ) . toBe ( 0 ) ;
114- expect ( stderr ) . toContain ( 'Compilation starting' ) ;
115- expect ( stderr ) . toContain ( 'Compilation finished' ) ;
116+ expect ( stderr ) . toContain ( 'Compiler starting... ' ) ;
117+ expect ( stderr ) . toContain ( 'Compiler finished' ) ;
116118 expect ( ( ) => JSON . parse ( stdout ) ) . not . toThrow ( ) ;
117119 expect ( JSON . parse ( stdout ) [ 'hash' ] ) . toBeDefined ( ) ;
118120 } ) ;
@@ -121,9 +123,12 @@ describe('json', () => {
121123 const { exitCode, stderr, stdout } = run ( __dirname , [ '--json' , 'stats.json' , '--config' , 'logging.config.js' ] ) ;
122124
123125 expect ( exitCode ) . toBe ( 0 ) ;
124- expect ( stderr ) . toContain ( 'Compilation starting' ) ;
125- expect ( stderr ) . toContain ( 'Compilation finished' ) ;
126- expect ( stderr ) . toContain ( successMessage ) ;
126+
127+ const pureStderr = stripAnsi ( stderr ) ;
128+
129+ expect ( stderr ) . toContain ( 'Compiler starting...' ) ;
130+ expect ( pureStderr ) . toContain ( 'Compiler finished' ) ;
131+ expect ( pureStderr ) . toContain ( successMessage ) ;
127132 expect ( stdout ) . toBeFalsy ( ) ;
128133 expect ( existsSync ( resolve ( __dirname , './stats.json' ) ) ) . toBeTruthy ( ) ;
129134
0 commit comments