11import assert from 'node:assert' ;
2- import { setTimeout } from 'node:timers/promises' ;
3- import {
4- execAndWaitForOutputToMatch ,
5- ng ,
6- waitForAnyProcessOutputToMatch ,
7- } from '../../utils/process' ;
2+ import { ng , waitForAnyProcessOutputToMatch } from '../../utils/process' ;
83import { installWorkspacePackages , uninstallPackage } from '../../utils/packages' ;
9- import { useSha } from '../../utils/project' ;
4+ import { ngServe , useSha } from '../../utils/project' ;
105import { getGlobalVariable } from '../../utils/env' ;
116import { readFile , writeFile } from '../../utils/fs' ;
12- import { findFreePort } from '../../utils/network' ;
137
148export default async function ( ) {
159 assert (
@@ -27,27 +21,21 @@ export default async function () {
2721 await useSha ( ) ;
2822 await installWorkspacePackages ( ) ;
2923
30- // The Node.js specific module should not be found
31- const port = await findFreePort ( ) ;
32- await execAndWaitForOutputToMatch (
33- 'ng' ,
34- [ 'serve' , '--port' , port . toString ( ) ] ,
35- / A p p l i c a t i o n b u n d l e g e n e r a t i o n c o m p l e t e / ,
36- { CI : '0' , NO_COLOR : 'true' } ,
37- ) ;
24+ const port = await ngServe ( ) ;
3825 await validateResponse ( '/' , / H e l l o , / ) ;
3926
40- const appConfigContentsUpdated = `
41- import { provideAnimationsAsync } from '@angular/platform-browser/animations/async';
42- ${ ( await readFile ( 'src/app/app.config.ts' ) ) . replace ( 'provideRouter(routes),' , 'provideAnimationsAsync(), provideRouter(routes),' ) }
43- ` ;
44-
4527 await Promise . all ( [
4628 waitForAnyProcessOutputToMatch (
4729 / n e w d e p e n d e n c i e s o p t i m i z e d : @ a n g u l a r \/ p l a t f o r m - b r o w s e r \/ a n i m a t i o n s \/ a s y n c / ,
4830 6000 ,
4931 ) ,
50- setTimeout ( 200 ) . then ( ( ) => writeFile ( 'src/app/app.config.ts' , appConfigContentsUpdated ) ) ,
32+ writeFile (
33+ 'src/app/app.config.ts' ,
34+ `
35+ import { provideAnimationsAsync } from '@angular/platform-browser/animations/async';
36+ ${ ( await readFile ( 'src/app/app.config.ts' ) ) . replace ( 'provideRouter(routes),' , 'provideAnimationsAsync(), provideRouter(routes),' ) }
37+ ` ,
38+ ) ,
5139 ] ) ;
5240
5341 // Verify the app still works.
0 commit comments