File tree Expand file tree Collapse file tree 1 file changed +23
-13
lines changed Expand file tree Collapse file tree 1 file changed +23
-13
lines changed Original file line number Diff line number Diff line change @@ -65,21 +65,31 @@ function runTests() {
65
65
console . warn ( `input.js does not exist in ${ testDir } ` ) ;
66
66
} else {
67
67
console . log ( `testing ${ file } ` ) ;
68
+
68
69
// note existsSync test already ensure that it is a directory
69
- cp . exec (
70
- `node input.js` ,
71
- { cwd : testDir , encoding : "utf8" } ,
72
- function ( error , stdout , stderr ) {
73
- console . log ( stdout ) ;
74
-
75
- if ( error !== null ) {
76
- console . log ( `❌ error in ${ file } with stderr:\n` , stderr ) ;
77
- throw error ;
78
- } else {
79
- console . log ( "✅ success in" , file ) ;
80
- }
70
+ let p = cp . spawn ( `node` , [ "input.js" ] , { cwd : testDir } ) ;
71
+
72
+ p . stdout
73
+ . setEncoding ( "utf8" )
74
+ . on ( "data" , line => {
75
+ console . log ( line ) ;
76
+ } ) ;
77
+
78
+ let error = '' ;
79
+ p . stderr
80
+ . setEncoding ( "utf8" )
81
+ . on ( "data" , line => {
82
+ error += line + "\n" ;
83
+ } ) ;
84
+
85
+ p . on ( "close" , ( ) => {
86
+ if ( error ) {
87
+ console . log ( `❌ error in ${ file } with stderr:\n` , error ) ;
88
+ throw new Error ( error ) ;
89
+ } else {
90
+ console . log ( "✅ success in" , file ) ;
81
91
}
82
- ) ;
92
+ } ) ;
83
93
}
84
94
} ) ;
85
95
}
You can’t perform that action at this time.
0 commit comments