-
Notifications
You must be signed in to change notification settings - Fork 12k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(@angular/cli): improve environment variables clean up during E2E's
(cherry picked from commit 99bd478)
- Loading branch information
1 parent
eaa2378
commit ec79ab1
Showing
6 changed files
with
61 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,26 @@ | ||
import { expectFileNotToExist, expectFileToExist } from '../../../utils/fs'; | ||
import { getActivePackageManager } from '../../../utils/packages'; | ||
import { git, ng } from '../../../utils/process'; | ||
import { | ||
createNpmConfigForAuthentication, | ||
setNpmEnvVarsForAuthentication, | ||
} from '../../../utils/registry'; | ||
|
||
export default async function () { | ||
const packageManager = getActivePackageManager(); | ||
// Yarn also supports NPM_CONFIG env variables. | ||
// https://classic.yarnpkg.com/en/docs/envvars/ | ||
|
||
if (packageManager === 'npm') { | ||
const originalEnvironment = { ...process.env }; | ||
try { | ||
const command = ['add', '@angular/pwa', '--skip-confirmation']; | ||
const command = ['add', '@angular/pwa', '--skip-confirmation']; | ||
|
||
// Environment variables only | ||
await expectFileNotToExist('src/manifest.webmanifest'); | ||
setNpmEnvVarsForAuthentication(); | ||
await ng(...command); | ||
await expectFileToExist('src/manifest.webmanifest'); | ||
await git('clean', '-dxf'); | ||
// Environment variables only | ||
await expectFileNotToExist('src/manifest.webmanifest'); | ||
setNpmEnvVarsForAuthentication(); | ||
await ng(...command); | ||
await expectFileToExist('src/manifest.webmanifest'); | ||
await git('clean', '-dxf'); | ||
|
||
// Mix of config file and env vars works | ||
await expectFileNotToExist('src/manifest.webmanifest'); | ||
await createNpmConfigForAuthentication(false, true); | ||
await ng(...command); | ||
await expectFileToExist('src/manifest.webmanifest'); | ||
} finally { | ||
process.env = originalEnvironment; | ||
} | ||
} | ||
// Mix of config file and env vars works | ||
await expectFileNotToExist('src/manifest.webmanifest'); | ||
await createNpmConfigForAuthentication(false, true); | ||
await ng(...command); | ||
await expectFileToExist('src/manifest.webmanifest'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters