Socket
Socket
Sign inDemoInstall

jest-each

Package Overview
Dependencies
Maintainers
1
Versions
144
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jest-each - npm Package Compare versions

Comparing version 0.0.1 to 0.1.0

11

dist/index.js

@@ -33,4 +33,7 @@ (function (global, factory) {

exports.default = function (parameterRows) {
var globalTest = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : global.test;
var defaultGlobal = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : global;
var globalTest = defaultGlobal.test;
var globalIt = defaultGlobal.it;
var test = parameterisedTests(parameterRows, globalTest);

@@ -40,3 +43,7 @@ test.skip = parameterisedTests(parameterRows, globalTest.skip);

return { test: test };
var it = parameterisedTests(parameterRows, globalIt);
it.skip = parameterisedTests(parameterRows, globalIt.skip);
it.only = parameterisedTests(parameterRows, globalIt.only);
return { test: test, it: it };
};

@@ -43,0 +50,0 @@

2

package.json
{
"name": "jest-each",
"version": "0.0.1",
"version": "0.1.0",
"description": "Parameterised tests for Jest",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -11,7 +11,10 @@ # jest-each

## Features
- Parameterised test data
- `.test` to runs multiple tests with parameterised data
* Also under the alias: `.it`
- `.test.skip` to skip the parameterised tests
* Also under the alias: `.it.skip`
- `.test.only` to only run the parameterised tests
* Also under the alias: `.it.only`
- Asynchronous tests with `done`
- Unique test titles with: [sprintf](https://github.com/alexei/sprintf.js)
- Supports `test.skip` to skip the parameterised tests
- Supports `test.only` to only run the parameterised tests
- Supports asynchronous tests with `done`

@@ -38,14 +41,16 @@ ## Installation

`each([parameters]).test(title, testCallback)`
### `each([parameters]).test(name, fn)`
#### `each`:
- parameters: `Array` the arguments that are passed into the `testCallback`
- parameters: `Array` the arguments that are passed into the `fn`
#### `.test`:
- title: `String` the title of the `test`, use `%s` in the title string to positionally inject parameter values into the test title
- testCallback: `Function` the test logic, this is the function that will receive the parameters as function arguments
- name: `String` the title of the `test`, use `%s` in the name string to positionally inject parameter values into the test title
- fn: `Function` the test logic, this is the function that will receive the parameters as function arguments
## Usage
#### `.test`
#### `.test(name, fn)`
Alias: `.it(name, fn)`
```js

@@ -64,3 +69,5 @@ import each from 'jest-each';

#### `.test.only`
#### `.test.only(name, fn)`
Alias: `.it.only(name, fn)`
```js

@@ -72,3 +79,5 @@ each([ [1, 1, 2] ]).test.only('returns the result of adding %s to %s', (a, b, expected) => {

#### `.test.skip`
#### `.test.skip(name, fn)`
Alias: `.it.skip(name, fn)`
```js

@@ -80,3 +89,5 @@ each([ [1, 1, 2] ]).test.skip('returns the result of adding %s to %s', (a, b, expected) => {

#### asynchronous `.test`
#### Asynchronous `.test(name, fn(done))`
Alias: `.it(name, fn(done))`
```js

@@ -83,0 +94,0 @@ each([

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc