When using Jasmine, I have implemented tests to handle error logic from a subscribed Observable.
this.apiService
.post({})
.pipe(
take(1),
catchError((e) => {
return throwError(() => e);
})
)
.subscribe(() => {});
The goal is to rethrow the error so it can be managed outside of the component in a custom error handler.
Chrome Headless 109.0.5412.0 (Linux x86_64) ERROR
An error was thrown in afterAll
[object Object] thrown
[object Object] thrown
[object Object] thrown
I initially attempted to override the ErrorHandler
with a spy, but it did not have any effect.
I also experimented with using the jasmine.spyOnGlobalErrorsAsync
, which still resulted in errors being produced.
Any suggestions or ideas on how to address this issue?