Kefir-test-utils is a dedicated, framework-agnostic library providing a set of utilities specifically designed for testing Kefir.js observables. It enables developers to write robust unit tests for reactive streams by offering tools to control time, watch observable emissions, and assert their behavior over virtual timelines. The current stable version is 2.0.0, released in late 2023, following a period of maintenance and dependency upgrades. While its release cadence appears measured, recent updates indicate active development, focusing on modern JavaScript environments and dependency health. Key differentiators include its tight integration and specialization for the Kefir.js ecosystem, having been extracted from `chai-kefir` to offer a standalone, reusable set of testing primitives without tying to a specific assertion library or test framework. It is crucial for anyone building complex reactive applications with Kefir.js who needs precise control over testing asynchronous stream logic, offering a structured approach to virtual time testing that is typically more challenging with general-purpose testing tools.
npm install kefir-test-utilsVerified import paths — ran on the pinned version, not inferred.
Demonstrates basic usage of `withTime` and `watch` to test a Kefir observable's emissions and completion over a virtual timeline, including how to handle and assert error scenarios.
Review existing tests, especially those with precise timing assertions or complex virtual time interactions, and adjust expectations if behavior subtly changes due to the underlying fake timer implementation's update.
Ensure your project's Node.js environment is v12 or higher. Upgrade Node.js if necessary to avoid compatibility issues and leverage modern language features.
Install `kefir` in your project's dependencies: `npm install kefir` or `yarn add kefir`.
Install the 'kefir' package: `npm install kefir` or `yarn add kefir`.
For CommonJS environments, ensure you use `const { withTime } = require('kefir-test-utils');`. For ESM (recommended since v2.0.0), use `import { withTime } from 'kefir-test-utils';`.