Cookies concent notice

This site uses cookies from Google to deliver its services and to analyze traffic.
Learn more
Skip to main content
This site is no longer updated.Head to Angular.devHome
/

This is the archived documentation for Angular v17. Please visit angular.dev to see this page for the current version of Angular.

@angular/router/testing

Supplies a testing module for the Angular Router subsystem.

Entry point exports

NgModules

RouterTestingModule

Deprecated: Use provideRouter or RouterModule/RouterModule.forRoot instead. This module was previously used to provide a helpful collection of test fakes, most notably those for Location and LocationStrategy. These are generally not required anymore, as MockPlatformLocation is provided in TestBed by default. However, you can use them directly with provideLocationMocks.

Sets up the router to be used for testing.

Classes

RouterTestingHarness

A testing harness for the Router to reduce the boilerplate needed to test routes and routed components.