1+ import assert from 'node:assert/strict' ;
12import { appendFile } from 'node:fs/promises' ;
23import { expectFileToMatch } from '../../../utils/fs' ;
34import { getActivePackageManager , uninstallPackage } from '../../../utils/packages' ;
@@ -21,24 +22,32 @@ export default async function () {
2122 await expectFileToMatch ( 'package.json' , / @ a n g u l a r \/ l o c a l i z e / ) ;
2223
2324 const output1 = await ng ( 'add' , '@angular/localize' , '--skip-confirmation' ) ;
24- if ( ! output1 . stdout . includes ( 'Skipping installation: Package already installed' ) ) {
25- throw new Error ( 'Installation was not skipped' ) ;
26- }
25+ assert . match (
26+ output1 . stdout ,
27+ / S k i p p i n g i n s t a l l a t i o n : P a c k a g e a l r e a d y i n s t a l l e d / ,
28+ 'Installation was not skipped' ,
29+ ) ;
2730
2831 const output2 = await ng ( 'add' , '@angular/localize@latest' , '--skip-confirmation' ) ;
29- if ( output2 . stdout . includes ( 'Skipping installation: Package already installed' ) ) {
30- throw new Error ( 'Installation should not have been skipped' ) ;
31- }
32+ assert . doesNotMatch (
33+ output2 . stdout ,
34+ / S k i p p i n g i n s t a l l a t i o n : P a c k a g e a l r e a d y i n s t a l l e d / ,
35+ 'Installation should not have been skipped' ,
36+ ) ;
3237
3338 const output3 = await ng ( 'add' , '@angular/localize@19.1.0' , '--skip-confirmation' ) ;
34- if ( output3 . stdout . includes ( 'Skipping installation: Package already installed' ) ) {
35- throw new Error ( 'Installation should not have been skipped' ) ;
36- }
39+ assert . doesNotMatch (
40+ output3 . stdout ,
41+ / S k i p p i n g i n s t a l l a t i o n : P a c k a g e a l r e a d y i n s t a l l e d / ,
42+ 'Installation should not have been skipped' ,
43+ ) ;
3744
3845 const output4 = await ng ( 'add' , '@angular/localize@19' , '--skip-confirmation' ) ;
39- if ( ! output4 . stdout . includes ( 'Skipping installation: Package already installed' ) ) {
40- throw new Error ( 'Installation was not skipped' ) ;
41- }
46+ assert . match (
47+ output4 . stdout ,
48+ / S k i p p i n g i n s t a l l a t i o n : P a c k a g e a l r e a d y i n s t a l l e d / ,
49+ 'Installation was not skipped' ,
50+ ) ;
4251
4352 await uninstallPackage ( '@angular/localize' ) ;
4453}
0 commit comments