CodeVetter · Repo Unpack · System map
mochajs/mocha
The package has distinct CLI, library, and browser entrypoints sharing one suite and runner model. Node-specific loading and parallel execution live behind separate modules, while browser bundling excludes those facilities. Runtime state is primarily held in memory, with optional report files as output artifacts. Documentation and release automation have separate build and external-service boundaries.
- package.json declares an ESM package, index.js as its library entrypoint, bin/mocha.js as the mocha executable, and Node ^20.19.0 or >=22.12.0.
- Mocha owns options, input files, a root Suite, lifecycle state, and the runner class; its constructor binds the interface and reporter before execution.
- The CLI separates option discovery, command dispatch, run preparation, and file collection into options.cjs, cli.js, run.cjs, and collect-files.cjs.
- ParallelBufferedRunner delegates files to BufferedWorkerPool, whose workerType is explicitly process and whose children inherit process.execArgv.
- Rollup builds browser-entry.js into a UMD mocha.js with a source map; package browser mappings exclude CLI, filesystem, worker, and serializer modules.
- Suite stores test structure and inherited context in memory; JSON and XUnit reporters provide explicit filesystem output boundaries rather than a database-backed state layer.
- The separate docs package builds Astro/Starlight, generates supporter data from Open Collective, and publishes docs/dist through Netlify configuration.
- GitHub Actions partitions runtime validation into smoke, node suites, browser tests, and tsc; Release Please conditionally publishes npm releases with provenance.