From aa7be7f32079f1cc486e21ff83932f701ff55797 Mon Sep 17 00:00:00 2001 From: Atchyut Pulavarthi Date: Fri, 14 Jun 2024 10:45:14 +0530 Subject: [PATCH] fix(@angular/cli): update schematics to use RouterModule when --routing flag is present update schematics to use RouterModule instead of RouterTestingModule when generating a new project with the --routing flag Fixes #27691 --- .../files/module-files/src/app/app.component.spec.ts.template | 4 ++-- .../e2e/assets/15.0-project/src/app/app.component.spec.ts | 4 ++-- .../18-ssr-project-webpack/src/app/app.component.spec.ts | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/schematics/angular/application/files/module-files/src/app/app.component.spec.ts.template b/packages/schematics/angular/application/files/module-files/src/app/app.component.spec.ts.template index eef727c672ca..c567ade0de2c 100644 --- a/packages/schematics/angular/application/files/module-files/src/app/app.component.spec.ts.template +++ b/packages/schematics/angular/application/files/module-files/src/app/app.component.spec.ts.template @@ -1,12 +1,12 @@ import { TestBed } from '@angular/core/testing';<% if (routing) { %> -import { RouterTestingModule } from '@angular/router/testing';<% } %> +import { RouterModule } from '@angular/router';<% } %> import { AppComponent } from './app.component'; describe('AppComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({<% if (routing) { %> imports: [ - RouterTestingModule + RouterModule.forRoot([]) ],<% } %> declarations: [ AppComponent diff --git a/tests/legacy-cli/e2e/assets/15.0-project/src/app/app.component.spec.ts b/tests/legacy-cli/e2e/assets/15.0-project/src/app/app.component.spec.ts index b7b4722d8cbc..803558e830fb 100644 --- a/tests/legacy-cli/e2e/assets/15.0-project/src/app/app.component.spec.ts +++ b/tests/legacy-cli/e2e/assets/15.0-project/src/app/app.component.spec.ts @@ -1,12 +1,12 @@ import { TestBed } from '@angular/core/testing'; -import { RouterTestingModule } from '@angular/router/testing'; +import { RouterModule } from '@angular/router'; import { AppComponent } from './app.component'; describe('AppComponent', () => { beforeEach(async () => { await TestBed.configureTestingModule({ imports: [ - RouterTestingModule + RouterModule.forRoot([]) ], declarations: [ AppComponent diff --git a/tests/legacy-cli/e2e/assets/18-ssr-project-webpack/src/app/app.component.spec.ts b/tests/legacy-cli/e2e/assets/18-ssr-project-webpack/src/app/app.component.spec.ts index 2f9f07ca654a..4e872828790f 100644 --- a/tests/legacy-cli/e2e/assets/18-ssr-project-webpack/src/app/app.component.spec.ts +++ b/tests/legacy-cli/e2e/assets/18-ssr-project-webpack/src/app/app.component.spec.ts @@ -1,10 +1,10 @@ import { TestBed } from '@angular/core/testing'; -import { RouterTestingModule } from '@angular/router/testing'; +import { RouterModule } from '@angular/router'; import { AppComponent } from './app.component'; describe('AppComponent', () => { beforeEach(() => TestBed.configureTestingModule({ - imports: [RouterTestingModule], + imports: [RouterModule.forRoot([])], declarations: [AppComponent] }));