79531859

Date: 2025-03-24 18:31:55
Score: 1
Natty:
Report link

This answer is different than the others posted here. Starting with Angular 17, the RouterTestingModule is deprecated. For my use case, after upgrading to Angular 17, my VsCode began flagging this deprecation:

RouterTestingModule as import

RouterTestingModule must be replaced by provideRouter, but note this is a provider now, not an import. So the following error was thrown by the Jasmine compiler when provideRouter was placed under imports:

unexpected valuie DynamicTestModule

The solution was to simply move the provider to where it should have gone (under providers) - and the error was no longer thrown:

provideRouter is an import

This blog entry shows a full example using provideRouter.

Reasons:
  • Blacklisted phrase (1): This blog
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
Posted by: CSSBurner