All Projects → mocha-parallel → Mocha Parallel Tests

mocha-parallel / Mocha Parallel Tests

Licence: mit
Parallel test runner for mocha tests. Looking for maintainer.

Programming Languages

javascript
184084 projects - #8 most used programming language

Labels

Projects that are alternatives of or similar to Mocha Parallel Tests

Snap Shot It
Smarter snapshot utility for Mocha and BDD test runners + data-driven testing!
Stars: ✭ 138 (-29.95%)
Mutual labels:  mocha
Mochawesome Report Generator
Standalone mochawesome report generator. Just add test data.
Stars: ✭ 152 (-22.84%)
Mutual labels:  mocha
Snap Shot
Jest-like snapshot feature for the rest of us, works magically by finding the right caller function
Stars: ✭ 170 (-13.71%)
Mutual labels:  mocha
Cracking The Coding Interview Javascript Solutions Ctci
Javascript solutions to Cracking the Coding Interview (CTCI)
Stars: ✭ 139 (-29.44%)
Mutual labels:  mocha
Ember Cli Mocha
Mocha and Chai tests for ember-cli applications
Stars: ✭ 147 (-25.38%)
Mutual labels:  mocha
Earl
☕ Ergonomic, modern and type-safe assertion library for TypeScript
Stars: ✭ 153 (-22.34%)
Mutual labels:  mocha
Javascript Testing Best Practices
📗🌐 🚢 Comprehensive and exhaustive JavaScript & Node.js testing best practices (August 2021)
Stars: ✭ 13,976 (+6994.42%)
Mutual labels:  mocha
Mocha.parallel
Run async mocha specs in parallel
Stars: ✭ 194 (-1.52%)
Mutual labels:  mocha
Redux Saga Testing
A no-brainer way of testing your Sagas
Stars: ✭ 150 (-23.86%)
Mutual labels:  mocha
Mochapack
Mocha test runner with integrated webpack precompiler
Stars: ✭ 166 (-15.74%)
Mutual labels:  mocha
React Permissible
👮‍♂️Making the permission management for React components easier.
Stars: ✭ 145 (-26.4%)
Mutual labels:  mocha
Mocha Loader
Mocha Loader
Stars: ✭ 145 (-26.4%)
Mutual labels:  mocha
Karma
Spectacular Test Runner for JavaScript
Stars: ✭ 11,591 (+5783.76%)
Mutual labels:  mocha
163music
🎵163 music web app built with Vue 2.6, server side render, webpack 4
Stars: ✭ 139 (-29.44%)
Mutual labels:  mocha
Angular Js Es6 Testing Example
Enhanced testing of Angular JS 1.X applications using ES6 modules
Stars: ✭ 170 (-13.71%)
Mutual labels:  mocha
Ekke
Ekke is a test runner for React-Native, it allows you to execute your test code directly on the device enabling you to test in the same environment as your production users.
Stars: ✭ 137 (-30.46%)
Mutual labels:  mocha
Serverless Mocha Plugin
Plugin for Serverless Framework which adds support for test-driven development using Mocha
Stars: ✭ 152 (-22.84%)
Mutual labels:  mocha
Feathers Vue
A boiler plate template using Feathers with Email Verification, Vue 2 with Server Side Rendering, stylus, scss, jade, babel, webpack, ES 6-8, login form, user authorization, and SEO
Stars: ✭ 195 (-1.02%)
Mutual labels:  mocha
Redux Actions Assertions
Simplify testing of redux action and async action creators
Stars: ✭ 177 (-10.15%)
Mutual labels:  mocha
React Redux Universal Boilerplate
An Universal ReactJS/Redux Boilerplate
Stars: ✭ 165 (-16.24%)
Mutual labels:  mocha

mocha-parallel-tests

Build Status

mocha-parallel-tests is a test runner for tests written with mocha testing framework which allows you to run them in parallel. mocha-parallel-tests executes each of your test files in a separate process while maintaining the output structure of mocha. Compared to the other tools which try to parallelize mocha tests execution, mocha-parallel-tests doesn't require you to write the code in a different way or use some specific APIs - just run your tests with mocha-parallel-tests instead of mocha and you will see the difference. Or if you prefer to use mocha programmatic API replace it with mocha-parallel-tests default export and you're done!

If you're using Node.JS >= 12 your tests execution will be even faster because mocha-parallel-tests supports running tests with Node.JS worker threads API: instead of creating fully fledged Node.JS processes mocha-parallel-tests runs your tests in lighter threads within the same process. This results in a faster tests processing and less memory consumption.

Installation

npm install --save-dev mocha mocha-parallel-tests

ATTENTION: mocha is a peer dependency of mocha-parallel-tests so you also need to install mocha. Currently mocha versions 3, 4, 5, 6, and 7 are supported.

Usage

CLI

# mocha example
$ mocha -R xunit --timeout 10000 --slow 1000 test/*.spec.js

# mocha-parallel-tests example
$ mocha-parallel-tests -R xunit --timeout 10000 --slow 1000 test/*.spec.js

Most of mocha CLI options are supported. If you're missing some of the options support you're welcome to submit a PR: all options are applied in a same simple way.

Programmatic API

// mocha example
import Mocha from 'mocha';
const mocha = new Mocha();
mocha.addFile(`${__dirname}/index.spec.js`);
mocha.run();

// mocha-parallel-tests example
// if you're using TypeScript you don't need to install @types/mocha-parallel-tests
// because package comes with typings in it
import Mocha from 'mocha-parallel-tests'; // or `const Mocha = require('mocha-parallel-tests').default` if you're using CommonJS
const mocha = new Mocha();
mocha.addFile(`${__dirname}/index.spec.js`);
mocha.run();

Parallel limit

mocha-parallel-tests CLI executable has its own --max-parallel option which is the amount of tests executed at the same time. By default it's equal to the number of logical CPI cores (os.cpus().length) on your computer but you can also specify your own number or set it to 0, which means that all test files will be started executing at the same time. However this is not recommended especially on machines with low number of CPUs and big number of tests executed.

Differences with mocha

Main difference with mocha comes from the fact that all files are executed in separate processes/threads and don't share the scope. This means that even global variables values that you could've used to share the data between test suites will not be reliable. There's also some specific behaviour for some of the mocha CLI options like --bail: it's just applied to each test in its process. You can see the full list of differences here.

There's also a list of limitations that you can hit when you launch your tests with mocha-parallel-tests.

From the reporter perspective the main difference between tests executed with mocha and mocha-parallel-tests is another level of nesting which again comes from the fact that main process adds one more "suite" level and all tests results are merged into that:

mocha

mocha spec reporter output

mocha-parallel-tests

mocha-parallel-tests spec reporter output

Comparison with mocha.parallel

mocha.parallel is a tool which allows you to run mocha tests in parallel. While it seems pretty similar to mocha-parallel-tests there's a massive difference between them. Check this page for a full comparison.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].