
Security News
Meet the Socket Team at RSAC and BSidesSF 2025
Join Socket for exclusive networking events, rooftop gatherings, and one-on-one meetings during BSidesSF and RSA 2025 in San Francisco.
Random ordering for mocha
It is very easy to accidentally create a fragile test suite by leaving lingering state after a test case, that is then inadvertently used as a precondition for a subsequent test. This can then cause problems trying to run single tests or test suites in isolation.
By executing files in a random order on each execution of a test suite the risk of accidental introduction of state is eliminated, or at least reduced, since any dependency on leftover state will result in test failures.
Pass choma
as a require
option to mocha, either by appending to your test command:
> mocha ./tests/ --require choma
or by adding a line to mocha.opts
--require choma
The seed used to generate the random order is output to the console when running your test suite.
If you would like to re-use a seed to re-test a particular execution order, you can set an environment variable of CHOMA_SEED
.
> CHOMA_SEED=myseed mocha ./tests/ --require choma
FAQs
Random ordering for mocha
The npm package choma receives a total of 10,440 weekly downloads. As such, choma popularity was classified as popular.
We found that choma demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Join Socket for exclusive networking events, rooftop gatherings, and one-on-one meetings during BSidesSF and RSA 2025 in San Francisco.
Security News
Biome's v2.0 beta introduces custom plugins, domain-specific linting, and type-aware rules while laying groundwork for HTML support and embedded language features in 2025.
Security News
Next.js has patched a critical vulnerability (CVE-2025-29927) that allowed attackers to bypass middleware-based authorization checks in self-hosted apps.