Streamtest is a JavaScript library providing a robust set of utilities specifically designed for testing Node.js stream-based modules. It simplifies the creation of test input streams and the collection of output from streams under test. Developers can easily generate readable streams from arrays of data chunks or objects using methods like `fromChunks` and `fromObjects`, and then collect results from writable streams into promises that resolve with processed text, raw chunks, or objects via `toText`, `toChunks`, and `toObjects`. The current stable version is 4.0.0, and it primarily targets modern Node.js environments (v24.14.0+). Its key differentiator is providing a concise and intuitive API for stream testing, significantly reducing boilerplate compared to manually managing stream events and states, making it an ideal choice for projects with extensive stream processing logic.
npm install streamtestVerified import paths — ran on the pinned version, not inferred.
Demonstrates creating input streams with `fromChunks` and `fromObjects`, piping data through a test stream, and capturing the processed output with `toText` and `toObjects` for assertion.
Upgrade your Node.js environment to version 24.14.0 or newer. Consider using `nvm` or `volta` to manage Node.js versions.
Ensure your project is configured for ESM (e.g., `"type": "module"` in `package.json`) and use `import StreamTest from 'streamtest';` for all imports.
Refactor asynchronous test blocks to be `async` functions and `await` the `resultPromise` returned by `toText()`, `toChunks()`, or `toObjects()`.
Configure your project to use ESM by adding `"type": "module"` to your `package.json` or by using `.mjs` file extensions for modules that use `import`.
Access `streamtest` utilities directly as properties of the imported `StreamTest` object, e.g., `StreamTest.fromChunks()` or `StreamTest.toText()`.
Verify that your environment is configured for ESM and you are using `import StreamTest from 'streamtest';`. Also, check your Node.js version meets the `>=24.14.0` requirement.
No dependency data recorded yet.