|
1 | 1 | import { ng } from '../../../utils/process';
|
2 | 2 | import { expectToFail } from '../../../utils/utils';
|
3 | 3 |
|
4 |
| -export default function() { |
5 |
| - return Promise.resolve() |
6 |
| - .then(() => expectToFail(() => ng('config', 'cli.warnings.zzzz'))) |
7 |
| - .then(() => ng('config', 'cli.warnings.versionMismatch' , 'false')) |
8 |
| - .then(() => ng('config', 'cli.warnings.versionMismatch')) |
9 |
| - .then(({ stdout }) => { |
10 |
| - if (!stdout.match(/false/)) { |
11 |
| - throw new Error(`Expected "false", received "${JSON.stringify(stdout)}".`); |
12 |
| - } |
13 |
| - }) |
14 |
| - .then(() => ng('config', 'cli.packageManager' , 'yarn')) |
15 |
| - .then(() => ng('config', 'cli.packageManager')) |
16 |
| - .then(({ stdout }) => { |
17 |
| - if (!stdout.match(/yarn/)) { |
18 |
| - throw new Error(`Expected "yarn", received "${JSON.stringify(stdout)}".`); |
19 |
| - } |
20 |
| - }); |
| 4 | +export default async function () { |
| 5 | + await expectToFail(() => ng('config', 'cli.warnings.zzzz')); |
| 6 | + await ng('config', 'cli.warnings.versionMismatch', 'false'); |
| 7 | + const { stdout } = await ng('config', 'cli.warnings.versionMismatch'); |
| 8 | + if (!stdout.includes('false')) { |
| 9 | + throw new Error(`Expected "false", received "${JSON.stringify(stdout)}".`); |
| 10 | + } |
| 11 | + |
| 12 | + await ng('config', 'cli.packageManager', 'yarn'); |
| 13 | + const { stdout: stdout2 } = await ng('config', 'cli.packageManager'); |
| 14 | + if (!stdout2.includes('yarn')) { |
| 15 | + throw new Error(`Expected "yarn", received "${JSON.stringify(stdout2)}".`); |
| 16 | + } |
| 17 | + |
| 18 | + await ng('config', 'schematics.@schematics/angular:component.style', 'css'); |
| 19 | + const { stdout: stdout3 } = await ng('config', '@schematics/angular:component.style'); |
| 20 | + if (!stdout2.includes('css')) { |
| 21 | + throw new Error(`Expected "css", received "${JSON.stringify(stdout3)}".`); |
| 22 | + } |
| 23 | + |
| 24 | + const { stderr } = await ng('config', 'schematics', 'undefined'); |
| 25 | + if (!stderr.includes('Value cannot be found.')) { |
| 26 | + throw new Error(`Expected "Value cannot be found", received "${JSON.stringify(stderr)}".`); |
| 27 | + } |
21 | 28 | }
|
0 commit comments