In a previous post I talked about how to use Observable.throw to simulate an Observable error in a unit test. However, in RxJS 6, the syntax changed a bit. I also talked about this a bit in this post about using of to create Observables on the fly for testing in RxJS 6, but I didn’t think about the error paths…
RxJS 6
Instead of throw, they have introduced the standalone throwError. It basically works the same, but if you (like me) are used to the old way, it is a little confusing as to why it doesn’t work the way you expect it to.