The `haraka-test-fixtures` package provides a comprehensive set of mock objects and utilities specifically designed for testing Haraka SMTP server plugins and core components. It enables developers to create isolated test environments by simulating key Haraka abstractions such as `Connection`, `Transaction`, `Plugin`, `Logger`, and `Results` objects without the overhead of running a full Haraka server. This allows for focused unit and integration testing of plugin logic. The current stable version is 1.4.1, released with bug fixes and dependency updates. Releases follow an ad-hoc schedule, primarily driven by maintenance requirements, synchronization with the main Haraka project, and dependency bumps. Its key differentiator lies in its deep integration and direct analogy to Haraka's internal architecture, providing tailor-made testing primitives that generic mocking libraries cannot easily replicate. It helps abstract away the complexities of Haraka's lifecycle for efficient plugin development and testing.
npm install haraka-test-fixturesVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to set up and use `haraka-test-fixtures` to test a Haraka plugin, including creating plugin and connection fixtures and invoking a hook.
Remove all references and usage of `vm_harness` from your test suite. If you had custom logic built around it, you will need to refactor those tests to use alternative fixtures or approaches.
Ensure your development and CI environments are using Node.js version 20 or higher to maintain compatibility and prevent runtime issues.
For consistent and documented behavior, use CommonJS `require()` statements (e.g., `const fixtures = require('haraka-test-fixtures')`). If ESM is strictly required, ensure your project's module resolution is correctly configured for CommonJS interop.Update your tests to remove any usage or reference to `vm_harness`. This fixture is no longer part of the package.
Ensure that `connection` objects are correctly created using `fixtures.connection.createConnection()` and that necessary initialization methods like `init_transaction()` are called before attempting to use transaction-related features.
Install the package using npm: `npm install --save-dev haraka-test-fixtures`. Verify the module path if the error persists in a non-standard setup.
No dependency data recorded yet.