mocha-retry
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -31,5 +31,10 @@ // Generated by CoffeeScript 1.7.1 | ||
}; | ||
context.describe = context.context = function(title, fn) { | ||
var asuite; | ||
context.describe = context.context = function(times, title, fn) { | ||
var asuite, _ref; | ||
if (fn == null) { | ||
_ref = [times, title], title = _ref[0], fn = _ref[1]; | ||
times = void 0; | ||
} | ||
asuite = Suite.create(suites[0], title); | ||
asuite.times = times; | ||
asuite.file = file; | ||
@@ -41,4 +46,8 @@ suites.unshift(asuite); | ||
}; | ||
context.xdescribe = context.xcontext = context.describe.skip = function(title, fn) { | ||
var asuite; | ||
context.xdescribe = context.xcontext = context.describe.skip = function(times, title, fn) { | ||
var asuite, _ref; | ||
if (fn == null) { | ||
_ref = [times, title], title = _ref[0], fn = _ref[1]; | ||
times = void 0; | ||
} | ||
asuite = Suite.create(suites[0], title); | ||
@@ -50,5 +59,5 @@ asuite.pending = true; | ||
}; | ||
context.describe.only = function(title, fn) { | ||
context.describe.only = function(times, title, fn) { | ||
var asuite; | ||
asuite = context.describe(title, fn); | ||
asuite = context.describe(times, title, fn); | ||
mocha.grep(asuite.fullTitle()); | ||
@@ -60,5 +69,5 @@ return asuite; | ||
asuite = suites[0]; | ||
if (fn == null) { | ||
if ((fn == null) && typeof times !== 'number') { | ||
_ref = [times, title], title = _ref[0], fn = _ref[1]; | ||
times = 1; | ||
times = asuite.times != null ? asuite.times : 1; | ||
} | ||
@@ -73,5 +82,5 @@ if (asuite.pending) { | ||
}; | ||
context.it.only = function(title, fn) { | ||
context.it.only = function(times, title, fn) { | ||
var reString, test; | ||
test = context.it(title, fn); | ||
test = context.it(times, title, fn); | ||
reString = "^" + utils.escapeRegexp(test.fullTitle()) + "$"; | ||
@@ -81,4 +90,11 @@ mocha.grep(new RegExp(reString)); | ||
}; | ||
return context.xit = context.xspecify = context.it.skip = function(title) { | ||
return context.it(title); | ||
return context.xit = context.xspecify = context.it.skip = function(times, title, fn) { | ||
var _ref; | ||
if (title == null) { | ||
return context.it(times); | ||
} | ||
if (fn == null) { | ||
_ref = [1, times, title], times = _ref[0], title = _ref[1], fn = _ref[2]; | ||
} | ||
return context.it(times, title); | ||
}; | ||
@@ -85,0 +101,0 @@ }); |
{ | ||
"name": "mocha-retry", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "a way to retry tests", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -28,9 +28,25 @@ # Mocha Retry | ||
You can specify the retry count like this: | ||
You can specify the retry count on the test directly like this: | ||
```coffeescript | ||
it 2, 'works', -> | ||
it 2, 'a test', -> | ||
#your test goes here, it will be retried at most twice | ||
``` | ||
Or you can specify the retry count on the suite, like this: | ||
```coffeescript | ||
describe 4, 'some suite', -> | ||
it 'a test', -> | ||
#your test goes here, it will be retried at most twice | ||
``` | ||
If you specify both the test has precedence. This test will be retried at most twice, not 4 times: | ||
```coffeescript | ||
describe 4, 'some suite', -> | ||
it 2, 'a test', -> | ||
#your test goes here, it will be retried at most twice | ||
``` | ||
You can still use the default `it` behaviour, without retry, just do not specify a retry as you normally would on a Mocha test. | ||
@@ -37,0 +53,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
24943
198
81