Skip to content

Commit 6c19f26

Browse files
committed
test: always install a compatible version of @angular/material-moment-adapter
When not install a compatible version tests can fail due example https://app.circleci.com/pipelines/github/angular/angular-cli/23342/workflows/77ac48f1-1445-4722-9294-7841afc0b2cc/jobs/309894
1 parent 7ce88c7 commit 6c19f26

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

tests/legacy-cli/e2e/tests/build/material.ts

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { getGlobalVariable } from '../../utils/env';
2-
import { replaceInFile } from '../../utils/fs';
2+
import { readFile, replaceInFile } from '../../utils/fs';
33
import { installPackage, installWorkspacePackages } from '../../utils/packages';
44
import { ng } from '../../utils/process';
55
import { isPrereleaseCli, updateJsonFile } from '../../utils/project';
66

77
const snapshots = require('../../ng-snapshot/package.json');
88

99
export default async function () {
10-
const tag = (await isPrereleaseCli()) ? '@next' : '';
10+
let tag = (await isPrereleaseCli()) ? '@next' : '';
1111
await ng('add', `@angular/material${tag}`, '--skip-confirmation');
1212

1313
const isSnapshotBuild = getGlobalVariable('argv')['ng-snapshots'];
@@ -25,9 +25,14 @@ export default async function () {
2525
dependencies['@angular/material-moment-adapter'] =
2626
snapshots.dependencies['@angular/material-moment-adapter'];
2727
});
28-
2928
await installWorkspacePackages();
3029
} else {
30+
if (!tag) {
31+
const installedMaterialVersion = JSON.parse(await readFile('package.json'))['dependencies'][
32+
'angular/material'
33+
];
34+
tag = `@${installedMaterialVersion}`;
35+
}
3136
await installPackage(`@angular/material-moment-adapter${tag}`);
3237
}
3338

0 commit comments

Comments
 (0)