jest-each
Advanced tools
Comparing version 23.4.0 to 23.5.0
@@ -55,2 +55,3 @@ 'use strict'; | ||
const PRETTY_PLACEHOLDER = '%p'; | ||
const INDEX_PLACEHOLDER = '%#'; | ||
@@ -67,3 +68,3 @@ exports.default = cb => | ||
return function eachBind(title, test) { | ||
return function eachBind(title, test, timeout) { | ||
if (args.length === 1) { | ||
@@ -73,9 +74,10 @@ const table = args[0].every(Array.isArray) | ||
: args[0].map(entry => [entry]); | ||
return table.forEach(row => | ||
return table.forEach((row, i) => | ||
cb( | ||
arrayFormat.apply( | ||
undefined, | ||
[title].concat(_toConsumableArray(row)) | ||
[title, i].concat(_toConsumableArray(row)) | ||
), | ||
applyRestParams(row, test) | ||
applyRestParams(row, test), | ||
timeout | ||
) | ||
@@ -119,3 +121,3 @@ ); | ||
return table.forEach(row => | ||
cb(interpolate(title, row), applyObjectParams(row, test)) | ||
cb(interpolate(title, row), applyObjectParams(row, test), timeout) | ||
); | ||
@@ -132,11 +134,11 @@ }; | ||
const arrayFormat = function(title) { | ||
const arrayFormat = function(title, rowIndex) { | ||
for ( | ||
var _len2 = arguments.length, | ||
args = Array(_len2 > 1 ? _len2 - 1 : 0), | ||
_key2 = 1; | ||
args = Array(_len2 > 2 ? _len2 - 2 : 0), | ||
_key2 = 2; | ||
_key2 < _len2; | ||
_key2++ | ||
) { | ||
args[_key2 - 1] = arguments[_key2]; | ||
args[_key2 - 2] = arguments[_key2]; | ||
} | ||
@@ -175,3 +177,3 @@ | ||
(_util || _load_util()).default, | ||
[prettyTitle].concat( | ||
[prettyTitle.replace(INDEX_PLACEHOLDER, rowIndex.toString())].concat( | ||
_toConsumableArray( | ||
@@ -178,0 +180,0 @@ remainingArgs.slice(0, placeholders.length - prettyIndexes.length) |
@@ -29,6 +29,7 @@ 'use strict'; | ||
const test = (title, test) => | ||
const test = (title, test, timeout) => | ||
(0, (_bind || _load_bind()).default)(g.test).apply(undefined, args)( | ||
title, | ||
test | ||
test, | ||
timeout | ||
); | ||
@@ -44,6 +45,7 @@ test.skip = (0, (_bind || _load_bind()).default)(g.test.skip).apply( | ||
const it = (title, test) => | ||
const it = (title, test, timeout) => | ||
(0, (_bind || _load_bind()).default)(g.it).apply(undefined, args)( | ||
title, | ||
test | ||
test, | ||
timeout | ||
); | ||
@@ -72,6 +74,7 @@ it.skip = (0, (_bind || _load_bind()).default)(g.it.skip).apply( | ||
const describe = (title, suite) => | ||
const describe = (title, suite, timeout) => | ||
(0, (_bind || _load_bind()).default)(g.describe).apply(undefined, args)( | ||
title, | ||
suite | ||
suite, | ||
timeout | ||
); | ||
@@ -78,0 +81,0 @@ describe.skip = (0, (_bind || _load_bind()).default)(g.describe.skip).apply( |
{ | ||
"name": "jest-each", | ||
"version": "23.4.0", | ||
"version": "23.5.0", | ||
"description": "Parameterised tests for Jest", | ||
@@ -20,4 +20,4 @@ "main": "build/index.js", | ||
"chalk": "^2.0.1", | ||
"pretty-format": "^23.2.0" | ||
"pretty-format": "^23.5.0" | ||
} | ||
} |
@@ -36,2 +36,3 @@ <div align="center"> | ||
- `%o` - Object. | ||
- `%#` - Index of the test case. | ||
- `%%` - single percent sign ('%'). This does not consume an argument. | ||
@@ -113,2 +114,3 @@ - 🖖 Spock like data tables with [Tagged Template Literals](#tagged-template-literal-of-rows) | ||
- `%o` - Object. | ||
- `%#` - Index of the test case. | ||
- `%%` - single percent sign ('%'). This does not consume an argument. | ||
@@ -135,2 +137,3 @@ - testFn: `Function` the test logic, this is the function that will receive the parameters of each row as function arguments | ||
- `%o` - Object. | ||
- `%#` - Index of the test case. | ||
- `%%` - single percent sign ('%'). This does not consume an argument. | ||
@@ -137,0 +140,0 @@ - suiteFn: `Function` the suite of `test`/`it`s to be ran, this is the function that will receive the parameters in each row as function arguments |
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
20653
322
444
Updatedpretty-format@^23.5.0