# parallel-test-runner

> ### Run your Mocha tests faster

Latest version **1.6.1** (published 2018-01-10) · ISC license · 0 weekly downloads

## Install

```sh
npm install parallel-test-runner
pnpm add parallel-test-runner
yarn add parallel-test-runner
bun add parallel-test-runner
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.6.1 |
| Published | 2018-01-10 |
| First published | 2017-12-01 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | InterAl |
| Maintainers | interal |

## Links

- npm: https://www.npmjs.com/package/parallel-test-runner
- npm.io page: https://npm.io/package/parallel-test-runner

## Dependencies (4)

- [glob](https://npm.io/package/glob.md) ^7.1.2
- [lodash](https://npm.io/package/lodash.md) ^4.17.4
- [commander](https://npm.io/package/commander.md) ^2.12.2
- [serialize-error](https://npm.io/package/serialize-error.md) ^2.1.0

## Recent versions

- 1.6.1 (latest) — 2018-01-10
- 1.6.0 — 2018-01-10
- 1.5.1 — 2018-01-10
- 1.5.0 — 2018-01-10
- 1.4.5 — 2017-12-03
- 1.4.4 — 2017-12-03
- 1.4.3 — 2017-12-02
- 1.4.2 — 2017-12-02
- 1.4.1 — 2017-12-02
- 1.4.0 — 2017-12-02
- 1.3.0 — 2017-12-02
- 1.2.0 — 2017-12-02
- 1.1.0 — 2017-12-02
- 1.0.0 — 2017-12-01

## README

# parallel-test-runner

### Run your Mocha tests faster

parallel-test-runner is a parallel test runner for Mocha.
It runs your test files on several node processes, and does not require making any changes to your existing tests.
I was able to obtain a 2-3x speed increase in running time for my existing projects by using this package, which is pretty cool.

### Installation
```bash
$ npm i -S parallel-test-runner
```

### Usage

Create a new runner file:

parallelTestRunner.js:

```javascript
#!/usr/bin/env node

const {runner} = require('parallel-test-runner');
const path = require('path');

runner()
    .config({
        pattern: 'test/**/*.test.js', //mandatory
        shuffleFiles: false, //optional
        slowTestPatterns: ['SlowTestFilePattern.js'], //optional
        requireFiles: [path.resolve(__dirname, '../test/setup.js')], //optional
        parallelFactor: 4 //The number of processes the test runner will spawn
    })
    .run()
    .then(() => {
        process.exit(0);
    })
    .catch(() => {
        process.exit(1);
    });
```

Now you can simply execute ./parallelTestRunner.js to run your tests.

### Flaky tests
Running the tests in parallel might cause some of them to fail randomly. This is probably because you
have concurrency issues in your tests or production code. You can try including
them in the slowTestPatterns, which will run them in a separate process.

### CLI support
Might be added in the future.

---
_Source: https://npm.io/package/parallel-test-runner · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
