Skip to content

Commit

Permalink
test: fix platform server e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
alan-agius4 authored and vikerman committed Oct 25, 2019
1 parent bf03a73 commit 125847b
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 12 deletions.
1 change: 1 addition & 0 deletions tests/legacy-cli/e2e/ng-snapshot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"@angular/localize": "github:angular/localize-builds#33c7636c27a4f147607cf5a9dbf8cc1f7235da99",
"@angular/platform-browser": "github:angular/platform-browser-builds#ce1e659ca1354adb43047933dcd4197cbd96174f",
"@angular/platform-browser-dynamic": "github:angular/platform-browser-dynamic-builds#d8664790dc89a1d30cf18788479cd5ccb1fb5ee6",
"@angular/platform-server": "github:angular/platform-server-builds#278e7555b936edf9d9292f75e67ba5b233bd285a",
"@angular/router": "github:angular/router-builds#f75458fdef2ef233080332e0a96f4d0cbfad93e9"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default async function () {
await updateJsonFile('package.json', packageJson => {
const dependencies = packageJson['dependencies'];
dependencies['@angular/platform-server'] = getGlobalVariable('argv')['ng-snapshots']
? 'github:angular/platform-server-builds'
? require('../../ng-snapshot/package.json').dependencies['@angular/platform-server']
: readNgVersion();
});

Expand Down
3 changes: 2 additions & 1 deletion tests/legacy-cli/e2e/tests/build/build-app-shell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ export default function() {
let platformServerVersion = readNgVersion();

if (getGlobalVariable('argv')['ng-snapshots']) {
platformServerVersion = 'github:angular/platform-server-builds';
platformServerVersion = require('../../ng-snapshot/package.json')
.dependencies['@angular/platform-server'];
}

return Promise.resolve()
Expand Down
2 changes: 1 addition & 1 deletion tests/legacy-cli/e2e/tests/build/platform-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default async function () {
await updateJsonFile('package.json', packageJson => {
const dependencies = packageJson['dependencies'];
dependencies['@angular/platform-server'] = getGlobalVariable('argv')['ng-snapshots']
? 'github:angular/platform-server-builds'
? require('../../ng-snapshot/package.json').dependencies['@angular/platform-server']
: readNgVersion();
});

Expand Down
28 changes: 19 additions & 9 deletions tests/legacy-cli/e2e/tests/i18n/ivy-localize-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,34 @@ import {
replaceInFile,
writeFile,
} from '../../utils/fs';
import { ng, npm } from '../../utils/process';
import { ng, silentNpm } from '../../utils/process';
import { updateJsonFile } from '../../utils/project';
import { expectToFail } from '../../utils/utils';
import { readNgVersion } from '../../utils/version';

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

export default async function () {
let localizeVersion = '@angular/localize@' + readNgVersion();
if (getGlobalVariable('argv')['ng-snapshots']) {
localizeVersion = require('../../ng-snapshot/package.json').dependencies['@angular/localize'];
}
const isSnapshotBuild = getGlobalVariable('argv')['ng-snapshots'];

await npm('install', `${localizeVersion}`);
await updateJsonFile('package.json', packageJson => {
const dependencies = packageJson['dependencies'];
dependencies['@angular/localize'] = isSnapshotBuild
? snapshots.dependencies['@angular/localize']
: readNgVersion();
});

// Add universal to the project
await ng('add', '@nguniversal/[email protected]');
await ng('add', '@nguniversal/[email protected]', '--skip-install');

if (isSnapshotBuild) {
await updateJsonFile('package.json', packageJson => {
const dependencies = packageJson['dependencies'];
dependencies['@angular/platform-server'] = snapshots.dependencies['@angular/platform-server'];
});
}

await npm('run', 'webdriver-update');
await silentNpm('install');

const serverbaseDir = 'dist/test-project/server';
const serverBuildArgs = ['run', 'test-project:server'];
Expand All @@ -34,7 +45,6 @@ export default async function () {
const langTranslations = [
{ lang: 'en-US', translation: 'Hello i18n!' },
{ lang: 'fr', translation: 'Bonjour i18n!' },
{ lang: 'de', translation: 'Hallo i18n!' },
];

await updateJsonFile('angular.json', workspaceJson => {
Expand Down

0 comments on commit 125847b

Please sign in to comment.