"Fossies" - the Fresh Open Source Software Archive 
Member "angular-cli-15.2.4/tests/legacy-cli/e2e/tests/commands/add/add-material.ts" (16 Mar 2023, 1098 Bytes) of package /linux/www/angular-cli-15.2.4.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) TypeScript source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
1 import { assertIsError } from '../../../utils/utils';
2 import { expectFileToMatch, rimraf } from '../../../utils/fs';
3 import { uninstallPackage } from '../../../utils/packages';
4 import { ng } from '../../../utils/process';
5 import { isPrereleaseCli } from '../../../utils/project';
6
7 export default async function () {
8 // forcibly remove in case another test doesn't clean itself up
9 await rimraf('node_modules/@angular/material');
10
11 const tag = (await isPrereleaseCli()) ? '@next' : '';
12
13 try {
14 await ng('add', `@angular/material${tag}`, '--unknown', '--skip-confirmation');
15 } catch (error) {
16 assertIsError(error);
17 if (!(error as Error).message.includes(`Unknown option: '--unknown'`)) {
18 throw error;
19 }
20 }
21
22 await ng(
23 'add',
24 `@angular/material${tag}`,
25 '--theme',
26 'custom',
27 '--verbose',
28 '--skip-confirmation',
29 );
30 await expectFileToMatch('package.json', /@angular\/material/);
31
32 // Clean up existing cdk package
33 // Not doing so can cause adding material to fail if an incompatible cdk is present
34 await uninstallPackage('@angular/cdk');
35 }