jest-each
Advanced tools
Comparing version 25.0.0 to 25.1.0
@@ -15,4 +15,4 @@ /** | ||
declare type GlobalCallback = (testName: string, fn: TestFn, timeout?: number) => void; | ||
declare const _default: (cb: GlobalCallback, supportsDone?: boolean) => (table: Global.EachTable, ...taggedTemplateData: unknown[]) => (title: string, test: Global.EachTestFn, timeout?: number | undefined) => void; | ||
declare const _default: (cb: GlobalCallback, supportsDone?: boolean) => (table: Global.EachTable, ...taggedTemplateData: Global.TemplateData) => (title: string, test: Global.EachTestFn, timeout?: number | undefined) => void; | ||
export default _default; | ||
//# sourceMappingURL=bind.d.ts.map |
@@ -49,3 +49,3 @@ 'use strict'; | ||
} catch (e) { | ||
const error = new (_jestUtil()).ErrorWithStack(e.message, eachBind); | ||
const error = new (_jestUtil().ErrorWithStack)(e.message, eachBind); | ||
return cb(title, () => { | ||
@@ -52,0 +52,0 @@ throw error; |
@@ -12,3 +12,3 @@ /** | ||
declare const each: { | ||
(table: Global.EachTable, ...data: unknown[]): { | ||
(table: Global.EachTable, ...data: Global.TemplateData): { | ||
describe: { | ||
@@ -35,3 +35,3 @@ (title: string, suite: Global.EachTestFn, timeout?: number | undefined): void; | ||
}; | ||
withGlobal(g: Global.Global): (table: Global.EachTable, ...data: unknown[]) => { | ||
withGlobal(g: Global.Global): (table: Global.EachTable, ...data: Global.TemplateData) => { | ||
describe: { | ||
@@ -38,0 +38,0 @@ (title: string, suite: Global.EachTestFn, timeout?: number | undefined): void; |
@@ -9,7 +9,5 @@ /** | ||
import { Global } from '@jest/types'; | ||
declare const _default: (title: string, arrayTable: Global.ArrayTable) => { | ||
title: string; | ||
arguments: unknown[]; | ||
}[]; | ||
import { EachTests } from '../bind'; | ||
declare const _default: (title: string, arrayTable: Global.ArrayTable) => EachTests; | ||
export default _default; | ||
//# sourceMappingURL=array.d.ts.map |
@@ -32,25 +32,42 @@ 'use strict'; | ||
function _getRequireWildcardCache() { | ||
if (typeof WeakMap !== 'function') return null; | ||
var cache = new WeakMap(); | ||
_getRequireWildcardCache = function() { | ||
return cache; | ||
}; | ||
return cache; | ||
} | ||
function _interopRequireWildcard(obj) { | ||
if (obj && obj.__esModule) { | ||
return obj; | ||
} else { | ||
var newObj = {}; | ||
if (obj != null) { | ||
for (var key in obj) { | ||
if (Object.prototype.hasOwnProperty.call(obj, key)) { | ||
var desc = | ||
Object.defineProperty && Object.getOwnPropertyDescriptor | ||
? Object.getOwnPropertyDescriptor(obj, key) | ||
: {}; | ||
if (desc.get || desc.set) { | ||
Object.defineProperty(newObj, key, desc); | ||
} else { | ||
newObj[key] = obj[key]; | ||
} | ||
} | ||
} | ||
if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) { | ||
return {default: obj}; | ||
} | ||
var cache = _getRequireWildcardCache(); | ||
if (cache && cache.has(obj)) { | ||
return cache.get(obj); | ||
} | ||
var newObj = {}; | ||
var hasPropertyDescriptor = | ||
Object.defineProperty && Object.getOwnPropertyDescriptor; | ||
for (var key in obj) { | ||
if (Object.prototype.hasOwnProperty.call(obj, key)) { | ||
var desc = hasPropertyDescriptor | ||
? Object.getOwnPropertyDescriptor(obj, key) | ||
: null; | ||
if (desc && (desc.get || desc.set)) { | ||
Object.defineProperty(newObj, key, desc); | ||
} else { | ||
newObj[key] = obj[key]; | ||
} | ||
} | ||
newObj.default = obj; | ||
return newObj; | ||
} | ||
newObj.default = obj; | ||
if (cache) { | ||
cache.set(obj, newObj); | ||
} | ||
return newObj; | ||
} | ||
@@ -57,0 +74,0 @@ |
@@ -8,7 +8,7 @@ /** | ||
*/ | ||
import { Global } from '@jest/types'; | ||
import { EachTests } from '../bind'; | ||
declare type Template = Record<string, unknown>; | ||
declare const _default: (title: string, headings: string[], row: unknown[]) => { | ||
title: string; | ||
arguments: unknown[]; | ||
}[]; | ||
declare type Headings = Array<string>; | ||
declare const _default: (title: string, headings: Headings, row: Global.Row) => EachTests; | ||
export default _default; | ||
@@ -15,0 +15,0 @@ export declare function getPath<Obj extends Template, A extends keyof Obj, B extends keyof Obj[A], C extends keyof Obj[A][B], D extends keyof Obj[A][B][C], E extends keyof Obj[A][B][C][D]>(obj: Obj, path: [A, B, C, D, E]): Obj[A][B][C][D][E]; |
@@ -8,4 +8,5 @@ /** | ||
*/ | ||
import { Global } from '@jest/types'; | ||
export declare const validateArrayTable: (table: any) => void; | ||
export declare const validateTemplateTableHeadings: (headings: string[], data: unknown[]) => void; | ||
export declare const validateTemplateTableHeadings: (headings: string[], data: Global.TemplateData) => void; | ||
//# sourceMappingURL=validation.d.ts.map |
{ | ||
"name": "jest-each", | ||
"version": "25.0.0", | ||
"version": "25.1.0", | ||
"description": "Parameterised tests for Jest", | ||
@@ -21,10 +21,10 @@ "main": "build/index.js", | ||
"dependencies": { | ||
"@jest/types": "^25.0.0", | ||
"chalk": "^2.0.1", | ||
"jest-get-type": "^25.0.0", | ||
"jest-util": "^25.0.0", | ||
"pretty-format": "^25.0.0" | ||
"@jest/types": "^25.1.0", | ||
"chalk": "^3.0.0", | ||
"jest-get-type": "^25.1.0", | ||
"jest-util": "^25.1.0", | ||
"pretty-format": "^25.1.0" | ||
}, | ||
"engines": { | ||
"node": ">= 8" | ||
"node": ">= 8.3" | ||
}, | ||
@@ -34,3 +34,3 @@ "publishConfig": { | ||
}, | ||
"gitHead": "ff9269be05fd8316e95232198fce3463bf2f270e" | ||
"gitHead": "170eee11d03b0ed5c60077982fdbc3bafd403638" | ||
} |
106
README.md
@@ -146,8 +146,9 @@ <div align="center"> | ||
```js | ||
each([[1, 1, 2], [1, 2, 3], [2, 1, 3]]).test( | ||
'returns the result of adding %d to %d', | ||
(a, b, expected) => { | ||
expect(a + b).toBe(expected); | ||
}, | ||
); | ||
each([ | ||
[1, 1, 2], | ||
[1, 2, 3], | ||
[2, 1, 3], | ||
]).test('returns the result of adding %d to %d', (a, b, expected) => { | ||
expect(a + b).toBe(expected); | ||
}); | ||
``` | ||
@@ -160,8 +161,9 @@ | ||
```js | ||
each([[1, 1, 2], [1, 2, 3], [2, 1, 3]]).test.only( | ||
'returns the result of adding %d to %d', | ||
(a, b, expected) => { | ||
expect(a + b).toBe(expected); | ||
}, | ||
); | ||
each([ | ||
[1, 1, 2], | ||
[1, 2, 3], | ||
[2, 1, 3], | ||
]).test.only('returns the result of adding %d to %d', (a, b, expected) => { | ||
expect(a + b).toBe(expected); | ||
}); | ||
``` | ||
@@ -174,8 +176,9 @@ | ||
```js | ||
each([[1, 1, 2], [1, 2, 3], [2, 1, 3]]).test.skip( | ||
'returns the result of adding %d to %d', | ||
(a, b, expected) => { | ||
expect(a + b).toBe(expected); | ||
}, | ||
); | ||
each([ | ||
[1, 1, 2], | ||
[1, 2, 3], | ||
[2, 1, 3], | ||
]).test.skip('returns the result of adding %d to %d', (a, b, expected) => { | ||
expect(a + b).toBe(expected); | ||
}); | ||
``` | ||
@@ -203,20 +206,21 @@ | ||
```js | ||
each([[1, 1, 2], [1, 2, 3], [2, 1, 3]]).describe( | ||
'.add(%d, %d)', | ||
(a, b, expected) => { | ||
test(`returns ${expected}`, () => { | ||
expect(a + b).toBe(expected); | ||
}); | ||
each([ | ||
[1, 1, 2], | ||
[1, 2, 3], | ||
[2, 1, 3], | ||
]).describe('.add(%d, %d)', (a, b, expected) => { | ||
test(`returns ${expected}`, () => { | ||
expect(a + b).toBe(expected); | ||
}); | ||
test('does not mutate first arg', () => { | ||
a + b; | ||
expect(a).toBe(a); | ||
}); | ||
test('does not mutate first arg', () => { | ||
a + b; | ||
expect(a).toBe(a); | ||
}); | ||
test('does not mutate second arg', () => { | ||
a + b; | ||
expect(b).toBe(b); | ||
}); | ||
}, | ||
); | ||
test('does not mutate second arg', () => { | ||
a + b; | ||
expect(b).toBe(b); | ||
}); | ||
}); | ||
``` | ||
@@ -229,10 +233,11 @@ | ||
```js | ||
each([[1, 1, 2], [1, 2, 3], [2, 1, 3]]).describe.only( | ||
'.add(%d, %d)', | ||
(a, b, expected) => { | ||
test(`returns ${expected}`, () => { | ||
expect(a + b).toBe(expected); | ||
}); | ||
}, | ||
); | ||
each([ | ||
[1, 1, 2], | ||
[1, 2, 3], | ||
[2, 1, 3], | ||
]).describe.only('.add(%d, %d)', (a, b, expected) => { | ||
test(`returns ${expected}`, () => { | ||
expect(a + b).toBe(expected); | ||
}); | ||
}); | ||
``` | ||
@@ -245,10 +250,11 @@ | ||
```js | ||
each([[1, 1, 2], [1, 2, 3], [2, 1, 3]]).describe.skip( | ||
'.add(%d, %d)', | ||
(a, b, expected) => { | ||
test(`returns ${expected}`, () => { | ||
expect(a + b).toBe(expected); | ||
}); | ||
}, | ||
); | ||
each([ | ||
[1, 1, 2], | ||
[1, 2, 3], | ||
[2, 1, 3], | ||
]).describe.skip('.add(%d, %d)', (a, b, expected) => { | ||
test(`returns ${expected}`, () => { | ||
expect(a + b).toBe(expected); | ||
}); | ||
}); | ||
``` | ||
@@ -255,0 +261,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
35482
515
450
1
- Removedansi-styles@3.2.1(transitive)
- Removedchalk@2.4.2(transitive)
- Removedcolor-convert@1.9.3(transitive)
- Removedcolor-name@1.1.3(transitive)
- Removedescape-string-regexp@1.0.5(transitive)
- Removedhas-flag@3.0.0(transitive)
- Removedsupports-color@5.5.0(transitive)
Updated@jest/types@^25.1.0
Updatedchalk@^3.0.0
Updatedjest-get-type@^25.1.0
Updatedjest-util@^25.1.0
Updatedpretty-format@^25.1.0