Description
Mocha is a JavaScript test framework that runs on Node.js and in the browser. You write tests with hooks, assertions and async code, and Mocha runs them serially, so results are easy to follow and uncaught exceptions are mapped to the test that caused them. It supports several interfaces, including BDD (the default), TDD, QUnit, exports and require styles, so you can write tests in the style your team already uses. Results are printed by reporters such as spec, dot, list, progress, TAP, JSON and HTML, and third-party reporters cover other formats. Mocha also offers a parallel mode, global fixtures, timeouts, root hook plugins and test filtering with --grep, along with notes on native ESM support and TypeScript. The project is free and open source, developed on GitHub, and its documentation covers getting started, the CLI, editor plugins and a configuration reference.…
Preview
Highlights
- Runs tests on Node.js and in the browser
- BDD, TDD, QUnit and exports interfaces
- Spec, dot, TAP, JSON and HTML reporters
- Hooks, global fixtures and parallel mode
- Test filtering with --grep and timeouts
Ratings & Reviews
No ratings yet
Be the first to rate Mocha.
People also visit
Mocha FAQ
What is Mocha?
A JavaScript test framework for Node.js and the browser. You write test cases, and Mocha runs them and reports the results.
Is Mocha free?
Yes. It is open source and the code is on GitHub at mochajs/mocha, with a Discord server for questions.
Which test styles can I write?
Mocha supports BDD (the default), TDD, QUnit, require and exports interfaces, so you can pick the style your team prefers.
How do I see the results?
Choose a reporter. Spec is the default, and others include dot, list, progress, markdown, TAP, JSON, HTML and XUnit for continuous integration.
Does Mocha work with TypeScript and ES modules?
The documentation has pages on TypeScript and on Node.js native ESM support, so both are covered in the official guides.
What are the best Mocha alternatives?
Popular alternatives to Mocha include Nightwatch.js, Cypress and RunJS. See all Mocha alternatives










