@@ -12,11 +12,9 @@ const basicConfigPath = path.resolve(
1212 '../fixtures/cli/webpack.config.js'
1313) ;
1414
15- function runWebackDevServer ( testArgs , configPath ) {
15+ function testBin ( testArgs , configPath ) {
1616 const cwd = process . cwd ( ) ;
1717 const env = process . env . NODE_ENV ;
18- let stdout = '' ;
19- let stderr = '' ;
2018
2119 if ( ! configPath ) {
2220 configPath = basicConfigPath ;
@@ -30,26 +28,7 @@ function runWebackDevServer(testArgs, configPath) {
3028
3129 const args = [ webpackDevServerPath , '--config' , configPath ] . concat ( testArgs ) ;
3230
33- return new Promise ( ( resolve , reject ) => {
34- const child = execa ( 'node' , args , { cwd, env } ) ;
35-
36- child . on ( 'error' , ( error ) => reject ( error ) ) ;
37-
38- child . stdout . on ( 'data' , ( data ) => {
39- stdout += data . toString ( ) ;
40- } ) ;
41-
42- child . stderr . on ( 'data' , ( data ) => {
43- stderr += data . toString ( ) ;
44- } ) ;
45-
46- child . on ( 'close' , ( code ) => {
47- if ( code !== 0 ) {
48- return reject ( stderr ) ;
49- }
50- resolve ( { stdout, stderr, code } ) ;
51- } ) ;
52- } ) ;
31+ return execa ( 'node' , args , { cwd, env, timeout : 10000 } ) ;
5332}
5433
55- module . exports = runWebackDevServer ;
34+ module . exports = testBin ;
0 commit comments