19.0.0-next.0 (2024-08-14)
core
Commit | Description |
---|---|
rethrow errors during ApplicationRef.tick in TestBed (#57200) |
router
Commit | Description |
---|---|
Add routerOutletData input to RouterOutlet directive (#57051)
| |
Align RouterModule.forRoot errorHandler with provider error handler (#57050) | |
Update Resolve interface to include RedirectCommand like ResolveFn (#57309) |
Breaking Changes
core
-
Errors that are thrown during
ApplicationRef.tick
will now be rethrown when usingTestBed
. These errors should be
resolved by ensuring the test environment is set up correctly to
complete change detection successfully. There are two alternatives to
catch the errors:- Instead of waiting for automatic change detection to happen, trigger
it synchronously and expect the error. For example, a jasmine test
could writeexpect(() => TestBed.inject(ApplicationRef).tick()).toThrow()
TestBed
will reject any outstandingComponentFixture.whenStable
promises. A jasmine test,
for example, could writeexpectAsync(fixture.whenStable()).toBeRejected()
.
As a last resort, you can configure errors to not be rethrown by
settingrethrowApplicationErrors
tofalse
inTestBed.configureTestingModule
. - Instead of waiting for automatic change detection to happen, trigger
router
- The
Router.errorHandler
property has been removed.
Adding an error handler should be configured in either
withNavigationErrorHandler
withprovideRouter
or theerrorHandler
property in the extra options ofRouterModule.forRoot
. In addition,
the error handler cannot be used to change the return value of the
router navigation promise or prevent it from rejecting. Instead, if you
want to prevent the promise from rejecting, useresolveNavigationPromiseOnError
. - The return type of the
Resolve
interface now includes
RedirectCommand
.