# mocha-extra-shot

> Allow failing mocha tests to retry

Latest version **0.0.5** (published 2014-08-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install mocha-extra-shot
pnpm add mocha-extra-shot
yarn add mocha-extra-shot
bun add mocha-extra-shot
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.5 |
| Published | 2014-08-07 |
| First published | 2014-08-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 (+4 in 2 direct dependencies) |
| Install scripts | no |
| Author | Lenny Martin |
| Maintainers | lennym |

## Links

- npm: https://www.npmjs.com/package/mocha-extra-shot
- Repository: https://github.com/lennym/mocha-extra-shot
- Issues: https://github.com/lennym/mocha-extra-shot/issues
- npm.io page: https://npm.io/package/mocha-extra-shot

## Dependencies (3)

- [ms](https://npm.io/package/ms.md) ^0.6.2
- [clone](https://npm.io/package/clone.md) ^0.1.17
- [debug](https://npm.io/package/debug.md) ^1.0.4

## Recent versions

- 0.0.5 (latest) — 2014-08-07
- 0.0.4 — 2014-08-07
- 0.0.3 — 2014-08-07
- 0.0.2 — 2014-08-07
- 0.0.1 — 2014-08-05

## README

Mocha Extra Shot
================

Allows test suites in Mocha to retry on failure.

Inspired by the ideas in https://www.npmjs.org/package/mocha-retry by @giggio, but to support programmatically constructed test suites.

You should read the README for that module, in particular the reasons you shouldn't use that (or this) module.

> Tests that pass sometimes, and sometimes they don't are a bad smell. Your tests should be consistent: either they always pass, or they always fail. So, don't use this Mocha plugin, instead make your tests consistent.

Usage
-----

Extra Shot can be used as a drop-in replacement for Mocha when building test suites programmatically.

```javascript

var Mocha = require('mocha-extra-shot');
var runner = new Mocha(options);
var suite = Mocha.Suite.create(runner.suite, 'a retry-able suite');

suite.retries(1);

// add some tests to your suite
suite.addTest(...);
suite.addTest(...);
suite.addTest(...);

runner.run();
```

Reporters
---------

Extra Shot comes with a base reporter supporting output for retried suites, and extensions of the spec (`spec-retry`) and dot (`dot-retry`) reporters based on this.

### Usage:

```javascript
var Mocha = require('mocha-extra-shot');
var runner = new Mocha({
  reporter: 'spec-retry',
  ...
});
```

```javascript
var Mocha = require('mocha-extra-shot');
var runner = new Mocha({
  reporter: Mocha.reporters.DotRetry,
  ...
});
```

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