CodeVetter · Repo Unpack · Feature catalog
mochajs/mocha
Mocha exposes test execution and browser scaffolding through its CLI, plus direct construction and execution through its library API. Test declarations support multiple interfaces, hooks, selection, skipping, and retries. Reporters offer terminal, browser, structured, and CI-oriented output. Parallel and watch modes alter execution scheduling and lifecycle management.
- The CLI supports default test execution, init <path>, help, version, and interface/reporter listing; init writes a browser bundle, stylesheet, HTML runner, and empty test file.
- Built-in interfaces are BDD, TDD, QUnit, and exports; BDD provides describe/context, it/specify, four hook functions, and only/skip variants.
- Runnable supports synchronous functions, callbacks, and thenables; callback completion checks for a returned Promise once its result is available, and repeated completion emits a multiple-done error.
- Selection and run-policy options include grep/fgrep/invert, retries, bail, dry-run, fail-zero, forbid-only, forbid-pending, global leak checking, and forced exit.
- The reporter registry includes Spec, Dot, List, Min, TAP, JSON, JSON Stream, XUnit, HTML, Doc, Markdown, Progress, Landing, Nyan, and GitHub Actions, with normalized name aliases.
- Parallel mode supports jobs-based file concurrency but rejects --file, --sort, and progress/markdown/json-stream reporters; workers force forbidOnly.
- Watch mode supports file and ignore patterns, automatic reruns, the rs keyboard shortcut, and global teardown on SIGINT.
- Users can supply required-module root hook/global fixture plugins, custom reporters and interfaces, or programmatically load files and run; browser setup additionally accepts query-based grep, fgrep, and invert.