mocha-extra-shot

0.0.5 • Public • Published

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.

 
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:

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

Readme

Keywords

none

Package Sidebar

Install

npm i mocha-extra-shot

Weekly Downloads

1

Version

0.0.5

License

MIT

Last publish

Collaborators

  • lennym