Skip to content

Automatic migration for RouterTestingModule to provideRouter([]) or RouterModule #54853

@JasonWeinzierl

Description

@JasonWeinzierl

Which @angular/* package(s) are relevant/related to the feature request?

router

Description

If a project upgrades to Angular 17.3.0, RouterTestingModule's deprecation (#54466) will cause a ton of warnings/errors if that project has linter rules against deprecated APIs. Can Angular provide an official migration for this?

Proposed solution

Automatically migrate from this:

imports: [
  ...
  RouterTestingModule.withRoutes([]),
  ...
],

to this if the component is not standalone:

imports: [
  ...
  RouterModule.forRoot([]),
  ...
],

or to this if the component is standalone:

providers: [
  ...
  provideRouter([]),
  ...
],

and fix the relevant import statements.

Alternatives considered

Manually migrate everything.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions