Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mochajs/mocha
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 2.3.4
Choose a base ref
...
head repository: mochajs/mocha
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v2.4.1
Choose a head ref

Commits on Nov 18, 2015

  1. Silence Bluebird js warnings

    krisr committed Nov 18, 2015
    Copy the full SHA
    4af3866 View commit details
  2. Merge pull request #1967 from krisr/kris-silence-warnings

    Silence Bluebird js warnings
    boneskull committed Nov 18, 2015
    Copy the full SHA
    67d0fac View commit details

Commits on Nov 19, 2015

  1. Fixes #1794

    Moves Mocha interface allocation to after require option has been processed to allow for use of custom Mocha UI's.
    jgkim committed Nov 19, 2015
    Copy the full SHA
    d596bbb View commit details

Commits on Nov 23, 2015

  1. Simplify function call.

    iclanzan committed Nov 23, 2015
    Copy the full SHA
    5a18d67 View commit details

Commits on Dec 1, 2015

  1. support --perf-basic-prof

    Rob Raux committed Dec 1, 2015
    Copy the full SHA
    c51119b View commit details

Commits on Dec 2, 2015

  1. 13
    Copy the full SHA
    1192914 View commit details

Commits on Dec 3, 2015

  1. Copy the full SHA
    a2a2e6c View commit details

Commits on Dec 7, 2015

  1. Copy the full SHA
    1cc21a9 View commit details

Commits on Dec 9, 2015

  1. fix lint errors

    ianwremmel committed Dec 9, 2015
    Copy the full SHA
    d09c035 View commit details
  2. Merge pull request #1995 from ianwremmel/fix-xunit-hang

    make sure the xunit output dir exists before trying to write to it
    danielstjules committed Dec 9, 2015
    Copy the full SHA
    3af1b8a View commit details
  3. support for strict mode

    - fixes #1879
    - fixes #1821
    tmont committed Dec 9, 2015
    Copy the full SHA
    77ddbef View commit details

Commits on Dec 14, 2015

  1. XUnit Reporter Writes to stdout, falls back to console.log

    Fixes #1674; provides support *much* needed for [mocha-phantomjs](https://github.com/nathanboktae/mocha-phantomjs) (see [#133](nathanboktae/mocha-phantomjs#133), [#220](nathanboktae/mocha-phantomjs#220), etc).  Maintains support for running the XUnit reporter in a browser (unlike the previously reverted PR #1068).
    
    ping @alemangui, @nathanboktae
    
    Thanks all.
    jonnyreeves committed Dec 14, 2015
    Copy the full SHA
    c66bc83 View commit details

Commits on Dec 16, 2015

  1. Fix HTML reporting display to show errors if done is called multiple …

    …times, or if an exception is thrown after done is called.
    Standard8 committed Dec 16, 2015
    1
    Copy the full SHA
    ae4fbca View commit details

Commits on Dec 22, 2015

  1. Fix non ES5 regexp

    ES5 appears to require that { be escaped when not used as part of a quantifier. While this works fine in browsers it appears to choke less lenient runtimes (e.g. Duktape)
    zetaben committed Dec 22, 2015
    Copy the full SHA
    2766fc0 View commit details
  2. Copy the full SHA
    08bf74d View commit details
  3. Merge pull request #1965 from cowboyd/dont-double-install-bdd-ui

    Dont double install bdd ui
    danielstjules committed Dec 22, 2015
    Copy the full SHA
    e7c4532 View commit details

Commits on Dec 24, 2015

  1. Merge pull request #2021 from zetaben/patch-1

    Fix non ES5 compliant regexp
    Joshua Appelman committed Dec 24, 2015
    Copy the full SHA
    5d1fdc2 View commit details

Commits on Dec 25, 2015

  1. Alter feature detection

    jonnyreeves committed Dec 25, 2015
    Copy the full SHA
    3134ea4 View commit details
  2. Merge pull request #2005 from jonnyreeves/patch-1

    XUnit Reporter Writes to stdout, falls back to console.log
    danielstjules committed Dec 25, 2015
    Copy the full SHA
    c972f0b View commit details
  3. Merge pull request #1999 from tmont/use-strict-fix

    support for strict mode
    danielstjules committed Dec 25, 2015
    Copy the full SHA
    50920fc View commit details
  4. Merge pull request #1993 from segrey/master

    propagate "file" property across suites and tests for "exports" inter…
    danielstjules committed Dec 25, 2015
    Copy the full SHA
    9d8c154 View commit details
  5. Merge pull request #1981 from Standard8/fix-done-reporting-on-html

    Fix HTML reporting display to show errors if done is called multiple times, or if an exception is thrown after done is called.
    danielstjules committed Dec 25, 2015
    Copy the full SHA
    829df1d View commit details
  6. Merge pull request #1963 from peachworks/perf-basic-prof

    Add support --perf-basic-prof
    danielstjules committed Dec 25, 2015
    Copy the full SHA
    c3abc07 View commit details
  7. 1794 test case

    joaomoreno authored and danielstjules committed Dec 25, 2015
    Copy the full SHA
    1d0ff9f View commit details
  8. Copy the full SHA
    f8b42fd View commit details
  9. Merge branch 'ui-fix'

    danielstjules committed Dec 25, 2015
    2
    Copy the full SHA
    a61b1f3 View commit details
  10. Merge pull request #1976 from iclanzan/patch-1

    Simplify function call.
    danielstjules committed Dec 25, 2015
    Copy the full SHA
    4f26ce7 View commit details

Commits on Dec 26, 2015

  1. Copy the full SHA
    9b1e587 View commit details

Commits on Dec 28, 2015

  1. Allow to retry failed test from test context for #1773

    - make retries run proper hooks
    - allow retries override at different levels
    - expose currentRetry to reporters
    Long Ho committed Dec 28, 2015
    Copy the full SHA
    7d394ab View commit details
  2. Enable --log-timer-events option

    This provides better insights when profiling application using --prof switch. Especially useful when the log is processed by https://v8.googlecode.com/svn/branches/bleeding_edge/tools/profviz/profviz.html.
    robertrossmann committed Dec 28, 2015
    Copy the full SHA
    2a32ab2 View commit details
  3. Merge pull request #1982 from Alaneor/cli-log-timer-events

    Enable --log-timer-events option
    danielstjules committed Dec 28, 2015
    Copy the full SHA
    ce3e89a View commit details
  4. Merge pull request #1989 from longlho/1773-retries

    Allow to retry failed test from test context for #1773
    danielstjules committed Dec 28, 2015
    Copy the full SHA
    d811eb9 View commit details
  5. Copy the full SHA
    eb7b2c4 View commit details
  6. Merge pull request #1977 from ahamid/handle-phantomjs-undefined

    safely stringify PhantomJS undefined value
    danielstjules committed Dec 28, 2015
    Copy the full SHA
    0d3321d View commit details

Commits on Dec 29, 2015

  1. Remove reference to test before afterAll hook runs

    Fix #2006
    Stone committed Dec 29, 2015
    Copy the full SHA
    5bb930f View commit details
  2. Merge pull request #2028 from stonelgh/remove-reference-to-test-try2

    Remove reference to test before afterAll hook runs
    danielstjules committed Dec 29, 2015
    Copy the full SHA
    60ff8d8 View commit details

Commits on Jan 1, 2016

  1. Copy the full SHA
    5722c2b View commit details
  2. Copy the full SHA
    2694d30 View commit details

Commits on Jan 5, 2016

  1. Fix for memory leak caused by referenced to deferred test functions

    (it/before[Each]/after[Each]).
    
    related to #1991.
    bd82 committed Jan 5, 2016
    Copy the full SHA
    33c825b View commit details
  2. Copy the full SHA
    d017b3e View commit details
  3. Merge pull request #2038 from bd82/travis

    Also run Travis-CI on node.js 4 & 5
    danielstjules committed Jan 5, 2016
    Copy the full SHA
    43bedc4 View commit details

Commits on Jan 6, 2016

  1. Merge pull request #2037 from bd82/master

    Fix for memory leak caused by referenced to deferred test functions
    danielstjules committed Jan 6, 2016
    Copy the full SHA
    63ef07f View commit details
  2. Merge pull request #2033 from tomhughes/should

    Update tests for newer versions of should.js
    danielstjules committed Jan 6, 2016
    Copy the full SHA
    21b5436 View commit details

Commits on Jan 9, 2016

  1. Copy the full SHA
    6183ec7 View commit details
  2. Merge pull request #2047 from longlho/retry-fix

    add clone capability to test, fix async retry, fix #2045
    danielstjules committed Jan 9, 2016
    Copy the full SHA
    d5c0abc View commit details

Commits on Jan 10, 2016

  1. Copy the full SHA
    daf4612 View commit details

Commits on Jan 11, 2016

  1. Merge pull request #2048 from mislav/fix-skip

    Fix `this.skip` from spec with HTML reporter
    danielstjules committed Jan 11, 2016
    Copy the full SHA
    cbc3952 View commit details
  2. Copy the full SHA
    65e2984 View commit details

Commits on Jan 18, 2016

  1. Copy the full SHA
    fdf01b5 View commit details
  2. Merge pull request #2056 from pra85/patch-1

    chore(license): update license year to 2016
    danielstjules committed Jan 18, 2016
    Copy the full SHA
    b64d76c View commit details
Showing with 1,330 additions and 180 deletions.
  1. +5 −0 .travis.yml
  2. +76 −0 HISTORY.md → CHANGELOG.md
  3. +1 −1 LICENSE
  4. +5 −0 Makefile
  5. +17 −7 bin/_mocha
  6. +8 −0 bin/mocha
  7. +2 −0 bin/options.js
  8. +1 −1 component.json
  9. +15 −0 lib/context.js
  10. +9 −2 lib/interfaces/bdd.js
  11. +9 −0 lib/interfaces/common.js
  12. +1 −1 lib/interfaces/exports.js
  13. +1 −0 lib/interfaces/qunit.js
  14. +1 −0 lib/interfaces/tdd.js
  15. +17 −2 lib/mocha.js
  16. +22 −20 lib/reporters/base.js
  17. +2 −2 lib/reporters/doc.js
  18. +5 −2 lib/reporters/html.js
  19. +1 −0 lib/reporters/json-cov.js
  20. +2 −1 lib/reporters/json-stream.js
  21. +1 −0 lib/reporters/json.js
  22. +1 −1 lib/reporters/markdown.js
  23. +5 −0 lib/reporters/xunit.js
  24. +32 −0 lib/runnable.js
  25. +61 −2 lib/runner.js
  26. +24 −0 lib/suite.js
  27. +15 −0 lib/test.js
  28. +4 −2 lib/utils.js
  29. +536 −126 mocha.js
  30. +5 −4 package.json
  31. +18 −0 test/acceptance/misc/only/bdd-require.js
  32. +1 −0 test/browser/index.html
  33. +16 −0 test/browser/multiple-done.js
  34. +11 −0 test/integration/fixtures/hooks/before.hook.async.error.tip.js
  35. +9 −0 test/integration/fixtures/hooks/before.hook.error.tip.js
  36. +5 −0 test/integration/fixtures/options/retries.js
  37. +3 −0 test/integration/fixtures/regression/1794/issue-1794.js
  38. +27 −0 test/integration/fixtures/regression/1794/simple-ui.js
  39. +47 −0 test/integration/fixtures/regression/issue-1991.js
  40. +28 −0 test/integration/fixtures/retries/async.js
  41. +11 −0 test/integration/fixtures/retries/early-pass.js
  42. +25 −0 test/integration/fixtures/retries/hooks.js
  43. +9 −0 test/integration/fixtures/retries/nested.js
  44. +1 −1 test/integration/helpers.js
  45. +26 −2 test/integration/hook.err.js
  46. +16 −0 test/integration/options.js
  47. +20 −0 test/integration/regression.js
  48. +107 −0 test/integration/retries.js
  49. +8 −0 test/runnable.js
  50. +55 −0 test/test.js
  51. +3 −3 test/utils.js
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
language: node_js
env:
global:
- CXX=g++-4.8
before_install:
- ./scripts/ensure-compatible-npm.sh
script: travis_retry npm test
node_js:
- '5'
- '4'
- 'iojs'
- '0.12'
- '0.11'
76 changes: 76 additions & 0 deletions HISTORY.md → CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,79 @@
2.4.1 / 2016-01-26
==================

* [#2067] - Fix HTML/doc reporter regressions ([@danielstjules])

[#2067]: https://github.com/mochajs/mocha/pull/2067

2.4.0 / 2016-01-25
==================

* [#1945] - Correctly skip tests when skipping in suite's before() ([@ryanshawty])
* [#2056] - chore(license): update license year to 2016 ([@pra85])
* [#2048] - Fix `this.skip` from spec with HTML reporter ([@mislav])
* [#2033] - Update tests for newer versions of should.js ([@tomhughes])
* [#2037] - Fix for memory leak caused by referenced to deferred test ([@bd82])
* [#2038] - Also run Travis-CI on node.js 4 & 5 ([@bd82])
* [#2028] - Remove reference to test before afterAll hook runs ([@stonelgh])
* Bump mkdirp to 0.5.1 to support strict mode ([@danielstjules])
* [#1977] - safely stringify PhantomJS undefined value ([@ahamid])
* Add the ability to retry tests ([@@longlho])
* [#1982] - Enable --log-timer-events option [@Alaneor]
* Fix #1980: Load mocha.opts from bin/mocha and bin/_mocha ([@danielstjules])
* [#1976] - Simplify function call ([@iclanzan])
* [#1963] - Add support --perf-basic-prof ([@robraux])
* [#1981] - Fix HTML reporter handling of done and exceptions ([@Standard8])
* [#1993] - propagate "file" property for "exports" interface ([@segrey])
* [#1999] - Add support for strict mode ([@tmont])
* [#2005] - XUnit Reporter Writes to stdout, falls back to console.log ([@jonnyreeves])
* [#2021] - Fix non ES5 compliant regexp ([@zetaben])
* [#1965] - Don't double install BDD UI ([@cowboyd])
* [#1995] - Make sure the xunit output dir exists before writing to it ([@ianwremmel])
* Use chalk for the base reporter colors; closes #1200 ([@boneskull])
* Fix requiring custom interfaces ([@jgkim])
* [#1967] Silence Bluebird js warnings ([@krisr])

[#1945]: https://github.com/mochajs/mocha/pull/1945
[#2056]: https://github.com/mochajs/mocha/pull/2056
[#2048]: https://github.com/mochajs/mocha/pull/2048
[#2033]: https://github.com/mochajs/mocha/pull/2033
[#2037]: https://github.com/mochajs/mocha/pull/2037
[#2038]: https://github.com/mochajs/mocha/pull/2038
[#2028]: https://github.com/mochajs/mocha/pull/2028
[#1977]: https://github.com/mochajs/mocha/pull/1977
[#1982]: https://github.com/mochajs/mocha/pull/1982
[#1976]: https://github.com/mochajs/mocha/pull/1976
[#1963]: https://github.com/mochajs/mocha/pull/1963
[#1981]: https://github.com/mochajs/mocha/pull/1981
[#1993]: https://github.com/mochajs/mocha/pull/1993
[#1999]: https://github.com/mochajs/mocha/pull/1999
[#2005]: https://github.com/mochajs/mocha/pull/2005
[#2021]: https://github.com/mochajs/mocha/pull/2021
[1965#]: https://github.com/mochajs/mocha/pull/1965
[#1995]: https://github.com/mochajs/mocha/pull/1995
[#1967]: https://github.com/mochajs/mocha/pull/1967
[@ryanshawty]: https://github.com/ryanshawty
[@pra85]: https://github.com/pra85
[@mislav]: https://github.com/mislav
[@tomhughes]: https://github.com/tomhughes
[@bd82]: https://github.com/bd82
[@stonelgh]: https://github.com/stonelgh
[@danielstjules]: https://github.com/danielstjules
[@ahamid]: https://github.com/ahamid
[@longlho]: https://github.com/longlho
[@Alaneor]: https://github.com/Alaneor
[@iclanzan]: https://github.com/iclanzan
[@robraux]: https://github.com/robraux
[@Standard8]: https://github.com/Standard8
[@segrey]: https://github.com/segrey
[@tmont]: https://github.com/tmont
[@jonnyreeves]: https://github.com/jonnyreeves
[@zetaben]: https://github.com/zetaben
[@cowboyd]: https://github.com/cowboyd
[@ianwremmel]: https://github.com/ianwremmel
[@boneskull]: https://github.com/boneskull
[@jgkim]: https://github.com/jgkim
[@krisr]: https://github.com/krisr

2.3.4 / 2015-11-15
==================
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(The MIT License)

Copyright (c) 2011-2015 TJ Holowaychuk <tj@vision-media.ca>
Copyright (c) 2011-2016 TJ Holowaychuk <tj@vision-media.ca>

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -112,6 +112,11 @@ test-only:
--ui bdd \
test/acceptance/misc/only/bdd

@./bin/mocha \
--reporter $(REPORTER) \
--ui qunit \
test/acceptance/misc/only/bdd-require

@./bin/mocha \
--reporter $(REPORTER) \
--ui qunit \
24 changes: 17 additions & 7 deletions bin/_mocha
Original file line number Diff line number Diff line change
@@ -89,12 +89,16 @@ program
.option('--no-exit', 'require a clean shutdown of the event loop: mocha will not call process.exit')
.option('--no-timeouts', 'disables timeouts, given implicitly with --debug')
.option('--opts <path>', 'specify opts path', 'test/mocha.opts')
.option('--perf-basic-prof', 'enable perf linux profiler (basic support)')
.option('--prof', 'log statistical profiling information')
.option('--log-timer-events', 'Time events including external callbacks')
.option('--recursive', 'include sub directories')
.option('--reporters', 'display available reporters')
.option('--retries <times>', 'set numbers of time to retry a failed test case')
.option('--throw-deprecation', 'throw an exception anytime a deprecated function is used')
.option('--trace', 'trace function calls')
.option('--trace-deprecation', 'show stack traces on deprecations')
.option('--use_strict', 'enforce strict mode')
.option('--watch-extensions <ext>,...', 'additional extensions to monitor with --watch', list, [])
.option('--delay', 'wait for async suite definition')

@@ -169,9 +173,10 @@ program.on('require', function(mod){
requires.push(mod);
});

// load mocha.opts into process.argv

getOptions();
// If not already done, load mocha.opts
if (!process.env.LOADED_MOCHA_OPTS) {
getOptions();
}

// parse args

@@ -201,12 +206,9 @@ if (program.reporterOptions !== undefined) {

mocha.reporter(program.reporter, reporterOptions);

// interface

mocha.ui(program.ui);

// load reporter

var Reporter = null;
try {
Reporter = require('../lib/reporters/' + program.reporter);
} catch (err) {
@@ -284,6 +286,10 @@ if (program.delay) mocha.delay();

mocha.globals(globals);

// --retries

if (program.retries) mocha.suite.retries(program.retries);

// custom compiler support

var extensions = ['js'];
@@ -304,6 +310,10 @@ requires.forEach(function(mod) {
require(mod);
});

// interface

mocha.ui(program.ui);

//args

var args = program.args;
8 changes: 8 additions & 0 deletions bin/mocha
Original file line number Diff line number Diff line change
@@ -8,8 +8,13 @@
var spawn = require('child_process').spawn,
path = require('path'),
fs = require('fs'),
getOptions = require('./options'),
args = [path.join(__dirname, '_mocha')];

// Load mocha.opts into process.argv
// Must be loaded here to handle node-specific options
getOptions();

process.argv.slice(2).forEach(function(arg){
var flag = arg.split('=')[0];

@@ -32,9 +37,12 @@ process.argv.slice(2).forEach(function(arg){
case '--es_staging':
case '--no-deprecation':
case '--prof':
case '--log-timer-events':
case '--throw-deprecation':
case '--trace-deprecation':
case '--use_strict':
case '--allow-natives-syntax':
case '--perf-basic-prof':
args.unshift(arg);
break;
default:
2 changes: 2 additions & 0 deletions bin/options.js
Original file line number Diff line number Diff line change
@@ -34,4 +34,6 @@ function getOptions() {
} catch (err) {
// ignore
}

process.env.LOADED_MOCHA_OPTS = true;
}
2 changes: 1 addition & 1 deletion component.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mocha",
"version": "2.3.4",
"version": "2.4.0",
"repo": "mochajs/mocha",
"description": "simple, flexible, fun test framework",
"keywords": [
15 changes: 15 additions & 0 deletions lib/context.js
Original file line number Diff line number Diff line change
@@ -76,6 +76,21 @@ Context.prototype.skip = function() {
return this;
};

/**
* Allow a number of retries on failed tests
*
* @api private
* @param {number} n
* @return {Context} self
*/
Context.prototype.retries = function(n) {
if (!arguments.length) {
return this.runnable().retries();
}
this.runnable().retries(n);
return this;
};

/**
* Inspect the context void of `._runnable`.
*
11 changes: 9 additions & 2 deletions lib/interfaces/bdd.js
Original file line number Diff line number Diff line change
@@ -77,7 +77,7 @@ module.exports = function(suite) {
* acting as a thunk.
*/

context.it = context.specify = function(title, fn) {
var it = context.it = context.specify = function(title, fn) {
var suite = suites[0];
if (suite.pending) {
fn = null;
@@ -93,7 +93,7 @@ module.exports = function(suite) {
*/

context.it.only = function(title, fn) {
var test = context.it(title, fn);
var test = it(title, fn);
var reString = '^' + escapeRe(test.fullTitle()) + '$';
mocha.grep(new RegExp(reString));
return test;
@@ -106,5 +106,12 @@ module.exports = function(suite) {
context.xit = context.xspecify = context.it.skip = function(title) {
context.it(title);
};

/**
* Number of attempts to retry.
*/
context.it.retries = function(n) {
context.retries(n);
};
});
};
9 changes: 9 additions & 0 deletions lib/interfaces/common.js
Original file line number Diff line number Diff line change
@@ -70,6 +70,15 @@ module.exports = function(suites, context) {
*/
skip: function(title) {
context.test(title);
},

/**
* Number of retry attempts
*
* @param {string} n
*/
retries: function(n) {
context.retries(n);
}
}
};
2 changes: 1 addition & 1 deletion lib/interfaces/exports.js
Original file line number Diff line number Diff line change
@@ -53,7 +53,7 @@ module.exports = function(suite) {
} else {
suite = Suite.create(suites[0], key);
suites.unshift(suite);
visit(obj[key]);
visit(obj[key], file);
suites.shift();
}
}
1 change: 1 addition & 0 deletions lib/interfaces/qunit.js
Original file line number Diff line number Diff line change
@@ -89,5 +89,6 @@ module.exports = function(suite) {
};

context.test.skip = common.test.skip;
context.test.retries = common.test.retries;
});
};
1 change: 1 addition & 0 deletions lib/interfaces/tdd.js
Original file line number Diff line number Diff line change
@@ -101,5 +101,6 @@ module.exports = function(suite) {
};

context.test.skip = common.test.skip;
context.test.retries = common.test.retries;
});
};
19 changes: 17 additions & 2 deletions lib/mocha.js
Original file line number Diff line number Diff line change
@@ -62,6 +62,7 @@ function image(name) {
* - `reporter` reporter instance, defaults to `mocha.reporters.spec`
* - `globals` array of accepted globals
* - `timeout` timeout in milliseconds
* - `retries` number of times to retry failed tests
* - `bail` bail on the first test failure
* - `slow` milliseconds to wait before considering a test slow
* - `ignoreLeaks` ignore global leaks
@@ -88,6 +89,9 @@ function Mocha(options) {
if (typeof options.timeout !== 'undefined' && options.timeout !== null) {
this.timeout(options.timeout);
}
if (typeof options.retries !== 'undefined' && options.retries !== null) {
this.retries(options.retries);
}
this.useColors(options.useColors);
if (options.enableTimeouts !== null) {
this.enableTimeouts(options.enableTimeouts);
@@ -209,14 +213,13 @@ Mocha.prototype.ui = function(name) {
Mocha.prototype.loadFiles = function(fn) {
var self = this;
var suite = this.suite;
var pending = this.files.length;
this.files.forEach(function(file) {
file = path.resolve(file);
suite.emit('pre-require', global, file, self);
suite.emit('require', require(file), file, self);
suite.emit('post-require', global, file, self);
--pending || (fn && fn());
});
fn && fn();
};

/**
@@ -372,6 +375,18 @@ Mocha.prototype.timeout = function(timeout) {
return this;
};

/**
* Set the number of times to retry failed tests.
*
* @param {Number} retry times
* @return {Mocha}
* @api public
*/
Mocha.prototype.retries = function(n) {
this.suite.retries(n);
return this;
};

/**
* Set slowness threshold in milliseconds.
*
Loading