File tree 1 file changed +27
-0
lines changed
1 file changed +27
-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 , wait } from '../../utils/utils' ;
8
+
9
+ const webpackGoodRegEx = / 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
+ return silentExecAndWaitForOutputToMatch ( 'ng' , [ 'serve' , '--poll=10000' ] , webpackGoodRegEx )
13
+ // Wait before editing a file.
14
+ // Editing too soon seems to trigger a rebuild and throw polling out of whack.
15
+ . then ( ( ) => wait ( 2000 ) )
16
+ . then ( ( ) => appendToFile ( 'src/main.ts' , 'console.log(1);' ) )
17
+ . then ( ( ) => waitForAnyProcessOutputToMatch ( webpackGoodRegEx , 12000 ) )
18
+ . then ( ( ) => appendToFile ( 'src/main.ts' , 'console.log(1);' ) )
19
+ // No rebuilds should occur for a while
20
+ . then ( ( ) => expectToFail ( ( ) => waitForAnyProcessOutputToMatch ( webpackGoodRegEx , 6000 ) ) )
21
+ // But a rebuild should happen roughly within the 10 second window.
22
+ . then ( ( ) => waitForAnyProcessOutputToMatch ( webpackGoodRegEx , 12000 ) )
23
+ . then ( ( ) => killAllProcesses ( ) , ( err : any ) => {
24
+ killAllProcesses ( ) ;
25
+ throw err ;
26
+ } ) ;
27
+ }
You can’t perform that action at this time.
0 commit comments