Skip to content

Commit eddff4f

Browse files
clydinalan-agius4
authored andcommitted
test(@angular/cli): cleanup CDK in add material E2E test
Adding material to a project can fail if an incompatible version of the CDK is already present in the project. This change adjusts the E2E test to include extra package cleanup between test cases.
1 parent 4887f59 commit eddff4f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tests/legacy-cli/e2e/tests/commands/add/add-material.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { expectFileToMatch, rimraf } from '../../../utils/fs';
2+
import { uninstallPackage } from '../../../utils/packages';
23
import { ng } from '../../../utils/process';
34
import { isPrereleaseCli } from '../../../utils/project';
45

@@ -25,6 +26,10 @@ export default async function () {
2526
throw new Error('Installation was not skipped');
2627
}
2728

29+
// Clean up existing cdk package
30+
// Not doing so can cause adding material to fail if an incompatible cdk is present
31+
await uninstallPackage('@angular/cdk');
32+
2833
const output2 = await ng('add', '@angular/material@latest');
2934
if (output2.stdout.includes('Skipping installation: Package already installed')) {
3035
throw new Error('Installation should not have been skipped');

0 commit comments

Comments
 (0)