/,
);
- await expectFileToExist(join(guardDir, 'multiple.guard.spec.ts'));
+ await expectFileToExist(join(guardDir, 'multiple-guard.spec.ts'));
await ng('test', '--watch=false');
}
diff --git a/tests/legacy-cli/e2e/tests/generate/interceptor/interceptor-basic.ts b/tests/legacy-cli/e2e/tests/generate/interceptor/interceptor-basic.ts
index 5046f2603da6..7dd0b48c439b 100755
--- a/tests/legacy-cli/e2e/tests/generate/interceptor/interceptor-basic.ts
+++ b/tests/legacy-cli/e2e/tests/generate/interceptor/interceptor-basic.ts
@@ -7,10 +7,10 @@ export default function () {
const interceptorDir = join('src', 'app');
return (
- ng('generate', 'interceptor', 'test-interceptor')
+ ng('generate', 'interceptor', 'test')
.then(() => expectFileToExist(interceptorDir))
- .then(() => expectFileToExist(join(interceptorDir, 'test-interceptor.interceptor.ts')))
- .then(() => expectFileToExist(join(interceptorDir, 'test-interceptor.interceptor.spec.ts')))
+ .then(() => expectFileToExist(join(interceptorDir, 'test-interceptor.ts')))
+ .then(() => expectFileToExist(join(interceptorDir, 'test-interceptor.spec.ts')))
// Try to run the unit tests.
.then(() => ng('test', '--watch=false'))
diff --git a/tests/legacy-cli/e2e/tests/generate/module/module-basic.ts b/tests/legacy-cli/e2e/tests/generate/module/module-basic.ts
index 8b59c3147532..18e1a05fedde 100644
--- a/tests/legacy-cli/e2e/tests/generate/module/module-basic.ts
+++ b/tests/legacy-cli/e2e/tests/generate/module/module-basic.ts
@@ -13,10 +13,10 @@ export default async function () {
await ng('generate', 'module', 'test', '--project', projectName);
await expectFileToExist(moduleDir);
- await expectFileToExist(join(moduleDir, 'test.module.ts'));
- await expectToFail(() => expectFileToExist(join(moduleDir, 'test-routing.module.ts')));
+ await expectFileToExist(join(moduleDir, 'test-module.ts'));
+ await expectToFail(() => expectFileToExist(join(moduleDir, 'test-routing-module.ts')));
await expectToFail(() => expectFileToExist(join(moduleDir, 'test.spec.ts')));
- await expectFileToMatch(join(moduleDir, 'test.module.ts'), 'TestModule');
+ await expectFileToMatch(join(moduleDir, 'test-module.ts'), 'TestModule');
// Try to run the unit tests.
await ng('test', projectName, '--watch=false');
diff --git a/tests/legacy-cli/e2e/tests/generate/module/module-import.ts b/tests/legacy-cli/e2e/tests/generate/module/module-import.ts
index 07f280b918f5..533b3d19efe7 100644
--- a/tests/legacy-cli/e2e/tests/generate/module/module-import.ts
+++ b/tests/legacy-cli/e2e/tests/generate/module/module-import.ts
@@ -9,35 +9,35 @@ export default async function () {
await ng('generate', 'module', 'sub/deep', '--project', projectName);
const projectAppDir = `projects/${projectName}/src/app`;
- const modulePath = join(projectAppDir, 'app.module.ts');
- const subModulePath = join(projectAppDir, 'sub/sub.module.ts');
- const deepSubModulePath = join(projectAppDir, 'sub/deep/deep.module.ts');
+ const modulePath = join(projectAppDir, 'app-module.ts');
+ const subModulePath = join(projectAppDir, 'sub/sub-module.ts');
+ const deepSubModulePath = join(projectAppDir, 'sub/deep/deep-module.ts');
- await ng('generate', 'module', 'test1', '--module', 'app.module.ts', '--project', projectName);
- await expectFileToMatch(modulePath, `import { Test1Module } from './test1/test1.module'`);
+ await ng('generate', 'module', 'test1', '--module', 'app-module.ts', '--project', projectName);
+ await expectFileToMatch(modulePath, `import { Test1Module } from './test1/test1-module'`);
await expectFileToMatch(modulePath, /imports: \[.*?Test1Module.*?\]/s);
- await ng('generate', 'module', 'test2', '--module', 'app.module', '--project', projectName);
- await expectFileToMatch(modulePath, `import { Test2Module } from './test2/test2.module'`);
+ await ng('generate', 'module', 'test2', '--module', 'app-module', '--project', projectName);
+ await expectFileToMatch(modulePath, `import { Test2Module } from './test2/test2-module'`);
await expectFileToMatch(modulePath, /imports: \[.*?Test2Module.*?\]/s);
await ng('generate', 'module', 'test3', '--module', 'app', '--project', projectName);
- await expectFileToMatch(modulePath, `import { Test3Module } from './test3/test3.module'`);
+ await expectFileToMatch(modulePath, `import { Test3Module } from './test3/test3-module'`);
await expectFileToMatch(modulePath, /imports: \[.*?Test3Module.*?\]/s);
await ng('generate', 'module', 'test4', '--routing', '--module', 'app', '--project', projectName);
await expectFileToMatch(modulePath, /imports: \[.*?Test4Module.*?\]/s);
await expectFileToMatch(
- join(projectAppDir, 'test4/test4.module.ts'),
- `import { Test4RoutingModule } from './test4-routing.module'`,
+ join(projectAppDir, 'test4/test4-module.ts'),
+ `import { Test4RoutingModule } from './test4-routing-module'`,
);
await expectFileToMatch(
- join(projectAppDir, 'test4/test4.module.ts'),
+ join(projectAppDir, 'test4/test4-module.ts'),
/imports: \[.*?Test4RoutingModule.*?\]/s,
);
await ng('generate', 'module', 'test5', '--module', 'sub', '--project', projectName);
- await expectFileToMatch(subModulePath, `import { Test5Module } from '../test5/test5.module'`);
+ await expectFileToMatch(subModulePath, `import { Test5Module } from '../test5/test5-module'`);
await expectFileToMatch(subModulePath, /imports: \[.*?Test5Module.*?\]/s);
@@ -45,15 +45,15 @@ export default async function () {
await expectFileToMatch(
deepSubModulePath,
- `import { Test6Module } from '../../test6/test6.module'`,
+ `import { Test6Module } from '../../test6/test6-module'`,
);
await expectFileToMatch(deepSubModulePath, /imports: \[.*?Test6Module.*?\]/s);
// E2E_DISABLE: temporarily disable pending investigation
// await process.chdir(join(root, 'src', 'app')))
- // await ng('generate', 'module', 'test7', '--module', 'app.module.ts'))
+ // await ng('generate', 'module', 'test7', '--module', 'app-module.ts'))
// await process.chdir('..'))
// await expectFileToMatch(modulePath,
- // /import { Test7Module } from '.\/test7\/test7.module'/))
+ // /import { Test7Module } from '.\/test7\/test7-module'/))
// await expectFileToMatch(modulePath, /imports: \[(.|\s)*Test7Module(.|\s)*\]/m));
}
diff --git a/tests/legacy-cli/e2e/tests/generate/module/module-routing-child-folder.ts b/tests/legacy-cli/e2e/tests/generate/module/module-routing-child-folder.ts
index 2c1d56c6d251..f2ba0e3396f7 100644
--- a/tests/legacy-cli/e2e/tests/generate/module/module-routing-child-folder.ts
+++ b/tests/legacy-cli/e2e/tests/generate/module/module-routing-child-folder.ts
@@ -15,8 +15,8 @@ export default async function () {
await ng('generate', 'module', 'sub-dir/child', '--routing');
await expectFileToExist(join(testPath, 'sub-dir/child'));
- await expectFileToExist(join(testPath, 'sub-dir/child', 'child.module.ts'));
- await expectFileToExist(join(testPath, 'sub-dir/child', 'child-routing.module.ts'));
+ await expectFileToExist(join(testPath, 'sub-dir/child', 'child-module.ts'));
+ await expectFileToExist(join(testPath, 'sub-dir/child', 'child-routing-module.ts'));
await expectToFail(() => expectFileToExist(join(testPath, 'sub-dir/child', 'child.spec.ts')));
// Try to run the unit tests.
diff --git a/tests/legacy-cli/e2e/tests/generate/pipe/pipe-basic.ts b/tests/legacy-cli/e2e/tests/generate/pipe/pipe-basic.ts
index 500a45eeed9e..2ddb3ff4225f 100644
--- a/tests/legacy-cli/e2e/tests/generate/pipe/pipe-basic.ts
+++ b/tests/legacy-cli/e2e/tests/generate/pipe/pipe-basic.ts
@@ -8,10 +8,10 @@ export default function () {
const pipeDir = join('src', 'app');
return (
- ng('generate', 'pipe', 'test-pipe')
+ ng('generate', 'pipe', 'test')
.then(() => expectFileToExist(pipeDir))
- .then(() => expectFileToExist(join(pipeDir, 'test-pipe.pipe.ts')))
- .then(() => expectFileToExist(join(pipeDir, 'test-pipe.pipe.spec.ts')))
+ .then(() => expectFileToExist(join(pipeDir, 'test-pipe.ts')))
+ .then(() => expectFileToExist(join(pipeDir, 'test-pipe.spec.ts')))
// Try to run the unit tests.
.then(() => ng('test', '--watch=false'))
diff --git a/tests/legacy-cli/e2e/tests/generate/schematic-defaults.ts b/tests/legacy-cli/e2e/tests/generate/schematic-defaults.ts
index 7e015a0d6638..7c9987d92321 100644
--- a/tests/legacy-cli/e2e/tests/generate/schematic-defaults.ts
+++ b/tests/legacy-cli/e2e/tests/generate/schematic-defaults.ts
@@ -12,8 +12,8 @@ export default async function () {
// Generate component in application to verify that it's minimal
const { stdout } = await ng('generate', 'component', 'foo');
- if (!stdout.includes('foo.component.scss')) {
- throw new Error('Expected "foo.component.scss" to exist.');
+ if (!stdout.includes('foo.scss')) {
+ throw new Error('Expected "foo.scss" to exist.');
}
// Generate another project with different settings
@@ -23,6 +23,7 @@ export default async function () {
config.projects['test-project-two'].schematics = {
'@schematics/angular:component': {
style: 'less',
+ type: 'Component',
},
};
});
diff --git a/tests/legacy-cli/e2e/tests/generate/schematics-collections-relative.ts b/tests/legacy-cli/e2e/tests/generate/schematics-collections-relative.ts
new file mode 100644
index 000000000000..f6f583bf0e72
--- /dev/null
+++ b/tests/legacy-cli/e2e/tests/generate/schematics-collections-relative.ts
@@ -0,0 +1,53 @@
+import assert from 'node:assert';
+import { join } from 'node:path';
+import { ng } from '../../utils/process';
+import { writeMultipleFiles, createDir } from '../../utils/fs';
+import { updateJsonFile } from '../../utils/project';
+
+export default async function () {
+ // setup temp collection
+ await createDir('./fake-schematics');
+ await writeMultipleFiles({
+ './fake-schematics/package.json': JSON.stringify({
+ 'schematics': './collection.json',
+ }),
+ './fake-schematics/collection.json': JSON.stringify({
+ 'schematics': {
+ 'fake': {
+ 'description': 'Fake schematic',
+ 'schema': './fake-schema.json',
+ 'factory': './fake',
+ },
+ },
+ }),
+ './fake-schematics/fake-schema.json': JSON.stringify({
+ '$id': 'FakeSchema',
+ 'title': 'Fake Schema',
+ 'type': 'object',
+ }),
+ './fake-schematics/fake.js': `
+ exports.default = () => (host, context) => context.logger.info('fake schematic run.');
+ `,
+ });
+
+ await updateJsonFile('angular.json', (json) => {
+ json.cli ??= {};
+ json.cli.schematicCollections = ['./fake-schematics'];
+ });
+
+ const { stdout: stdout1 } = await ng('generate', '--help');
+ assert.match(stdout1, /Fake schematic/);
+
+ const { stdout: stdout2 } = await ng('generate', 'fake');
+ assert.match(stdout2, /fake schematic run/);
+
+ // change cwd to a nested directory to validate the relative schematic is resolved correctly
+ const originalCwd = process.cwd();
+ try {
+ process.chdir(join(originalCwd, 'src/app'));
+ const { stdout: stdout3 } = await ng('generate', 'fake');
+ assert.match(stdout3, /fake schematic run/);
+ } finally {
+ process.chdir(originalCwd);
+ }
+}
diff --git a/tests/legacy-cli/e2e/tests/generate/service/service-basic.ts b/tests/legacy-cli/e2e/tests/generate/service/service-basic.ts
index 26a18fc8a9d2..a7ddb3cb8310 100644
--- a/tests/legacy-cli/e2e/tests/generate/service/service-basic.ts
+++ b/tests/legacy-cli/e2e/tests/generate/service/service-basic.ts
@@ -9,8 +9,8 @@ export default function () {
return (
ng('generate', 'service', 'test-service')
.then(() => expectFileToExist(serviceDir))
- .then(() => expectFileToExist(join(serviceDir, 'test-service.service.ts')))
- .then(() => expectFileToExist(join(serviceDir, 'test-service.service.spec.ts')))
+ .then(() => expectFileToExist(join(serviceDir, 'test-service.ts')))
+ .then(() => expectFileToExist(join(serviceDir, 'test-service.spec.ts')))
// Try to run the unit tests.
.then(() => ng('test', '--watch=false'))
diff --git a/tests/legacy-cli/e2e/tests/i18n/extract-ivy-disk-cache.ts b/tests/legacy-cli/e2e/tests/i18n/extract-ivy-disk-cache.ts
index 0fd91f8b8dae..e5a13de3c439 100644
--- a/tests/legacy-cli/e2e/tests/i18n/extract-ivy-disk-cache.ts
+++ b/tests/legacy-cli/e2e/tests/i18n/extract-ivy-disk-cache.ts
@@ -15,24 +15,21 @@ export default async function () {
// Setup an i18n enabled component
await ng('generate', 'component', 'i18n-test');
- await writeFile(
- join('src/app/i18n-test', 'i18n-test.component.ng.html'),
- 'Hello world
',
- );
+ await writeFile(join('src/app/i18n-test', 'i18n-test.html'), 'Hello world
');
await writeFile(
- 'src/app/app.component.ts',
+ 'src/app/app.ts',
`
import { Component } from '@angular/core';
- import { I18nTestComponent } from './i18n-test/i18n-test.component';
+ import { I18nTest } from './i18n-test/i18n-test';
@Component({
standalone: true,
selector: 'app-root',
- imports: [I18nTestComponent],
+ imports: [I18nTest],
template: ' '
})
- export class AppComponent {}
+ export class App {}
`,
);
diff --git a/tests/legacy-cli/e2e/tests/i18n/extract-ivy-libraries.ts b/tests/legacy-cli/e2e/tests/i18n/extract-ivy-libraries.ts
index 754f5d6ebc02..a577a8c5e6a6 100644
--- a/tests/legacy-cli/e2e/tests/i18n/extract-ivy-libraries.ts
+++ b/tests/legacy-cli/e2e/tests/i18n/extract-ivy-libraries.ts
@@ -7,24 +7,17 @@ import { readNgVersion } from '../../utils/version';
export default async function () {
// Setup a library
await ng('generate', 'library', 'i18n-lib-test');
- await replaceInFile(
- 'projects/i18n-lib-test/src/lib/i18n-lib-test.component.ts',
- '',
- '
',
- );
+ await replaceInFile('projects/i18n-lib-test/src/lib/i18n-lib-test.ts', '
', '
');
// Build library
await ng('build', 'i18n-lib-test', '--configuration=development');
// Consume library in application
- await replaceInFile('src/app/app.component.ts', 'imports: [', 'imports: [I18nLibTestComponent,');
- await prependToFile(
- 'src/app/app.component.ts',
- `import { I18nLibTestComponent } from 'i18n-lib-test';`,
- );
+ await replaceInFile('src/app/app.ts', 'imports: [', 'imports: [I18nLibTest,');
+ await prependToFile('src/app/app.ts', `import { I18nLibTest } from 'i18n-lib-test';`);
await writeFile(
- 'src/app/app.component.ng.html',
+ 'src/app/app.html',
`
Hello world
@@ -42,11 +35,8 @@ export default async function () {
await ng('extract-i18n');
await expectFileToMatch('messages.xlf', 'Hello world');
await expectFileToMatch('messages.xlf', 'i18n-lib-test works!');
- await expectFileToMatch('messages.xlf', 'src/app/app.component.ng.html');
- await expectFileToMatch(
- 'messages.xlf',
- 'projects/i18n-lib-test/src/lib/i18n-lib-test.component.ts',
- );
+ await expectFileToMatch('messages.xlf', 'src/app/app.html');
+ await expectFileToMatch('messages.xlf', 'projects/i18n-lib-test/src/lib/i18n-lib-test.ts');
await uninstallPackage('@angular/localize');
}
diff --git a/tests/legacy-cli/e2e/tests/i18n/extract-ivy.ts b/tests/legacy-cli/e2e/tests/i18n/extract-ivy.ts
index e4ea4c39358b..72af7f87e712 100644
--- a/tests/legacy-cli/e2e/tests/i18n/extract-ivy.ts
+++ b/tests/legacy-cli/e2e/tests/i18n/extract-ivy.ts
@@ -9,24 +9,21 @@ import { readNgVersion } from '../../utils/version';
export default async function () {
// Setup an i18n enabled component
await ng('generate', 'component', 'i18n-test');
- await writeFile(
- join('src/app/i18n-test', 'i18n-test.component.ng.html'),
- 'Hello world
',
- );
+ await writeFile(join('src/app/i18n-test', 'i18n-test.html'), 'Hello world
');
// Actually use the generated component to ensure it is present in the application output
await writeFile(
- 'src/app/app.component.ts',
+ 'src/app/app.ts',
`
import { Component } from '@angular/core';
- import { I18nTestComponent } from './i18n-test/i18n-test.component';
+ import { I18nTest } from './i18n-test/i18n-test';
@Component({
standalone: true,
selector: 'app-root',
- imports: [I18nTestComponent],
+ imports: [I18nTest],
template: ' '
})
- export class AppComponent {}
+ export class App {}
`,
);
diff --git a/tests/legacy-cli/e2e/tests/i18n/ivy-localize-app-shell-service-worker.ts b/tests/legacy-cli/e2e/tests/i18n/ivy-localize-app-shell-service-worker.ts
index 46379cbe9bb9..b1568be95939 100644
--- a/tests/legacy-cli/e2e/tests/i18n/ivy-localize-app-shell-service-worker.ts
+++ b/tests/legacy-cli/e2e/tests/i18n/ivy-localize-app-shell-service-worker.ts
@@ -17,7 +17,7 @@ export default async function () {
: readNgVersion();
});
- await appendToFile('src/app/app.component.ng.html', ' ');
+ await appendToFile('src/app/app.html', ' ');
// Add app-shell and service-worker
await silentNg('generate', 'app-shell');
diff --git a/tests/legacy-cli/e2e/tests/i18n/ivy-localize-app-shell.ts b/tests/legacy-cli/e2e/tests/i18n/ivy-localize-app-shell.ts
index e997286febcd..cbabbae17140 100644
--- a/tests/legacy-cli/e2e/tests/i18n/ivy-localize-app-shell.ts
+++ b/tests/legacy-cli/e2e/tests/i18n/ivy-localize-app-shell.ts
@@ -23,7 +23,7 @@ export default async function () {
: readNgVersion();
});
- await appendToFile('src/app/app.component.ng.html', ' ');
+ await appendToFile('src/app/app.html', ' ');
await ng('generate', 'app-shell', '--project', 'test-project');
if (isSnapshotBuild) {
@@ -62,7 +62,7 @@ export default async function () {
});
await writeFile(
- 'src/app/app-shell/app-shell.component.ng.html',
+ 'src/app/app-shell/app-shell.html',
'Hello i18n! ',
);
@@ -70,7 +70,7 @@ export default async function () {
// Extraction of i18n only works on browser targets.
// Let's add the same translation that there is in the app-shell
await writeFile(
- 'src/app/app.component.ng.html',
+ 'src/app/app.html',
'Hello i18n! ',
);
@@ -79,9 +79,9 @@ export default async function () {
await expectFileToMatch('src/locale/messages.xlf', `source-language="en-US"`);
await expectFileToMatch('src/locale/messages.xlf', `An introduction header for this sample`);
- // Clean up app.component.ng.html so that we can easily
+ // Clean up app.ng.html so that we can easily
// find the translation text
- await writeFile('src/app/app.component.ng.html', ' ');
+ await writeFile('src/app/app.html', ' ');
for (const { lang, translation } of langTranslations) {
if (lang != 'en-US') {
diff --git a/tests/legacy-cli/e2e/tests/i18n/setup.ts b/tests/legacy-cli/e2e/tests/i18n/setup.ts
index aa8cde291d7a..30fdcee1d757 100644
--- a/tests/legacy-cli/e2e/tests/i18n/setup.ts
+++ b/tests/legacy-cli/e2e/tests/i18n/setup.ts
@@ -98,7 +98,7 @@ export const baseHrefs: { [l: string]: string } = {
export async function setupI18nConfig() {
// Add component with i18n content, both translations and localeData (plural, dates).
await writeFile(
- 'src/app/app.component.ts',
+ 'src/app/app.ts',
`
import { Component, Inject, LOCALE_ID } from '@angular/core';
import { DatePipe } from '@angular/common';
@@ -108,9 +108,9 @@ export async function setupI18nConfig() {
selector: 'app-root',
imports: [DatePipe, RouterOutlet],
standalone: true,
- templateUrl: './app.component.ng.html'
+ templateUrl: './app.html'
})
- export class AppComponent {
+ export class App {
constructor(@Inject(LOCALE_ID) public locale: string) { }
title = 'i18n';
jan = new Date(2000, 0, 1);
@@ -119,7 +119,7 @@ export async function setupI18nConfig() {
`,
);
await writeFile(
- `src/app/app.component.ng.html`,
+ `src/app/app.html`,
`
Hello {{ title }}!
{{ locale }}
@@ -140,7 +140,7 @@ export async function setupI18nConfig() {
Hello !
- src/app/app.component.ng.html
+ src/app/app.html
2,3
An introduction header for this sample
@@ -148,14 +148,14 @@ export async function setupI18nConfig() {
Updated
- src/app/app.component.ng.html
+ src/app/app.html
5,6
{VAR_PLURAL, plural, =0 {just now} =1 {one minute ago} other { minutes ago}}
- src/app/app.component.ng.html
+ src/app/app.html
5,6
@@ -168,7 +168,7 @@ export async function setupI18nConfig() {
// ng serve support: https://github.com/angular/angular-cli/issues/16248
await writeFile('src/app/dynamic.ts', `export const abc = 5;`);
await appendToFile(
- 'src/app/app.component.ts',
+ 'src/app/app.ts',
`
(async () => { await import('./dynamic'); })();
`,
diff --git a/tests/legacy-cli/e2e/tests/misc/browsers.ts b/tests/legacy-cli/e2e/tests/misc/browsers.ts
index cb133dbef117..14c085abaac5 100644
--- a/tests/legacy-cli/e2e/tests/misc/browsers.ts
+++ b/tests/legacy-cli/e2e/tests/misc/browsers.ts
@@ -11,7 +11,7 @@ export default async function () {
}
// Workaround for https://github.com/angular/angular/issues/32192
- await replaceInFile('src/app/app.component.ng.html', /class="material-icons"/g, '');
+ await replaceInFile('src/app/app.html', /class="material-icons"/g, '');
await ng('build');
diff --git a/tests/legacy-cli/e2e/tests/misc/dedupe-duplicate-modules.ts b/tests/legacy-cli/e2e/tests/misc/dedupe-duplicate-modules.ts
index 8c5a094cf9aa..5047021566eb 100644
--- a/tests/legacy-cli/e2e/tests/misc/dedupe-duplicate-modules.ts
+++ b/tests/legacy-cli/e2e/tests/misc/dedupe-duplicate-modules.ts
@@ -11,7 +11,7 @@ export default async function () {
await updateJsonFile('package.json', (json) => {
json.dependencies = {
...json.dependencies,
- 'tslib': '2.0.0',
+ 'tslib': '^2.0.0',
'tslib-1': 'npm:tslib@1.13.0',
'tslib-1-copy': 'npm:tslib@1.13.0',
};
@@ -56,7 +56,7 @@ export default async function () {
throw new Error('Expected stderr to contain [DedupeModuleResolvePlugin] log for tslib.');
}
- await expectFileToMatch(outFile, './node_modules/tslib/tslib.es6.js');
+ await expectFileToMatch(outFile, './node_modules/tslib/tslib.es6.mjs');
} finally {
await rimraf('node_modules/tslib');
await gitClean();
diff --git a/tests/legacy-cli/e2e/tests/misc/duplicate-command-line-option.ts b/tests/legacy-cli/e2e/tests/misc/duplicate-command-line-option.ts
index a445e9051ade..0042a363e156 100644
--- a/tests/legacy-cli/e2e/tests/misc/duplicate-command-line-option.ts
+++ b/tests/legacy-cli/e2e/tests/misc/duplicate-command-line-option.ts
@@ -15,5 +15,5 @@ export default async function () {
throw new Error(`Expected stderr to contain: "${warningMatch}".`);
}
- await expectFileToExist('src/app/test-component/test-component.component.sass');
+ await expectFileToExist('src/app/test-component/test-component.sass');
}
diff --git a/tests/legacy-cli/e2e/tests/misc/es2015-nometa.ts b/tests/legacy-cli/e2e/tests/misc/es2015-nometa.ts
index 3973636e07f5..c8fad0e07954 100644
--- a/tests/legacy-cli/e2e/tests/misc/es2015-nometa.ts
+++ b/tests/legacy-cli/e2e/tests/misc/es2015-nometa.ts
@@ -2,15 +2,15 @@ import { prependToFile, replaceInFile } from '../../utils/fs';
import { ng } from '../../utils/process';
export default async function () {
- await ng('generate', 'service', 'user');
+ await ng('generate', 'service', 'user-service');
// Update the application to use the new service
- await prependToFile('src/app/app.component.ts', "import { UserService } from './user.service';");
+ await prependToFile('src/app/app.ts', "import { UserService } from './user-service';");
await replaceInFile(
- 'src/app/app.component.ts',
- 'export class AppComponent {',
- 'export class AppComponent {\n constructor(user: UserService) {}',
+ 'src/app/app.ts',
+ 'export class App {',
+ 'export class App {\n constructor(user: UserService) {}',
);
// Execute the application's tests with emitDecoratorMetadata disabled (default)
diff --git a/tests/legacy-cli/e2e/tests/misc/forwardref-es2015.ts b/tests/legacy-cli/e2e/tests/misc/forwardref-es2015.ts
index cdf3eef6a313..32ca39e89713 100644
--- a/tests/legacy-cli/e2e/tests/misc/forwardref-es2015.ts
+++ b/tests/legacy-cli/e2e/tests/misc/forwardref-es2015.ts
@@ -5,25 +5,25 @@ import { expectToFail } from '../../utils/utils';
export default async function () {
// Update the application to use a forward reference
await replaceInFile(
- 'src/app/app.component.ts',
+ 'src/app/app.ts',
"import { Component } from '@angular/core';",
"import { Component, Inject, Injectable, forwardRef } from '@angular/core';",
);
- await appendToFile('src/app/app.component.ts', '\n@Injectable() export class Lock { }\n');
+ await appendToFile('src/app/app.ts', '\n@Injectable() export class Lock { }\n');
await replaceInFile(
- 'src/app/app.component.ts',
- 'export class AppComponent {',
- 'export class AppComponent {\n constructor(@Inject(forwardRef(() => Lock)) lock: Lock) {}',
+ 'src/app/app.ts',
+ 'export class App {',
+ 'export class App {\n constructor(@Inject(forwardRef(() => Lock)) lock: Lock) {}',
);
// Update the application's unit tests to include the new injectable
await replaceInFile(
- 'src/app/app.component.spec.ts',
- "import { AppComponent } from './app.component';",
- "import { AppComponent, Lock } from './app.component';",
+ 'src/app/app.spec.ts',
+ "import { App } from './app';",
+ "import { App, Lock } from './app';",
);
await replaceInFile(
- 'src/app/app.component.spec.ts',
+ 'src/app/app.spec.ts',
'TestBed.configureTestingModule({',
'TestBed.configureTestingModule({ providers: [Lock],',
);
diff --git a/tests/legacy-cli/e2e/tests/misc/trusted-types.ts b/tests/legacy-cli/e2e/tests/misc/trusted-types.ts
index 3c927f15ad8d..325ee521fe6d 100644
--- a/tests/legacy-cli/e2e/tests/misc/trusted-types.ts
+++ b/tests/legacy-cli/e2e/tests/misc/trusted-types.ts
@@ -16,7 +16,7 @@ export default async function () {
await replaceInFile(
'src/app/app.routes.ts',
'routes: Routes = [];',
- `routes: Routes = [{path: 'lazy', loadComponent: () => import('./lazy/lazy.component').then(c => c.LazyComponent)}];`,
+ `routes: Routes = [{path: 'lazy', loadComponent: () => import('./lazy/lazy').then(c => c.Lazy)}];`,
);
// Add lazy route e2e
diff --git a/tests/legacy-cli/e2e/tests/test/test-code-coverage-exclude.ts b/tests/legacy-cli/e2e/tests/test/test-code-coverage-exclude.ts
index 52b8989218b5..3533e6c8e9a9 100644
--- a/tests/legacy-cli/e2e/tests/test/test-code-coverage-exclude.ts
+++ b/tests/legacy-cli/e2e/tests/test/test-code-coverage-exclude.ts
@@ -5,7 +5,7 @@ import { expectToFail } from '../../utils/utils';
export default async function () {
// This test is already in build-angular, but that doesn't run on Windows.
await silentNg('test', '--no-watch', '--code-coverage');
- await expectFileToExist('coverage/test-project/app.component.ts.html');
+ await expectFileToExist('coverage/test-project/app.ts.html');
// Delete coverage directory
await rimraf('coverage');
@@ -13,10 +13,10 @@ export default async function () {
'test',
'--no-watch',
'--code-coverage',
- `--code-coverage-exclude='src/**/app.component.ts'`,
+ `--code-coverage-exclude='src/**/app.ts'`,
);
// Doesn't include excluded.
await expectFileToExist('coverage/test-project/index.html');
- await expectToFail(() => expectFileToExist('coverage/test-project/app.component.ts.html'));
+ await expectToFail(() => expectFileToExist('coverage/test-project/app.ts.html'));
}
diff --git a/tests/legacy-cli/e2e/tests/test/test-fail-single-run.ts b/tests/legacy-cli/e2e/tests/test/test-fail-single-run.ts
index 90f7d73736c1..d2054e7c37ee 100644
--- a/tests/legacy-cli/e2e/tests/test/test-fail-single-run.ts
+++ b/tests/legacy-cli/e2e/tests/test/test-fail-single-run.ts
@@ -6,7 +6,7 @@ export default function () {
// TODO(architect): Delete this test. It is now in devkit/build-angular.
// Fails on single run with broken compilation.
- return writeFile('src/app.component.spec.ts', ' definitely not typescript
').then(() =>
+ return writeFile('src/app.spec.ts', ' definitely not typescript
').then(() =>
expectToFail(() => ng('test', '--watch=false')),
);
}
diff --git a/tests/legacy-cli/e2e/tests/test/test-jasmine-clock.ts b/tests/legacy-cli/e2e/tests/test/test-jasmine-clock.ts
index f676b324a2c6..37b164ff5914 100644
--- a/tests/legacy-cli/e2e/tests/test/test-jasmine-clock.ts
+++ b/tests/legacy-cli/e2e/tests/test/test-jasmine-clock.ts
@@ -3,12 +3,12 @@ import { writeFile } from '../../utils/fs';
export default async function () {
await writeFile(
- 'src/app/app.component.spec.ts',
+ 'src/app/app.spec.ts',
`
import { TestBed } from '@angular/core/testing';
- import { AppComponent } from './app.component';
+ import { App } from './app';
- describe('AppComponent', () => {
+ describe('App', () => {
beforeAll(() => {
jasmine.clock().install();
});
@@ -18,11 +18,11 @@ export default async function () {
});
beforeEach(() => TestBed.configureTestingModule({
- imports: [AppComponent]
+ imports: [App]
}));
it('should create the app', () => {
- const fixture = TestBed.createComponent(AppComponent);
+ const fixture = TestBed.createComponent(App);
expect(fixture.componentInstance).toBeTruthy();
});
});
diff --git a/tests/legacy-cli/e2e/tests/test/test-scripts.ts b/tests/legacy-cli/e2e/tests/test/test-scripts.ts
index 4e308a6922b9..acbcc66dc230 100644
--- a/tests/legacy-cli/e2e/tests/test/test-scripts.ts
+++ b/tests/legacy-cli/e2e/tests/test/test-scripts.ts
@@ -16,31 +16,31 @@ export default async function () {
declare var stringScriptGlobal: any;
declare var inputScriptGlobal: any;
`,
- 'src/app/app.component.ts': `
+ 'src/app/app.ts': `
import { Component } from '@angular/core';
@Component({ selector: 'app-root', template: '', standalone: false })
- export class AppComponent {
+ export class App {
stringScriptGlobalProp = stringScriptGlobal;
inputScriptGlobalProp = inputScriptGlobal;
}
`,
- 'src/app/app.component.spec.ts': `
+ 'src/app/app.spec.ts': `
import { TestBed } from '@angular/core/testing';
- import { AppComponent } from './app.component';
+ import { App } from './app';
- describe('AppComponent', () => {
+ describe('App', () => {
beforeEach(() => TestBed.configureTestingModule({
- declarations: [AppComponent]
+ declarations: [App]
}));
it('should have access to string-script.js', () => {
- let app = TestBed.createComponent(AppComponent).debugElement.componentInstance;
+ let app = TestBed.createComponent(App).debugElement.componentInstance;
expect(app.stringScriptGlobalProp).toEqual('string-scripts.js');
});
it('should have access to input-script.js', () => {
- let app = TestBed.createComponent(AppComponent).debugElement.componentInstance;
+ let app = TestBed.createComponent(App).debugElement.componentInstance;
expect(app.inputScriptGlobalProp).toEqual('input-scripts.js');
});
});
diff --git a/tests/legacy-cli/e2e/tests/test/test-sourcemap.ts b/tests/legacy-cli/e2e/tests/test/test-sourcemap.ts
index 797aba88e17f..9e2a8e3f36fa 100644
--- a/tests/legacy-cli/e2e/tests/test/test-sourcemap.ts
+++ b/tests/legacy-cli/e2e/tests/test/test-sourcemap.ts
@@ -6,7 +6,7 @@ import { assertIsError } from '../../utils/utils';
export default async function () {
await writeFile(
- 'src/app/app.component.spec.ts',
+ 'src/app/app.spec.ts',
`
it('should fail', () => {
expect(undefined).toBeTruthy();
@@ -20,7 +20,7 @@ export default async function () {
throw new Error('ng test should have failed.');
} catch (error) {
assertIsError(error);
- assert.match(error.message, /src\/app\/app\.component\.spec\.ts/);
+ assert.match(error.message, /\(src\/app\/app\.spec\.ts:3:27/);
assert.doesNotMatch(error.message, /_karma_webpack_/);
}
diff --git a/tests/legacy-cli/e2e/tests/vite/ssr-default.ts b/tests/legacy-cli/e2e/tests/vite/ssr-default.ts
index cfaece9551ef..8b64a4b30f67 100644
--- a/tests/legacy-cli/e2e/tests/vite/ssr-default.ts
+++ b/tests/legacy-cli/e2e/tests/vite/ssr-default.ts
@@ -16,7 +16,7 @@ export default async function () {
// Forcibly remove in case another test doesn't clean itself up.
await uninstallPackage('@angular/ssr');
- await ng('add', '@angular/ssr', '--server-routing', '--skip-confirmation', '--skip-install');
+ await ng('add', '@angular/ssr', '--skip-confirmation', '--skip-install');
await useSha();
await installWorkspacePackages();
diff --git a/tests/legacy-cli/e2e/tests/vite/ssr-entry-express.ts b/tests/legacy-cli/e2e/tests/vite/ssr-entry-express.ts
index d5e045abef03..11cf671becbf 100644
--- a/tests/legacy-cli/e2e/tests/vite/ssr-entry-express.ts
+++ b/tests/legacy-cli/e2e/tests/vite/ssr-entry-express.ts
@@ -14,19 +14,19 @@ export default async function () {
// Forcibly remove in case another test doesn't clean itself up.
await uninstallPackage('@angular/ssr');
- await ng('add', '@angular/ssr', '--server-routing', '--skip-confirmation', '--skip-install');
+ await ng('add', '@angular/ssr', '--skip-confirmation', '--skip-install');
await useSha();
await installWorkspacePackages();
await writeMultipleFiles({
- // Replace the template of app.component.ng.html as it makes it harder to debug
- 'src/app/app.component.ng.html': ' ',
+ // Replace the template of app.ng.html as it makes it harder to debug
+ 'src/app/app.html': ' ',
'src/app/app.routes.ts': `
import { Routes } from '@angular/router';
- import { HomeComponent } from './home/home.component';
+ import { Home } from './home/home';
export const routes: Routes = [
- { path: 'home', component: HomeComponent }
+ { path: 'home', component: Home }
];
`,
'src/app/app.routes.server.ts': `
@@ -39,26 +39,29 @@ export default async function () {
'src/server.ts': `
import { AngularNodeAppEngine, writeResponseToNodeResponse, isMainModule, createNodeRequestHandler } from '@angular/ssr/node';
import express from 'express';
- import { fileURLToPath } from 'node:url';
- import { dirname, resolve } from 'node:path';
+ import { join } from 'node:path';
export function app(): express.Express {
const server = express();
- const serverDistFolder = dirname(fileURLToPath(import.meta.url));
- const browserDistFolder = resolve(serverDistFolder, '../browser');
+ const browserDistFolder = join(import.meta.dirname, '../browser');
const angularNodeAppEngine = new AngularNodeAppEngine();
- server.use('/api/**', (req, res) => res.json({ hello: 'foo' }));
+ server.use('/api/{*splat}', (req, res) => {
+ res.json({ hello: 'foo' })
+ });
- server.get('**', express.static(browserDistFolder, {
+ server.use(express.static(browserDistFolder, {
maxAge: '1y',
index: 'index.html'
}));
- server.get('**', (req, res, next) => {
- angularNodeAppEngine.handle(req)
- .then((response) => response ? writeResponseToNodeResponse(response, res) : next())
- .catch(next);
+ server.use(async(req, res, next) => {
+ const response = await angularNodeAppEngine.handle(req);
+ if (response) {
+ writeResponseToNodeResponse(response, res);
+ } else {
+ next();
+ }
});
return server;
@@ -67,7 +70,11 @@ export default async function () {
const server = app();
if (isMainModule(import.meta.url)) {
const port = process.env['PORT'] || 4000;
- server.listen(port, () => {
+ server.listen(port, (error) => {
+ if (error) {
+ throw error;
+ }
+
console.log(\`Node Express server listening on http://localhost:\${port}\`);
});
}
@@ -87,7 +94,7 @@ export default async function () {
// Modify the home component and validate the change.
await modifyFileAndWaitUntilUpdated(
- 'src/app/home/home.component.ng.html',
+ 'src/app/home/home.html',
'home works',
'yay home works!!!',
true,
diff --git a/tests/legacy-cli/e2e/tests/vite/ssr-entry-fastify.ts b/tests/legacy-cli/e2e/tests/vite/ssr-entry-fastify.ts
index 0dceea441dda..c50e8c2200f6 100644
--- a/tests/legacy-cli/e2e/tests/vite/ssr-entry-fastify.ts
+++ b/tests/legacy-cli/e2e/tests/vite/ssr-entry-fastify.ts
@@ -14,20 +14,20 @@ export default async function () {
// Forcibly remove in case another test doesn't clean itself up.
await uninstallPackage('@angular/ssr');
- await ng('add', '@angular/ssr', '--server-routing', '--skip-confirmation', '--skip-install');
+ await ng('add', '@angular/ssr', '--skip-confirmation', '--skip-install');
await useSha();
await installWorkspacePackages();
await installPackage('fastify@5');
await writeMultipleFiles({
- // Replace the template of app.component.ng.html as it makes it harder to debug
- 'src/app/app.component.ng.html': ' ',
+ // Replace the template of app.ng.html as it makes it harder to debug
+ 'src/app/app.html': ' ',
'src/app/app.routes.ts': `
import { Routes } from '@angular/router';
- import { HomeComponent } from './home/home.component';
+ import { Home } from './home/home';
export const routes: Routes = [
- { path: 'home', component: HomeComponent }
+ { path: 'home', component: Home }
];
`,
'src/app/app.routes.server.ts': `
@@ -87,7 +87,7 @@ export default async function () {
// Modify the home component and validate the change.
await modifyFileAndWaitUntilUpdated(
- 'src/app/home/home.component.ng.html',
+ 'src/app/home/home.html',
'home works',
'yay home works!!!',
true,
diff --git a/tests/legacy-cli/e2e/tests/vite/ssr-entry-h3.ts b/tests/legacy-cli/e2e/tests/vite/ssr-entry-h3.ts
index 5d2898370405..4a4f91066000 100644
--- a/tests/legacy-cli/e2e/tests/vite/ssr-entry-h3.ts
+++ b/tests/legacy-cli/e2e/tests/vite/ssr-entry-h3.ts
@@ -14,20 +14,20 @@ export default async function () {
// Forcibly remove in case another test doesn't clean itself up.
await uninstallPackage('@angular/ssr');
- await ng('add', '@angular/ssr', '--server-routing', '--skip-confirmation', '--skip-install');
+ await ng('add', '@angular/ssr', '--skip-confirmation', '--skip-install');
await useSha();
await installWorkspacePackages();
await installPackage('h3@1');
await writeMultipleFiles({
- // Replace the template of app.component.ng.html as it makes it harder to debug
- 'src/app/app.component.ng.html': ' ',
+ // Replace the template of app.ng.html as it makes it harder to debug
+ 'src/app/app.html': ' ',
'src/app/app.routes.ts': `
import { Routes } from '@angular/router';
- import { HomeComponent } from './home/home.component';
+ import { Home } from './home/home';
export const routes: Routes = [
- { path: 'home', component: HomeComponent }
+ { path: 'home', component: Home }
];
`,
'src/app/app.routes.server.ts': `
@@ -78,7 +78,7 @@ export default async function () {
// Modify the home component and validate the change.
await modifyFileAndWaitUntilUpdated(
- 'src/app/home/home.component.ng.html',
+ 'src/app/home/home.html',
'home works',
'yay home works!!!',
true,
diff --git a/tests/legacy-cli/e2e/tests/vite/ssr-entry-hono.ts b/tests/legacy-cli/e2e/tests/vite/ssr-entry-hono.ts
index a71557a43948..0b0b8220fe6b 100644
--- a/tests/legacy-cli/e2e/tests/vite/ssr-entry-hono.ts
+++ b/tests/legacy-cli/e2e/tests/vite/ssr-entry-hono.ts
@@ -14,20 +14,20 @@ export default async function () {
// Forcibly remove in case another test doesn't clean itself up.
await uninstallPackage('@angular/ssr');
- await ng('add', '@angular/ssr', '--server-routing', '--skip-confirmation', '--skip-install');
+ await ng('add', '@angular/ssr', '--skip-confirmation', '--skip-install');
await useSha();
await installWorkspacePackages();
await installPackage('hono@4');
await writeMultipleFiles({
- // Replace the template of app.component.ng.html as it makes it harder to debug
- 'src/app/app.component.ng.html': ' ',
+ // Replace the template of app.ng.html as it makes it harder to debug
+ 'src/app/app.html': ' ',
'src/app/app.routes.ts': `
import { Routes } from '@angular/router';
- import { HomeComponent } from './home/home.component';
+ import { Home } from './home/home';
export const routes: Routes = [
- { path: 'home', component: HomeComponent }
+ { path: 'home', component: Home }
];
`,
'src/app/app.routes.server.ts': `
@@ -70,7 +70,7 @@ export default async function () {
// Modify the home component and validate the change.
await modifyFileAndWaitUntilUpdated(
- 'src/app/home/home.component.ng.html',
+ 'src/app/home/home.html',
'home works',
'yay home works!!!',
true,
diff --git a/tests/legacy-cli/e2e/tests/vite/ssr-error-stack.ts b/tests/legacy-cli/e2e/tests/vite/ssr-error-stack.ts
index 7061e881fdff..a0d7c87bed13 100644
--- a/tests/legacy-cli/e2e/tests/vite/ssr-error-stack.ts
+++ b/tests/legacy-cli/e2e/tests/vite/ssr-error-stack.ts
@@ -14,7 +14,7 @@ export default async function () {
// `--server-routing` not supported in `browser` builder.
await ng('add', '@angular/ssr', '--skip-confirmation', '--skip-install');
} else {
- await ng('add', '@angular/ssr', '--server-routing', '--skip-confirmation', '--skip-install');
+ await ng('add', '@angular/ssr', '--skip-confirmation', '--skip-install');
}
await useSha();
@@ -22,7 +22,7 @@ export default async function () {
// Create Error.
await appendToFile(
- 'src/app/app.component.ts',
+ 'src/app/app.ts',
`
(() => {
throw new Error('something happened!');
@@ -37,7 +37,7 @@ export default async function () {
// The error is also sent in the browser, so we don't need to scrap the stderr.
match(
text,
- /something happened.+at eval \(.+[\\/]+e2e-test[\\/]+test-project[\\/]+src[\\/]+app[\\/]+app\.component\.ts:\d+:\d+\)/,
+ /something happened.+at eval \(.+[\\/]+e2e-test[\\/]+test-project[\\/]+src[\\/]+app[\\/]+app\.ts:\d+:\d+\)/,
);
doesNotMatch(text, /vite-root/);
}
diff --git a/tests/legacy-cli/e2e/tests/vite/ssr-new-dep-optimization.ts b/tests/legacy-cli/e2e/tests/vite/ssr-new-dep-optimization.ts
index be814b01bf89..d7b8a63813eb 100644
--- a/tests/legacy-cli/e2e/tests/vite/ssr-new-dep-optimization.ts
+++ b/tests/legacy-cli/e2e/tests/vite/ssr-new-dep-optimization.ts
@@ -22,7 +22,7 @@ export default async function () {
// Forcibly remove in case another test doesn't clean itself up.
await uninstallPackage('@angular/ssr');
- await ng('add', '@angular/ssr', '--server-routing', '--skip-confirmation', '--skip-install');
+ await ng('add', '@angular/ssr', '--skip-confirmation', '--skip-install');
await useSha();
await installWorkspacePackages();
diff --git a/tests/legacy-cli/e2e/tests/vite/ssr-no-server-entry-sub-path.ts b/tests/legacy-cli/e2e/tests/vite/ssr-no-server-entry-sub-path.ts
deleted file mode 100644
index a4d4ac2cfc61..000000000000
--- a/tests/legacy-cli/e2e/tests/vite/ssr-no-server-entry-sub-path.ts
+++ /dev/null
@@ -1,54 +0,0 @@
-import assert from 'node:assert';
-import {
- execAndWaitForOutputToMatch,
- ng,
- silentNg,
- waitForAnyProcessOutputToMatch,
-} from '../../utils/process';
-import { installWorkspacePackages, uninstallPackage } from '../../utils/packages';
-import { useSha } from '../../utils/project';
-import { getGlobalVariable } from '../../utils/env';
-import { findFreePort } from '../../utils/network';
-import { writeFile } from '../../utils/fs';
-
-export default async function () {
- assert(
- getGlobalVariable('argv')['esbuild'],
- 'This test should not be called in the Webpack suite.',
- );
-
- // Forcibly remove in case another test doesn't clean itself up.
- await uninstallPackage('@angular/ssr');
- await ng('add', '@angular/ssr', '--no-server-routing', '--skip-confirmation', '--skip-install');
- await useSha();
- await installWorkspacePackages();
-
- await silentNg('generate', 'component', 'home');
- await writeFile(
- 'src/app/app.routes.ts',
- `
- import { Routes } from '@angular/router';
- import {HomeComponent} from './home/home.component';
-
- export const routes: Routes = [{
- path: 'sub/home',
- component: HomeComponent
- }];
- `,
- );
-
- const port = await findFreePort();
- await execAndWaitForOutputToMatch('ng', ['serve', '--port', `${port}`], /complete/, {
- ...process.env,
- NO_COLOR: 'true',
- });
-
- const [, response] = await Promise.all([
- assert.rejects(
- waitForAnyProcessOutputToMatch(/Pre-transform error: Failed to load url/, 8_000),
- ),
- fetch(`http://localhost:${port}/sub/home`),
- ]);
-
- assert(response.ok, `Expected 'response.ok' to be 'true'.`);
-}
diff --git a/tests/legacy-cli/e2e/tests/vite/ssr-with-ssl.ts b/tests/legacy-cli/e2e/tests/vite/ssr-with-ssl.ts
index 5e0a74638527..c4c0fd34ec75 100644
--- a/tests/legacy-cli/e2e/tests/vite/ssr-with-ssl.ts
+++ b/tests/legacy-cli/e2e/tests/vite/ssr-with-ssl.ts
@@ -13,19 +13,19 @@ export default async function () {
// Forcibly remove in case another test doesn't clean itself up.
await uninstallPackage('@angular/ssr');
- await ng('add', '@angular/ssr', '--server-routing', '--skip-confirmation', '--skip-install');
+ await ng('add', '@angular/ssr', '--skip-confirmation', '--skip-install');
await useSha();
await installWorkspacePackages();
await writeMultipleFiles({
- // Replace the template of app.component.ng.html as it makes it harder to debug
- 'src/app/app.component.ng.html': ' ',
+ // Replace the template of app.ng.html as it makes it harder to debug
+ 'src/app/app.html': ' ',
'src/app/app.routes.ts': `
import { Routes } from '@angular/router';
- import { HomeComponent } from './home/home.component';
+ import { Home } from './home/home';
export const routes: Routes = [
- { path: 'home', component: HomeComponent }
+ { path: 'home', component: Home }
];
`,
'src/app/app.routes.server.ts': `
diff --git a/tests/legacy-cli/e2e/utils/BUILD.bazel b/tests/legacy-cli/e2e/utils/BUILD.bazel
index 4d690d4bace2..044c1ba409bd 100644
--- a/tests/legacy-cli/e2e/utils/BUILD.bazel
+++ b/tests/legacy-cli/e2e/utils/BUILD.bazel
@@ -17,11 +17,11 @@ ts_project(
"//:node_modules/fast-glob",
"//:node_modules/npm",
"//:node_modules/protractor",
- "//:node_modules/rxjs",
"//:node_modules/semver",
"//:node_modules/tar",
- "//:node_modules/tree-kill",
"//:node_modules/verdaccio",
"//:node_modules/verdaccio-auth-memory",
+ "//tests:node_modules/rxjs",
+ "//tests:node_modules/tree-kill",
],
)
diff --git a/tests/legacy-cli/e2e/utils/project.ts b/tests/legacy-cli/e2e/utils/project.ts
index 64419ccc1873..ea764bb20314 100644
--- a/tests/legacy-cli/e2e/utils/project.ts
+++ b/tests/legacy-cli/e2e/utils/project.ts
@@ -205,21 +205,20 @@ export function isPrereleaseCli(): boolean {
return (prerelease(getNgCLIVersion())?.length ?? 0) > 0;
}
-export function updateServerFileForWebpack(filepath: string): Promise {
+export function updateServerFileForEsbuild(filepath: string): Promise {
return writeFile(
filepath,
`
import { APP_BASE_HREF } from '@angular/common';
import { CommonEngine } from '@angular/ssr/node';
import express from 'express';
- import { fileURLToPath } from 'node:url';
- import { dirname, join, resolve } from 'node:path';
+ import { join, resolve } from 'node:path';
import bootstrap from './main.server';
// The Express app is exported so that it can be used by serverless Functions.
export function app(): express.Express {
const server = express();
- const serverDistFolder = dirname(fileURLToPath(import.meta.url));
+ const serverDistFolder = import.meta.dirname;
const browserDistFolder = resolve(serverDistFolder, '../browser');
const indexHtml = join(serverDistFolder, 'index.server.html');
@@ -228,13 +227,13 @@ export function updateServerFileForWebpack(filepath: string): Promise {
server.set('view engine', 'html');
server.set('views', browserDistFolder);
- server.get('**', express.static(browserDistFolder, {
+ server.use(express.static(browserDistFolder, {
maxAge: '1y',
- index: 'index.html',
+ index: false,
}));
// All regular routes use the Angular engine
- server.get('**', (req, res, next) => {
+ server.use((req, res, next) => {
const { protocol, originalUrl, baseUrl, headers } = req;
commonEngine
@@ -255,7 +254,10 @@ export function updateServerFileForWebpack(filepath: string): Promise {
function run(): void {
const port = process.env['PORT'] || 4000;
const server = app();
- server.listen(port, () => {
+ server.listen(port, (error) => {
+ if (error) {
+ throw error;
+ }
console.log(\`Node Express server listening on http://localhost:\${port}\`);
});
}
diff --git a/tests/legacy-cli/e2e_runner.ts b/tests/legacy-cli/e2e_runner.ts
index 01f5a6683c27..21377c015845 100644
--- a/tests/legacy-cli/e2e_runner.ts
+++ b/tests/legacy-cli/e2e_runner.ts
@@ -257,10 +257,8 @@ Promise.all([findFreePort(), findFreePort(), findPackageTars()])
console.log(`Current Directory: ${process.cwd()}`);
console.log('Will loop forever while you debug... CTRL-C to quit.');
- /* eslint-disable no-constant-condition */
- while (1) {
- // That's right!
- }
+ // Wait forever until user explicitly cancels.
+ await new Promise(() => {});
}
process.exitCode = 1;
diff --git a/tests/package.json b/tests/package.json
index b185a3ce0da7..4aec9553824b 100644
--- a/tests/package.json
+++ b/tests/package.json
@@ -1,5 +1,7 @@
{
"devDependencies": {
- "@angular-devkit/schematics": "workspace:*"
+ "@angular-devkit/schematics": "workspace:*",
+ "rxjs": "7.8.2",
+ "tree-kill": "1.2.2"
}
}
diff --git a/tools/BUILD.bazel b/tools/BUILD.bazel
index ab42b524c5d5..3cb815f2db9c 100644
--- a/tools/BUILD.bazel
+++ b/tools/BUILD.bazel
@@ -1,5 +1,5 @@
load("@bazel_skylib//rules:copy_file.bzl", "copy_file")
-load("//tools:defaults2.bzl", "js_binary")
+load("//tools:defaults.bzl", "js_binary")
package(default_visibility = ["//visibility:public"])
diff --git a/tools/bazel/npm_package.bzl b/tools/bazel/npm_package.bzl
index fc912f3d125d..0a76bfe1bb73 100644
--- a/tools/bazel/npm_package.bzl
+++ b/tools/bazel/npm_package.bzl
@@ -63,8 +63,8 @@ def npm_package(
out = "substituted_with_snapshot_repos/package.json",
)
- nostamp_subs = dict(substitutions["rjs"]["nostamp"], **extra_substitutions)
- stamp_subs = dict(substitutions["rjs"]["stamp"], **extra_substitutions)
+ nostamp_subs = dict(substitutions["nostamp"], **extra_substitutions)
+ stamp_subs = dict(substitutions["stamp"], **extra_substitutions)
expand_template(
name = "final_package_json",
diff --git a/tools/defaults2.bzl b/tools/defaults.bzl
similarity index 88%
rename from tools/defaults2.bzl
rename to tools/defaults.bzl
index 31af54a7644a..ecd71071d42b 100644
--- a/tools/defaults2.bzl
+++ b/tools/defaults.bzl
@@ -1,7 +1,7 @@
load("@aspect_bazel_lib//lib:copy_to_bin.bzl", _copy_to_bin = "copy_to_bin")
load("@aspect_rules_jasmine//jasmine:defs.bzl", _jasmine_test = "jasmine_test")
load("@aspect_rules_js//js:defs.bzl", _js_binary = "js_binary")
-load("@npm//@angular/bazel:index.bzl", _ng_package = "ng_package")
+load("@rules_angular//src/ng_package:index.bzl", _ng_package = "ng_package")
load("//tools:interop.bzl", _ts_project = "ts_project")
load("//tools:substitutions.bzl", "substitutions")
load("//tools/bazel:npm_package.bzl", _npm_package = "npm_package")
@@ -23,8 +23,8 @@ def ng_package(deps = [], **kwargs):
deps = deps,
license = "//:LICENSE",
substitutions = select({
- "//:stamp": substitutions["legacy"]["stamp"],
- "//conditions:default": substitutions["legacy"]["nostamp"],
+ "//:stamp": substitutions["stamp"],
+ "//conditions:default": substitutions["nostamp"],
}),
**kwargs
)
diff --git a/tools/substitutions.bzl b/tools/substitutions.bzl
index ab0dfb46e0a9..098b511b1d6e 100644
--- a/tools/substitutions.bzl
+++ b/tools/substitutions.bzl
@@ -2,8 +2,8 @@ load("//:constants.bzl", "ANGULAR_FW_PEER_DEP", "ANGULAR_FW_VERSION", "NG_PACKAG
_stamp_substitutions = {
# Version of the local package being built, generated via the `--workspace_status_command` flag.
- "0.0.0-PLACEHOLDER": "{STABLE_PROJECT_VERSION}",
- "0.0.0-EXPERIMENTAL-PLACEHOLDER": "{STABLE_PROJECT_EXPERIMENTAL_VERSION}",
+ "0.0.0-PLACEHOLDER": "{{STABLE_PROJECT_VERSION}}",
+ "0.0.0-EXPERIMENTAL-PLACEHOLDER": "{{STABLE_PROJECT_EXPERIMENTAL_VERSION}}",
# ---
"BUILD_SCM_HASH-PLACEHOLDER": "{BUILD_SCM_ABBREV_HASH}",
"0.0.0-ENGINES-NODE": RELEASE_ENGINES_NODE,
@@ -22,21 +22,7 @@ _no_stamp_substitutions = dict(_stamp_substitutions, **{
"0.0.0-EXPERIMENTAL-PLACEHOLDER": "0.0.0",
})
-def _adjust_substitutions_for_rules_js(subs):
- result = {}
- for key, value in subs.items():
- # in `rules_js`, or `expand_template` from `bazel-lib`, stamp variables
- # can only be retrieved via `{{X}}` syntax.
- result[key] = value.replace("{", "{{").replace("}", "}}")
- return result
-
substitutions = {
- "legacy": {
- "stamp": _stamp_substitutions,
- "nostamp": _no_stamp_substitutions,
- },
- "rjs": {
- "stamp": _adjust_substitutions_for_rules_js(_stamp_substitutions),
- "nostamp": _adjust_substitutions_for_rules_js(_no_stamp_substitutions),
- },
+ "stamp": _stamp_substitutions,
+ "nostamp": _no_stamp_substitutions,
}
diff --git a/tsconfig.json b/tsconfig.json
index 4df52a94fea7..f00528f2698f 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -11,8 +11,8 @@
"isolatedModules": true,
"skipLibCheck": true,
"strict": true,
- "target": "es2022",
- "lib": ["es2022"],
+ "target": "es2023",
+ "lib": ["es2023"],
"rootDir": ".",
"rootDirs": [".", "./dist-schema/bin/"],
"paths": {