{"id":25958,"library":"mountebank-test","title":"mountebank","description":"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.","status":"active","version":"1.4.954","language":"javascript","source_language":"en","source_url":"https://github.com/bbyars/mountebank","tags":["javascript","test","stub","mock","double","smtp","email","http","https"],"install":[{"cmd":"npm install mountebank-test","lang":"bash","label":"npm"},{"cmd":"yarn add mountebank-test","lang":"bash","label":"yarn"},{"cmd":"pnpm add mountebank-test","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"SMTP protocol support","package":"nodemailer","optional":false},{"reason":"Optional formatters for response formatting","package":"mountebank-formatters","optional":true}],"imports":[{"note":"Since v2.9.2 the package name is @mbtest/mountebank. The CLI command is 'mb', imported via spawn function for programmatic usage.","wrong":"import mb from 'mountebank';","symbol":"mb","correct":"import { spawn } from '@mbtest/mountebank';\nconst mb = spawn({ port: 2525 });"},{"note":"Client class for API interaction; path may vary; check docs.","wrong":"import MountebankClient from 'mountebank';","symbol":"MountebankClient","correct":"import { MountebankClient } from '@mbtest/mountebank/client';"},{"note":"ESM module; CommonJS require is deprecated.","wrong":"const Imposter = require('mountebank').Imposter;","symbol":"Imposter","correct":"import { Imposter } from '@mbtest/mountebank';"}],"quickstart":{"code":"import { spawn, Imposter, Stub } from '@mbtest/mountebank';\n\nconst mb = spawn({ port: 2525, loglevel: 'debug' });\nconst imposter = new Imposter({ port: 3000, protocol: 'http', name: 'test' });\nconst stub = new Stub().withPredicate({ equals: { path: '/api/data' } }).withResponse({ statusCode: 200, body: { data: 'success' } });\nawait mb.use(imposter);\nawait mb.start();\nconsole.log('mountebank running on port 2525');\n// ... use imposter ...\nawait mb.close();","lang":"typescript","description":"Creates and starts an HTTP imposter on port 3000 with a stub responding to /api/data."},"warnings":[{"fix":"Use `npm install --save-dev @mbtest/mountebank` and update import paths to '@mbtest/mountebank'.","message":"Package name changed from mountebank to @mbtest/mountebank in v2.9.2. Update install commands and imports accordingly.","severity":"breaking","affected_versions":">=2.9.2"},{"fix":"Upgrade Node.js to version 20 or higher.","message":"Minimum Node.js version updated to 20 in v2.9.4.","severity":"breaking","affected_versions":">=2.9.4"},{"fix":"Migrate to @mbtest/mountebank v2.9.4.","message":"mountebank v1.x (npm package mountebank) is deprecated; use @mbtest/mountebank v2.x.","severity":"deprecated","affected_versions":"<=1.x"},{"fix":"Use Node 20+ for local development; Docker users must use Node 24 image.","message":"Node 24 required for Docker image in v2.9.4; local install works with Node 20+.","severity":"gotcha","affected_versions":">=2.9.4"},{"fix":"Update SMTP-related code to be compatible with nodemailer v8.","message":"nodemailer dependency updated to v8 in v2.9.4, which may break custom email handling.","severity":"breaking","affected_versions":">=2.9.4"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run `npm install @mbtest/mountebank` and update imports to '@mbtest/mountebank'.","cause":"Using outdated package name mountebank instead of @mbtest/mountebank.","error":"Error: Cannot find module 'mountebank'"},{"fix":"Use `import { spawn } from '@mbtest/mountebank';` then `const mb = spawn({...});`.","cause":"Incorrect import of 'spawn' from '@mbtest/mountebank'.","error":"TypeError: mb.spawn is not a function"},{"fix":"Use named import: `import { spawn, Imposter } from '@mbtest/mountebank';`","cause":"Using default import when package only exports named exports.","error":"SyntaxError: The requested module '@mbtest/mountebank' does not provide an export named 'default'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}