@@ -3,7 +3,7 @@ import { execSync } from 'child_process';
3
3
import { valid as validSemVer } from 'semver' ;
4
4
import { rimraf } from '../../utils/fs' ;
5
5
import { getActivePackageManager } from '../../utils/packages' ;
6
- import { ng , npm } from '../../utils/process' ;
6
+ import { execWithEnv , ng , npm } from '../../utils/process' ;
7
7
import { isPrereleaseCli } from '../../utils/project' ;
8
8
import { expectToFail } from '../../utils/utils' ;
9
9
@@ -58,10 +58,12 @@ export default async function () {
58
58
await npm ( 'install' , '--global' , '[email protected] ' ) ;
59
59
60
60
// Ensure `ng add` shows npm warning
61
- // The below command will fail with the below due to incorrect peerDeps
62
- const { message : stderrAdd } = await expectToFail ( ( ) =>
63
- ng ( 'add' , '@angular/localize' , '--skip-confirmation' ) ,
61
+ const { stderr : stderrAdd } = await execWithEnv (
62
+ 'ng' ,
63
+ [ 'add' , '@angular/localize' , '--skip-confirmation' ] ,
64
+ { ...process . env , 'NPM_CONFIG_legacy_peer_deps' : 'true' } ,
64
65
) ;
66
+
65
67
if ( ! stderrAdd . includes ( warningText ) ) {
66
68
throw new Error ( 'ng add expected to show npm version warning.' ) ;
67
69
}
0 commit comments