@@ -114,20 +114,6 @@ function createCompiler(webpack, config, appName, urls, useYarn, useTypeScript,
114114 process . exit ( 1 ) ;
115115 }
116116
117- // You can safely remove this after ejecting.
118- // We only use this block for testing of Create React App itself:
119- const isSmokeTest = process . argv . some ( arg => arg . indexOf ( '--smoke-test' ) > - 1 ) ;
120- if ( isSmokeTest ) {
121- compiler . hooks . failed . tap ( 'smokeTest' , ( ) => process . exit ( 1 ) ) ;
122- compiler . hooks . done . tap ( 'smokeTest' , stats => {
123- if ( stats . hasErrors ( ) || stats . hasWarnings ( ) ) {
124- process . exit ( 1 ) ;
125- } else {
126- process . exit ( 0 ) ;
127- }
128- } ) ;
129- }
130-
131117 // "invalid" event fires when you have changed a file, and Webpack is
132118 // recompiling a bundle. WebpackDevServer takes care to pause serving the
133119 // bundle, so if you refresh, it'll wait instead of serving the old one.
@@ -240,6 +226,25 @@ function createCompiler(webpack, config, appName, urls, useYarn, useTypeScript,
240226 ) ;
241227 }
242228 } ) ;
229+
230+ // You can safely remove this after ejecting.
231+ // We only use this block for testing of Create React App itself:
232+ const isSmokeTest = process . argv . some ( arg => arg . indexOf ( '--smoke-test' ) > - 1 ) ;
233+ if ( isSmokeTest ) {
234+ compiler . hooks . failed . tap ( 'smokeTest' , async ( ) => {
235+ await tsMessagesPromise ;
236+ process . exit ( 1 )
237+ } ) ;
238+ compiler . hooks . done . tap ( 'smokeTest' , async stats => {
239+ await tsMessagesPromise ;
240+ if ( stats . hasErrors ( ) || stats . hasWarnings ( ) ) {
241+ process . exit ( 1 ) ;
242+ } else {
243+ process . exit ( 0 ) ;
244+ }
245+ } ) ;
246+ }
247+
243248 return compiler ;
244249}
245250
0 commit comments