-
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): extract version specifier e2e test
(cherry picked from commit d081974)
- Loading branch information
1 parent
0068783
commit b70116e
Showing
3 changed files
with
48 additions
and
31 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 |
---|---|---|
|
@@ -21,27 +21,7 @@ export default async function () { | |
await ng('add', `@angular/material${tag}`, '--theme', 'custom', '--verbose'); | ||
await expectFileToMatch('package.json', /@angular\/material/); | ||
|
||
const output1 = await ng('add', '@angular/material'); | ||
if (!output1.stdout.includes('Skipping installation: Package already installed')) { | ||
throw new Error('Installation was not skipped'); | ||
} | ||
|
||
// Clean up existing cdk package | ||
// Not doing so can cause adding material to fail if an incompatible cdk is present | ||
await uninstallPackage('@angular/cdk'); | ||
|
||
const output2 = await ng('add', '@angular/material@latest'); | ||
if (output2.stdout.includes('Skipping installation: Package already installed')) { | ||
throw new Error('Installation should not have been skipped'); | ||
} | ||
|
||
const output3 = await ng('add', '@angular/[email protected]'); | ||
if (output3.stdout.includes('Skipping installation: Package already installed')) { | ||
throw new Error('Installation should not have been skipped'); | ||
} | ||
|
||
const output4 = await ng('add', '@angular/material@8'); | ||
if (!output4.stdout.includes('Skipping installation: Package already installed')) { | ||
throw new Error('Installation was not skipped'); | ||
} | ||
} |
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
37 changes: 37 additions & 0 deletions
37
tests/legacy-cli/e2e/tests/commands/add/version-specifier.ts
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { expectFileToMatch, rimraf } from '../../../utils/fs'; | ||
import { uninstallPackage } from '../../../utils/packages'; | ||
import { ng } from '../../../utils/process'; | ||
import { isPrereleaseCli } from '../../../utils/project'; | ||
|
||
|
||
export default async function () { | ||
// forcibly remove in case another test doesn't clean itself up. | ||
await rimraf('node_modules/@angular/localize'); | ||
|
||
const tag = await isPrereleaseCli() ? '@next' : ''; | ||
|
||
await ng('add', `@angular/localize${tag}`); | ||
await expectFileToMatch('package.json', /@angular\/localize/); | ||
|
||
const output1 = await ng('add', '@angular/localize'); | ||
if (!output1.stdout.includes('Skipping installation: Package already installed')) { | ||
throw new Error('Installation was not skipped'); | ||
} | ||
|
||
const output2 = await ng('add', '@angular/localize@latest'); | ||
if (output2.stdout.includes('Skipping installation: Package already installed')) { | ||
throw new Error('Installation should not have been skipped'); | ||
} | ||
|
||
const output3 = await ng('add', '@angular/[email protected]'); | ||
if (output3.stdout.includes('Skipping installation: Package already installed')) { | ||
throw new Error('Installation should not have been skipped'); | ||
} | ||
|
||
const output4 = await ng('add', '@angular/localize@10'); | ||
if (!output4.stdout.includes('Skipping installation: Package already installed')) { | ||
throw new Error('Installation was not skipped'); | ||
} | ||
|
||
await uninstallPackage('@angular/localize'); | ||
} |