|
1 | | -import { ng, npm } from '../../utils/process'; |
2 | | -import { expectFileToMatch, appendToFile } from '../../utils/fs'; |
3 | 1 | import { getGlobalVariable } from '../../utils/env'; |
4 | | -import { expectToFail } from '../../utils/utils'; |
| 2 | +import { appendToFile, expectFileToMatch } from '../../utils/fs'; |
| 3 | +import { ng, silentNpm } from '../../utils/process'; |
5 | 4 | import { updateJsonFile } from '../../utils/project'; |
6 | 5 | import { readNgVersion } from '../../utils/version'; |
7 | 6 |
|
8 | 7 |
|
9 | | -export default function () { |
| 8 | +export default async function () { |
10 | 9 | // Skip this test in Angular 2/4. |
11 | 10 | if (getGlobalVariable('argv').ng2 || getGlobalVariable('argv').ng4) { |
12 | | - return Promise.resolve(); |
| 11 | + return; |
13 | 12 | } |
14 | 13 |
|
15 | | - let platformServerVersion = readNgVersion(); |
| 14 | + await appendToFile('src/app/app.component.html', '<router-outlet></router-outlet>'); |
| 15 | + await ng('generate', 'appShell', '--client-project', 'test-project'); |
| 16 | + await updateJsonFile('package.json', packageJson => { |
| 17 | + const dependencies = packageJson['dependencies']; |
| 18 | + dependencies['@angular/platform-server'] = getGlobalVariable('argv')['ng-snapshots'] |
| 19 | + ? 'github:angular/platform-server-builds' |
| 20 | + : readNgVersion(); |
| 21 | + }); |
16 | 22 |
|
17 | | - if (getGlobalVariable('argv')['ng-snapshots']) { |
18 | | - platformServerVersion = 'github:angular/platform-server-builds'; |
19 | | - } |
20 | | - |
21 | | - |
22 | | - return Promise.resolve() |
23 | | - .then(() => expectToFail(() => { |
24 | | - return ng('generate', 'appShell', '--universal-app', 'universal'); |
25 | | - }) |
26 | | - .then(() => appendToFile('src/app/app.component.html', '<router-outlet></router-outlet>')) |
27 | | - .then(() => ng('generate', 'appShell', '--universal-app', 'universal')) |
28 | | - .then(() => updateJsonFile('package.json', packageJson => { |
29 | | - const dependencies = packageJson['dependencies']; |
30 | | - dependencies['@angular/platform-server'] = platformServerVersion; |
31 | | - }) |
32 | | - .then(() => npm('install')) |
33 | | - .then(() => ng('build', '--optimization')) |
34 | | - .then(() => expectFileToMatch('dist/test-project/index.html', /app-shell works!/)) |
35 | | - .then(() => ng('build', '--optimization', '--skip-app-shell')) |
36 | | - .then(() => expectToFail(() => expectFileToMatch('dist/test-project/index.html', /app-shell works!/))); |
| 23 | + await silentNpm('install'); |
| 24 | + await ng('run', 'test-project:app-shell'); |
| 25 | + await expectFileToMatch('dist/test-project/index.html', /app-shell works!/); |
37 | 26 | } |
0 commit comments