Skip to content

Commit

Permalink
test: always install a compatible version of `@angular/material-momen…
Browse files Browse the repository at this point in the history
…t-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

(cherry picked from commit 6c19f26)
  • Loading branch information
alan-agius4 authored and clydin committed Jun 10, 2022
1 parent c7f994f commit d27fc7e
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions tests/legacy-cli/e2e/tests/build/material.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { getGlobalVariable } from '../../utils/env';
import { replaceInFile } from '../../utils/fs';
import { readFile, replaceInFile } from '../../utils/fs';
import { installPackage, installWorkspacePackages } from '../../utils/packages';
import { ng } from '../../utils/process';
import { isPrereleaseCli, updateJsonFile } from '../../utils/project';

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

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

const isSnapshotBuild = getGlobalVariable('argv')['ng-snapshots'];
Expand All @@ -25,10 +25,15 @@ export default async function () {
dependencies['@angular/material-moment-adapter'] =
snapshots.dependencies['@angular/material-moment-adapter'];
});

await installWorkspacePackages();
} else {
await installPackage('@angular/material-moment-adapter');
if (!tag) {
const installedMaterialVersion = JSON.parse(await readFile('package.json'))['dependencies'][
'@angular/material'
];
tag = `@${installedMaterialVersion}`;
}
await installPackage(`@angular/material-moment-adapter${tag}`);
}

await installPackage('moment');
Expand Down

0 comments on commit d27fc7e

Please sign in to comment.