File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -8,22 +8,24 @@ const args = ['--interactive'];
88const opts = { cwd : fixtures . path ( 'es-modules' ) } ;
99const child = cp . spawn ( process . execPath , args , opts ) ;
1010
11- let output = '' ;
11+ const outputs = [ ] ;
1212child . stdout . setEncoding ( 'utf8' ) ;
1313child . stdout . on ( 'data' , ( data ) => {
14- output += data ;
14+ outputs . push ( data ) ;
15+ if ( outputs . length === 3 ) {
16+ // All the expected outputs have been received
17+ // so we can close the child process's stdin
18+ child . stdin . end ( ) ;
19+ }
1520} ) ;
1621
1722child . on ( 'exit' , common . mustCall ( ( ) => {
18- const results = output . replace ( / ^ > / mg , '' ) . split ( '\n' ) . slice ( 2 ) ;
19- assert . deepStrictEqual (
23+ const results = outputs [ 2 ] . split ( '\n' ) [ 0 ] ;
24+ assert . strictEqual (
2025 results ,
21- [ '[Module: null prototype] { message: \'A message\' }' , '' ]
26+ '[Module: null prototype] { message: \'A message\' }'
2227 ) ;
2328} ) ) ;
2429
2530child . stdin . write ( 'await import(\'./message.mjs\');\n' ) ;
2631child . stdin . write ( '.exit' ) ;
27- setTimeout ( ( ) => {
28- child . stdin . end ( ) ;
29- } , common . platformTimeout ( 300 ) ) ;
You can’t perform that action at this time.
0 commit comments