diff --git a/tests/legacy-cli/e2e/tests/build/aot/aot-i18n.ts b/tests/legacy-cli/e2e/tests/build/aot/aot-i18n.ts
index 2178f822f892..93f029ba4cb9 100644
--- a/tests/legacy-cli/e2e/tests/build/aot/aot-i18n.ts
+++ b/tests/legacy-cli/e2e/tests/build/aot/aot-i18n.ts
@@ -2,9 +2,10 @@ import * as express from 'express';
import { resolve } from 'path';
import { getGlobalVariable } from '../../../utils/env';
import { appendToFile, copyFile, expectFileToExist, expectFileToMatch, replaceInFile, writeFile } from '../../../utils/fs';
-import { ng } from '../../../utils/process';
+import { ng, npm } from '../../../utils/process';
import { updateJsonFile } from '../../../utils/project';
import { expectToFail } from '../../../utils/utils';
+import { readNgVersion } from '../../../utils/version';
export default async function () {
const baseDir = 'dist/test-project';
@@ -19,6 +20,16 @@ export default async function () {
{ lang: 'de', translation: 'Hallo i18n!', outputPath: deDir },
];
+ if (!getGlobalVariable('argv')['ve']) {
+ let localizeVersion = '@angular/localize@' + readNgVersion();
+ if (getGlobalVariable('argv')['ng-snapshots']) {
+ localizeVersion = require('../../../ng-snapshot/package.json').dependencies['@angular/localize'];
+ }
+ await npm('install', localizeVersion);
+
+ await appendToFile('src/polyfills.ts', `\nimport '@angular/localize/init';`);
+ }
+
await updateJsonFile('angular.json', workspaceJson => {
const appArchitect = workspaceJson.projects['test-project'].architect;
const browserConfigs = appArchitect['build'].configurations;
@@ -88,8 +99,16 @@ export default async function () {
for (const { lang, translation } of langTranslations) {
if (lang != 'en') {
await copyFile('src/locale/messages.xlf', `src/locale/messages.${lang}.xlf`);
- await replaceInFile(`src/locale/messages.${lang}.xlf`, '',
- `\n${translation}`);
+ await replaceInFile(
+ `src/locale/messages.${lang}.xlf`,
+ 'source-language="en-US"',
+ `source-language="en-US" target-language="${lang}"`,
+ );
+ await replaceInFile(
+ `src/locale/messages.${lang}.xlf`,
+ '',
+ `\n${translation}`,
+ );
}
}
@@ -109,7 +128,7 @@ export default async function () {
const server = app.listen(4200, 'localhost');
try {
// Execute without a devserver.
- await ng('e2e', '--devServerTarget=');
+ await ng('e2e', `--configuration=${lang}`, '--devServerTarget=');
} finally {
server.close();
}
diff --git a/tests/legacy-cli/e2e_runner.ts b/tests/legacy-cli/e2e_runner.ts
index 851fbcc3ee57..9b7add84e347 100644
--- a/tests/legacy-cli/e2e_runner.ts
+++ b/tests/legacy-cli/e2e_runner.ts
@@ -93,16 +93,6 @@ allTests = allTests
// Disabled on rc.0 due to needed sync with devkit for changes.
.filter(name => !name.endsWith('/service-worker.ts'));
-if (!argv.ve) {
- // These tests are disabled on the Ivy CI jobs because:
- // - Ivy doesn't support the functionality yet
- // - The test itself is not applicable to Ivy
- // As we transition into using Ivy as the default this list should be reassessed.
- allTests = allTests
- // Ivy doesn't support i18n externally at the moment.
- .filter(name => !name.endsWith('tests/build/aot/aot-i18n.ts'));
-}
-
const shardId = 'shard' in argv ? argv['shard'] : null;
const nbShards = (shardId === null ? 1 : argv['nb-shards']) || 2;
const tests = allTests.filter(name => {