Skip to content
Mocha
Search
Ctrl
K
Cancel
Discord
GitHub
Select theme
Dark
Light
Auto
Getting Started
Running Mocha
CLI
Configuring
Editor plugins
Browsers
Test globs
Declaring Tests
Dynamic tests
Exclusive tests
Inclusive tests
Pending tests
Retrying tests
Features
Arrow functions
Assertions
Asynchronous code
Error codes
Global fixtures
Hooks
Parallel mode
Root hook plugins
Timeouts
Interfaces
BDD (default)
TDD
Exports
QUnit
Require
Third-Party
Reporters
Spec (default)
Doc
Dot
HTML
JSON Stream
JSON
Landing
List
Markdown
Min
Nyan
Progress
Tap
XUnit
Third-Party
Explainers
Detecting multiple calls to done()
Node.js native ESM support
Run cycle overview
Test duration
Test fixture decision tree
API
Discord
GitHub
Select theme
Dark
Light
Auto
Test Fixture Decision Tree
This flowchart will help you decide when to use
hooks
,
root hook plugins
or
global fixtures
.
Mocha Fixture Wizard
My tests
need setup!
Setup MUST run
once and only once
Setup MUST share
state with tests
YES
Use Root Hooks and
Avoid Parallel Mode
Use Global Fixtures
Should setup affect
tests across ALL files?
Use Root Hooks
Use Plain Hooks
YES
NO
NO
YES
NO