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..66ff661b68c7 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,11 @@ 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`, 'Hello i18n!', - `Hello i18n!\n${translation}`); + await replaceInFile( + `src/locale/messages.${lang}.xlf`, + 'Hello i18n!', + `Hello i18n!\n${translation}`, + ); } } @@ -109,7 +123,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 57c183da4726..19ac155152f1 100644 --- a/tests/legacy-cli/e2e_runner.ts +++ b/tests/legacy-cli/e2e_runner.ts @@ -97,14 +97,6 @@ if (argv.ve) { // Remove Ivy specific tests allTests = allTests .filter(name => !name.includes('tests/i18n/ivy-localize-')); -} else { - // 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;