File tree 1 file changed +29
-0
lines changed
1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change
1
+ import {
2
+ killAllProcesses ,
3
+ waitForAnyProcessOutputToMatch ,
4
+ silentExecAndWaitForOutputToMatch
5
+ } from '../../utils/process' ;
6
+ import { appendToFile } from '../../utils/fs' ;
7
+ import { expectToFail } from '../../utils/utils' ;
8
+
9
+ const webpackGoodRegEx = / w e b p a c k : b u n d l e i s n o w V A L I D | w e b p a c k : C o m p i l e d s u c c e s s f u l l y ./ ;
10
+
11
+ export default function ( ) {
12
+ if ( process . platform . startsWith ( 'win' ) ) {
13
+ return Promise . resolve ( ) ;
14
+ }
15
+
16
+ return silentExecAndWaitForOutputToMatch ( 'ng' , [ 'serve' , '--poll=10000' ] , webpackGoodRegEx )
17
+ // Wait for the first rebuild.
18
+ . then ( ( ) => appendToFile ( 'src/main.ts' , 'console.log(1);' ) )
19
+ . then ( ( ) => waitForAnyProcessOutputToMatch ( webpackGoodRegEx , 12000 ) )
20
+ . then ( ( ) => appendToFile ( 'src/main.ts' , 'console.log(1);' ) )
21
+ // No rebuilds should occur for a while
22
+ . then ( ( ) => expectToFail ( ( ) => waitForAnyProcessOutputToMatch ( webpackGoodRegEx , 5000 ) ) )
23
+ // But a rebuild should happen roughly within the 10 second window.
24
+ . then ( ( ) => waitForAnyProcessOutputToMatch ( webpackGoodRegEx , 10000 ) )
25
+ . then ( ( ) => killAllProcesses ( ) , ( err : any ) => {
26
+ killAllProcesses ( ) ;
27
+ throw err ;
28
+ } ) ;
29
+ }
You can’t perform that action at this time.
0 commit comments