Skip to content

Commit a219d49

Browse files
alan-agius4Keen Yee Liau
authored andcommitted
test: enable app-shell e2e test
1 parent ec8fb37 commit a219d49

File tree

2 files changed

+15
-27
lines changed

2 files changed

+15
-27
lines changed
Lines changed: 15 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,26 @@
1-
import { ng, npm } from '../../utils/process';
2-
import { expectFileToMatch, appendToFile } from '../../utils/fs';
31
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';
54
import { updateJsonFile } from '../../utils/project';
65
import { readNgVersion } from '../../utils/version';
76

87

9-
export default function () {
8+
export default async function () {
109
// Skip this test in Angular 2/4.
1110
if (getGlobalVariable('argv').ng2 || getGlobalVariable('argv').ng4) {
12-
return Promise.resolve();
11+
return;
1312
}
1413

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+
});
1622

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!/);
3726
}

tests/legacy-cli/e2e_runner.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ let allTests = glob
8080

8181
// TODO: either update or remove these tests.
8282
allTests = allTests
83-
.filter(name => !name.endsWith('/build-app-shell-with-schematic.ts'))
8483
// IS this test still valid? \/
8584
.filter(name => !name.endsWith('/module-id.ts'))
8685
// Do we want to support this?

0 commit comments

Comments
 (0)