Mocha
mochajs.org
What it is
Mocha is a free, open-source JavaScript test framework that runs in Node.js and browsers. Tests run serially by default, and uncaught exceptions are associated with their test cases. Asynchronous tests can use callbacks or returned promises, while parallel execution is available in Node.js but not in browsers. The command-line interface defaults to the BDD interface and spec reporter; browser runs default to the HTML reporter, and reporters can be configured. Installation as a development dependency is documented for npm, pnpm, and yarn. Mocha 12 requires Node.js ^20.19.0 or >=22.12.0, and browser builds document support for evergreen Chrome, Edge, Firefox, and Safari. It supports JavaScript and TypeScript, parameterized cases, and lists editor-related packages for TextMate, JetBrains IDEs, Wallaby.js, Emacs, and VS Code. Built-in mocks are not included. The project points users to Discord and documentation explainers for more information.
Spec sheet
- Purpose
- Mocha is a JavaScript test framework that runs on Node.js and in browsers.Read 2 Oct 2026 · mochajs.org
- Support
- The project points users to its Discord and documentation explainers for additional information.Read 2 Oct 2026 · mochajs.org
- Founded
- 2011Read 28 Sep 2026 · mochajs.org
- Async testing
- Mocha supports asynchronous tests using callbacks or returned promises.Read 2 Oct 2026 · mochajs.org
- Browser support
- Mocha provides browser builds and documents support for evergreen browser versions including Chrome, Edge, Firefox, and Safari.Read 2 Oct 2026 · mochajs.org
- Editor integrations
- The docs list editor-related packages for TextMate, JetBrains IDEs, Wallaby.js, Emacs, and VS Code.Read 2 Oct 2026 · mochajs.org
- Install options
- The getting-started guide shows installation as a development dependency using npm, pnpm, or yarn.Read 2 Oct 2026 · mochajs.org
- Interfaces
- Mocha’s CLI lists BDD as the default interface and provides a --ui option for selecting an interface.Read 2 Oct 2026 · mochajs.org
- Maintainers
- The Mocha 12 release post says the release is ready for production use.Read 2 Oct 2026 · mochajs.org
- Parallel mode
- Mocha can run tests in parallel in Node.js, but parallel mode is not supported in browsers.Read 2 Oct 2026 · v11.mochajs.org
- Reporters
- Mocha supports configurable reporters, with the spec reporter as the CLI default and HTML as the browser default.Read 2 Oct 2026 · mochajs.org
- Runtime requirement
- Mocha 12 requires Node.js ^20.19.0 or >=22.12.0.Read 2 Oct 2026 · mochajs.org
- Security guidance
- Mocha says it runs in development, executes developer-provided code, and typically does not process untrusted input or access external networks.Read 2 Oct 2026 · mochajs.org
- Test execution
- Mocha runs tests serially by default and maps uncaught exceptions to their test cases.Read 2 Oct 2026 · mochajs.org
Plans and prices
Strong points and limits
Strong points
- Free and open source
- Async tests support callbacks or promises
- Parallel execution in Node.js
- Parameterized cases supported
Limits
- No built-in mocks
- Browser parallel mode is unsupported
- Mocha 12 requires recent Node.js versions
Who it suits
Mocha suits developers writing JavaScript or TypeScript tests for Node.js or browsers, including those who need asynchronous or parameterized cases. Browser users should note that parallel mode is unavailable there.
Verdict
Mocha specifies its runtime requirements, installation options, defaults, and browser limitation clearly. It is worth considering if those fit the projects and environments you need to test.
Where Specifiction places it
- JavaScript Testing Frameworks#9 of 237.7
- Unit Testing#17 of 327.6
- Unit Testing Frameworks#22 of 327.6