Top AI Repos — open-source AI, indexed and scored
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
This library makes RxJS Observables testing easy!
| Date | Stars |
|---|---|
| 2026-07-24 | 375 |
| 2026-07-25 | 375 |
| 2026-07-28 | 375 |
| 2026-07-30 | 375 |
| 2026-08-06 | 375 |
Today
— stars today
This week
— stars this week
This month
— stars this month
Momentum
0.0
growth rate 0.00%/day
# @hirez_io/observer-spy 👀💪
This library makes RxJS Observables testing easy!
[](https://www.npmjs.org/package/@hirez_io/observer-spy)
[](http://npm-stat.com/charts.html?package=@hirez_io/observer-spy&from=2017-07-26)

[](https://opensource.org/licenses/MIT)
[](https://codecov.io/gh/hirezio/observer-spy) <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->
<br/>
<div align="center">
<a href="https://hirez.io/?utm_source=github&utm_medium=link&utm_campaign=observer-spy">
<img src="for-readme/test-angular.jpg"
alt="TestAngular.com - Free Angular Testing Workshop - The Roadmap to Angular Testing Mastery"
width="600"
/>
</a>
</div>
<br/>
# Table of Contents
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
- [Installation](#installation)
- [The Problem](#the-problem-testing-rxjs-observables-is-hard-)
- [The Solution](#the-solution-observer-spies-)
- [Usage](#usage)
- [`subscribeSpyTo(observable)`](#const-observerspy--subscribespytoobservable)
- [`onComplete` (using `async` + `await`)](#wait-for-oncomplete-before-expecting-the-result-using-async--await)
- [Spying on Errors (`expectErrors`)](#spy-on-errors-with-receivederror-and-geterror)
- [`onError` (using `async` + `await`)](#wait-for-onerror-before-expecting-the-result-using-async--await)
- [Manually Creating Spies](#manually-using-new-observerspy)
- [Auto Unsubscribing](#auto-unsubscribing)
- [Testing Sync Logic](#testing-sync-logic)
- [Testing Async Logic](#testing-async-logic)
- [▶ RxJS + Angular: use `fakeAsync`](#-rxjs---angular-use-fakeasync)
- [▶ RxJS + Promises: use `async` + `await`](#-rxjs--promises-use-async--await)
- [▶ RxJS Timers / Animations: use `fakeTime`](#-rxjs-timers--animations-use-faketime)
- [▶ RxJS + _AJAX_ calls:](#-rxjs--ajax-calls)
- [🧠 Wanna become a PRO Observables tester?](#-wanna-become-a-pro-observables-tester)
- [How to Contribute](#contributing)
- [Code Of Conduct](#code-of-conduct)
- [Contributors ✨](#contributors-)
- [License](#license)
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
<br/>
## Installation
```console
yarn add -D @hirez_io/observer-spy
```
or
```console
npm install -D @hirez_io/observer-spy
```
<br/>
## THE PROBLEM: Testing RxJS observables is hard! 😓
Especially when testing advanced use cases.
Until this library, the common way to test observables was to use [Marble tests](https://rxjs-dev.firebaseapp.com/guide/testing/internal-marble-tests)
### What are the disadvantages of Marble Tests?
Marble tests are very powerful, but unfortunately for most tests they are conceptually very complicated to learn and to reason about..
You need to learn and understand `cold` and `hot` observables, `schedulers` and to learn a new syntax just to test a simple observable chain.
More complex observable chains tests get even harder to read and to maintain.
<br/>
<br/>
## THE SOLUTION: Observer Spies! 👀💪
The **Observer-Spy** library was created to present a viable alternative to Marble Tests.
An alternative which we believe is:
* ✅ **Easier** to understand
* ✅ **Reduces** the complexity
* ✅ Makes observables tests **cleaner**
<br/>
### Here's what people had to say:
![image](https://user-images.githubusercontent.com/1430726/95263162-0cbe8200Excerpt of 22,401 characters
Read on GitHubWould you bet a product on this? Bounded 0–100 and slow moving.
matched fp:fe05d1e81d56a4de, topic:testing