
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
@villedemontreal/mocha-concurrent-api-tests
Advanced tools
Provides the core functions required to implement concurrent API tests with Mocha.
Mocha-concurrent-api-tests provides the core functions required to implement Concurrent API Tests with Mocha. Thanks to mocha.parallel for providing a single threaded event loop architecture for Mocha tests.
In your project, run this npm command:
npm install @villedemontreal/mocha-concurrent-api-tests
Execute a mocha concurrent api test suite. Mocha describe function and nested describe functions are not supported by mocha-concurrent-api-tests. Instead, a mocha concurrent api test suite executes many Mocha it function concurrently in the same thread.
Arguments
Returns
void
Example
See mocha-concurrent-api-tests example.
Define a function that provide a default payload template and that allow to specify only the parts of the payload that are meaningful for the test case. This way, test cases are easier to read since only the parts that matter are specified. Moreover, if a change in a payload is required, only the default payload template and the related tests need to be changed.
Arguments
Returns
A function that provide a default payload template and allow to specify only the parts of the payload that are meaningful for the test case.
Example
See mocha-concurrent-api-tests example.
Define a copy template variation to avoid duplication when the same template is used in many test cases.
Arguments
Returns
A function that provide a default payload template and allow to specify only the parts of the payload that are meaningful for the test case.
Example
See mocha-concurrent-api-tests example.
Assert against an API request that is expected to throw an error.
Arguments
void
Example
See mocha-concurrent-api-tests example.
Some test cases must rely on the timing between API requests. These test cases are likely to be flaky if the timing is not managed with care.
If the precision of the timing has to be less than a seconds, then mocha-concurrent-api-tests is not the right tool for this test case. For more guidance, see Concurrent API Tests.
Arguments
Returns
void
Example
await aFewSeconds(5);
Define a function that perform lazy initialization of a fixture. This allow to share the same fixture between many tests cases and to initialize it only once.
A fixture may be shared between the test cases of the same test run if
Although shared fixture can speed up test runs and reduce the amount of data created on the server, they must be used with care since they can produce flaky test cases if the two points above are not respected.
In doubt, create a new fixture for each test case.
Fast tests are important, but reliable tests are even more important.
Arguments
Returns
A function that perform lazy initialization of the shared fixture.
Example
See mocha-concurrent-api-tests example.
Same as defineGetSharedFixture, but allow to pass a key as argument. Useful when there are many similar shared fixture to be defined.
Arguments
Returns
A function that perform lazy initialization of the shared fixture for a specific key.
Example
See mocha-concurrent-api-tests example.
Run all unit tests, run this npm command:
npm start
Debug all unit tests, run this npm command:
npm run watch (to activate incremental transpilation) and use the Visual Studio Code launcher Debug.
FAQs
Provides the core functions required to implement concurrent API tests with Mocha.
We found that @villedemontreal/mocha-concurrent-api-tests demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 7 open source maintainers 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.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.