Parallelize your mocha tests across multiple virtual machines (pipelines) and/or processes to decrease the runtime of your tests.
$ npm install mocha-pipelines --save-dev
The goal of this module is to provide an easy solution for a project where running all the mocha tests has become painfully slow.
This project assumes that each test file takes about the same amount of time to run and evenly distributes the test files across separate machines and processes. If this is not the case for you, then you may want to split your tests into smaller test files or run your tests separately in multiple "suites".
For example, you could run 2 pipelines of your unit tests and 5 pipelines of your integration tests across 7 different machines, all simultaneously:
mocha-pipelines 2 1 test/unit/**/*.jsmocha-pipelines 2 2 test/unit/**/*.jsmocha-pipelines 5 1 test/integration/**/*.jsmocha-pipelines 5 2 test/integration/**/*.jsmocha-pipelines 5 3 test/integration/**/*.jsmocha-pipelines 5 4 test/integration/**/*.jsmocha-pipelines 5 5 test/integration/**/*.js
Usage: mocha-pipelines [options] <pipelines> <pipeline> [files...]Options:-h, --help output usage information-V, --version output the version number-p, --processes [n] specify number of processes to useExample:Run 3 pipelines of integration tests(run these simultaneously on separate machines)mocha-pipelines 3 1 test/integration/**/*.jsmocha-pipelines 3 2 test/integration/**/*.jsmocha-pipelines 3 3 test/integration/**/*.js
mocha-pipelines only requires 2 arguments to get started - the total number
of pipelines you are parallelizing tests across, and the pipeline number of the
machine where the command is being executed.
mocha-pipelines <pipelines> <pipeline>
For example, to parallelize your tests across across 3 pipelines, you would run the following commands on 3 separate machines, simultaneously:
mocha-pipelines 3 1
mocha-pipelines 3 2
mocha-pipelines 3 3
If you're currently running mocha with options specified on the command line,
$ mocha -t 5000 -R tap then move these to
test/mocha.opts and mocha will automatically
parse those when running
mocha-pipelines with your project.
© 2015-2016 Hello Digit, Inc.