@@ -12,11 +12,9 @@ const basicConfigPath = path.resolve(
12
12
'../fixtures/cli/webpack.config.js'
13
13
) ;
14
14
15
- function runWebackDevServer ( testArgs , configPath ) {
15
+ function testBin ( testArgs , configPath ) {
16
16
const cwd = process . cwd ( ) ;
17
17
const env = process . env . NODE_ENV ;
18
- let stdout = '' ;
19
- let stderr = '' ;
20
18
21
19
if ( ! configPath ) {
22
20
configPath = basicConfigPath ;
@@ -30,26 +28,7 @@ function runWebackDevServer(testArgs, configPath) {
30
28
31
29
const args = [ webpackDevServerPath , '--config' , configPath ] . concat ( testArgs ) ;
32
30
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 : 2000 } ) ;
53
32
}
54
33
55
- module . exports = runWebackDevServer ;
34
+ module . exports = testBin ;
0 commit comments