Skip to content

Commit 2fd30f8

Browse files
committed
test(@angular-devkit/build-angular): refactor platform server test to use universal schematic
Using `@nguniversal/express-engine` requires a lot of maintenance and manual updates to set the correct versions of `@angular-devkit/architect` and `'@angular-devkit/core`. This is because `@nguniversal/express-engine` can rely on different versions of this packages from the local built versions which would cause package installations failure. (cherry picked from commit b5218d4)
1 parent 52a320e commit 2fd30f8

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

tests/legacy-cli/e2e/tests/build/platform-server.ts

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,17 @@
11
import { normalize } from 'path';
22
import { getGlobalVariable } from '../../utils/env';
3-
import { appendToFile, expectFileToMatch, writeFile } from '../../utils/fs';
3+
import { appendToFile, expectFileToMatch, replaceInFile, writeFile } from '../../utils/fs';
44
import { installPackage } from '../../utils/packages';
5-
import { exec, ng, silentNpm } from '../../utils/process';
6-
import { isPrereleaseCli, updateJsonFile } from '../../utils/project';
5+
import { exec, ng } from '../../utils/process';
6+
import { updateJsonFile } from '../../utils/project';
77

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

1010
export default async function () {
1111
const argv = getGlobalVariable('argv');
1212
const veEnabled = argv['ve'];
13-
const tag = (await isPrereleaseCli()) ? 'next' : 'latest';
1413

15-
// @nguniversal/express-engine currently relies on ^0.1100.0-rc.2 of @angular-devkit/architect
16-
// which is not present in the local package registry and not semver compatible with ^11.0.0-next.7
17-
const { stdout: stdout1 } = await silentNpm('pack', '@angular-devkit/[email protected]', '--registry=https://registry.npmjs.org');
18-
await silentNpm('publish', stdout1.trim(), '--registry=http://localhost:4873', '--tag=minor');
19-
20-
// @nguniversal/express-engine currently relies on ^11.0.0-rc.2 of @angular-devkit/core
21-
// which is not present in the local package registry and not semver compatible prerelease version of ^11.0.0-next.7
22-
const { stdout: stdout2 } = await silentNpm('pack', '@angular-devkit/[email protected]', '--registry=https://registry.npmjs.org');
23-
await silentNpm('publish', stdout2.trim(), '--registry=http://localhost:4873', '--tag=minor');
24-
25-
await ng('add', `@nguniversal/express-engine@${tag}`);
14+
await ng('generate', 'universal', '--client-project', 'test-project');
2615

2716
const isSnapshotBuild = getGlobalVariable('argv')['ng-snapshots'];
2817
if (isSnapshotBuild) {
@@ -82,6 +71,8 @@ export default async function () {
8271
);
8372
}
8473

74+
await replaceInFile('tsconfig.server.json', 'src/main.server.ts', 'server.ts');
75+
await replaceInFile('angular.json', 'src/main.server.ts', 'server.ts');
8576

8677
await ng('run', 'test-project:server:production', '--optimization', 'false');
8778

0 commit comments

Comments
 (0)