A set of helper functions and Jest matchers for RxJS marble testing, making reactive code testing easy and clear.
jest-marbles is a helper library for testing RxJS observables using marble diagram syntax within Jest. It provides custom matchers and utilities to verify observable emissions, subscriptions, and side effects in a clear, visual way. The library solves the problem of writing verbose and error-prone tests for reactive streams by leveraging intuitive marble strings.
Developers working with RxJS who need to write unit tests for reactive code using Jest. It's particularly useful for those familiar with marble testing syntax and looking to integrate it seamlessly into their Jest test suites.
Developers choose jest-marbles because it reduces boilerplate, provides readable test assertions with marble diagrams, and offers detailed, visual error messages when tests fail. Its tight integration with Jest and support for TypeScript make it a robust choice for testing complex reactive workflows.
Helpers library for marbles testing with Jest
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Provides marblized diff outputs when tests fail, making it easy to spot discrepancies in observable streams, as demonstrated in the README's example failure outputs.
Includes custom Jest matchers like toBeObservable and toHaveSubscriptions, allowing thorough testing of emissions, subscriptions, and side effects, as detailed in the usage section.
Offers a schedule helper to programmatically emit values at specific time frames, useful for precise testing of timed behaviors, shown in the scheduling example.
Built with TypeScript, providing type safety and enhanced developer experience, as noted in the features list.
The README explicitly states that time progression syntax is not supported, limiting tests for complex temporal scenarios that require fine-grained time manipulation.
Requires familiarity with RxJS marble testing syntax, which has a steep learning curve and isn't intuitive for developers new to reactive programming.
Installation varies for different RxJS versions (e.g., RxJS 5, 6, 7), adding configuration complexity and potential compatibility issues.