mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
|
|
||
|---|---|---|
| .. | ||
| BUILD.bazel | ||
| index.ts | ||
| migration.ts | ||
| README.md | ||
| schema.json | ||
| types.ts | ||
| utils.ts | ||
RouterTestingModule Migration
This migration automatically converts deprecated RouterTestingModule usages to the recommended modern APIs.
What it does
- Replaces
RouterTestingModule.withRoutes([...])withRouterModule.forRoot([...])for NgModule tests - Replaces
RouterTestingModulewithRouterModule.forRoot([])when no routes are provided - For standalone tests (detected by presence of
providers), moves toprovideRouter([...])instead - Updates import statements to use
@angular/routerinstead of@angular/router/testing - Preserves other imports and test configuration
Files
router_testing_module_migration.ts- Main migration logic using TsurgeFunnelMigrationindex.ts- Entry point for the schematic../../test/router_testing_to_provide_router_spec.ts- Comprehensive test suiteMIGRATION_NOTES.md- Detailed documentation with examplesBUILD.bazel- Bazel build configuration
Running the migration
The migration runs automatically as part of ng update @angular/core for v21.0.0+.
To run manually:
ng update @angular/core --migrate-only router-testing-to-provide-router
Related
- Issue: angular/angular#54853
- Deprecation: angular/angular#54466