Registry / testing / mountebank-test

mountebank-test

JSON →
library1.4.954jsnpmunverified

mountebank is the first open source tool for cross-platform, multi-protocol test doubles over the wire. It supports HTTP, HTTPS, TCP (text and binary), and SMTP protocols. Current stable version is 2.9.4, published under the @mbtest/mountebank package (was formerly mountebank). The community-driven project requires Node.js >=20. It offers mock verification, stubbing with advanced predicates, JavaScript injection, and record-playback through proxying, distinguishing itself from alternatives like WireMock by supporting multiple protocols and being fully open source without platform constraints. Releases are maintained by the mountebank-testing organization.

npm install mountebank-test
INSTALL
IMPORT
SIG · MOUNTEBANK-TEST
M
mountebank-test
testingjavascriptv1.4.954
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

mb
import { spawn } from '@mbtest/mountebank'; const mb = spawn({ port: 2525 });
import mb from 'mountebank';
Since v2.9.2 the package name is @mbtest/mountebank. The CLI command is 'mb', imported via spawn function for programmatic usage.
MountebankClient
import { MountebankClient } from '@mbtest/mountebank/client';
import MountebankClient from 'mountebank';
Client class for API interaction; path may vary; check docs.
Imposter
import { Imposter } from '@mbtest/mountebank';
const Imposter = require('mountebank').Imposter;
ESM module; CommonJS require is deprecated.

Creates and starts an HTTP imposter on port 3000 with a stub responding to /api/data.

import { spawn, Imposter, Stub } from '@mbtest/mountebank'; const mb = spawn({ port: 2525, loglevel: 'debug' }); const imposter = new Imposter({ port: 3000, protocol: 'http', name: 'test' }); const stub = new Stub().withPredicate({ equals: { path: '/api/data' } }).withResponse({ statusCode: 200, body: { data: 'success' } }); await mb.use(imposter); await mb.start(); console.log('mountebank running on port 2525'); // ... use imposter ... await mb.close();
mountebank --version
Debug
Known issues
breakingPackage name changed from mountebank to @mbtest/mountebank in v2.9.2. Update install commands and imports accordingly.
fix
Use `npm install --save-dev @mbtest/mountebank` and update import paths to '@mbtest/mountebank'.
affects: >=2.9.2
breakingMinimum Node.js version updated to 20 in v2.9.4.
fix
Upgrade Node.js to version 20 or higher.
affects: >=2.9.4
deprecatedmountebank v1.x (npm package mountebank) is deprecated; use @mbtest/mountebank v2.x.
fix
Migrate to @mbtest/mountebank v2.9.4.
affects: <=1.x
gotchaNode 24 required for Docker image in v2.9.4; local install works with Node 20+.
fix
Use Node 20+ for local development; Docker users must use Node 24 image.
affects: >=2.9.4
breakingnodemailer dependency updated to v8 in v2.9.4, which may break custom email handling.
fix
Update SMTP-related code to be compatible with nodemailer v8.
affects: >=2.9.4
Errors
Common errors & fixes
Error: Cannot find module 'mountebank'
Using outdated package name mountebank instead of @mbtest/mountebank.
fix
Run `npm install @mbtest/mountebank` and update imports to '@mbtest/mountebank'.
TypeError: mb.spawn is not a function
Incorrect import of 'spawn' from '@mbtest/mountebank'.
fix
Use `import { spawn } from '@mbtest/mountebank';` then `const mb = spawn({...});`.
SyntaxError: The requested module '@mbtest/mountebank' does not provide an export named 'default'
Using default import when package only exports named exports.
fix
Use named import: `import { spawn, Imposter } from '@mbtest/mountebank';`
Upgrade
Version history
1.4.954latest on npm
Audit
Dependencies
nodemailerrequiredSMTP protocol support
mountebank-formattersoptionalOptional formatters for response formatting
Agent activity
2 hits · last 30 days
node
2
Resources
mountebank-test — npm install mountebank-test · libregistry