Home / npm packages / mocha

mocha source code

Every file of mocha@12.0.3 as published on npm: 73 files, 889 KB. Search them by exact text or regex, in milliseconds.

It uses: eval(), child_process, process.env, the fs module, XMLHttpRequest.

What mocha uses

APIIn mocha
eval()
runs a string as JavaScript
Yes: 1 file
e.g. lib/nodejs/worker.cjs
See the lines
new Function()
builds a function from a string, like eval (with or without new)
NoWho does
child_process
starts other programs
Yes: 1 file
e.g. bin/mocha.js
See the lines
process.env
reads environment variables
Yes: 5 files
e.g. lib/nodejs/buffered-worker-pool.cjs
See the lines
the fs module
reads and writes files
Yes: 10 files
e.g. lib/cli/config.cjs
See the lines
http / https
makes or serves HTTP requests with Node's own modules
NoWho does
fetch()
makes HTTP requests
NoWho does
XMLHttpRequest
makes HTTP requests the old browser way
Yes: 2 files
e.g. mocha.js
See the lines
crypto
hashes, encrypts or makes random numbers
NoWho does
WebAssembly
loads WebAssembly code
NoWho does
document.cookie
reads or writes browser cookies
NoWho does
install scripts
runs a script when it's installed
NoWho does

Exact matches in the published files, so a mention in a comment counts too: open the lines to check.

Largest files

FileSize
mocha.js484 KB
lib/runner.js39 KB
lib/mocha.cjs37 KB
lib/cli/watch-run.cjs21 KB
lib/utils.cjs21 KB
lib/suite.js16 KB
lib/reporters/base.js16 KB
lib/nodejs/parallel-buffered-runner.cjs13 KB
lib/nodejs/serializer.js13 KB
lib/reporters/html.js12 KB
lib/cli/parse-args.js12 KB
lib/errors.js11 KB
lib/runnable.js11 KB
mocha.css10 KB
lib/cli/run-helpers.cjs9.1 KB
lib/plugin-loader.js8.4 KB
package.json7.1 KB
lib/nodejs/esm-utils.cjs6.7 KB
lib/reporters/tap.js6.6 KB
lib/cli/run-option-metadata.cjs6.3 KB
lib/reporters/xunit.js6.0 KB
lib/reporters/nyan.js5.6 KB
lib/nodejs/buffered-worker-pool.cjs5.5 KB
lib/cli/options.cjs5.4 KB
browser-entry.js4.9 KB
lib/interfaces/common.js4.7 KB
bin/mocha.js4.7 KB
README.md4.6 KB
lib/nodejs/worker.cjs4.6 KB
lib/nodejs/reporters/parallel-buffered.cjs4.5 KB

Questions

How many files are in mocha?

Version 12.0.3 of mocha publishes 73 files of source, 889 KB in all, not counting images, fonts and source maps.

Does mocha use eval?

Yes: mocha calls eval() in 1 of its files.

Does mocha start other programs?

Yes: mocha uses child_process in 1 of its files.

Does mocha run an install script?

No: mocha has no preinstall, install or postinstall script in its package.json.

npm packages that use…

Every package we've indexed →

Search your own code like this

The same engine answers over your documents and repositories: exact text and regex, every match counted, from your code or your AI agent.

See StackGrep Engine