cypress-each
Advanced tools
Comparing version 1.2.0 to 1.2.1
{ | ||
"name": "cypress-each", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "Simple implementation for describe.each and it.each", | ||
@@ -5,0 +5,0 @@ "main": "src", |
@@ -15,2 +15,19 @@ # cypress-each ![cypress version](https://img.shields.io/badge/cypress-8.5.0-brightgreen) | ||
## Types | ||
This package includes TypeScript definition for `it.each` and `describe.each`. Thus the parameter should be the right type from the array of values: | ||
```js | ||
it.each([ | ||
{ name: 'Joe', age: 30 }, | ||
{ name: 'Mary', age: 20 }, | ||
])('has correct types', (user) => { | ||
// the type for the "user" should be | ||
// name: string, age: number | ||
expect(user).to.have.keys('name', 'age') | ||
expect(user.name).to.be.a('string') | ||
expect(user.age).to.be.a('number') | ||
}) | ||
``` | ||
## Small print | ||
@@ -17,0 +34,0 @@ |
@@ -5,20 +5,17 @@ // types for it.each and describe.each | ||
declare namespace Mocha { | ||
type TestCallback = ( | ||
this: Context, | ||
arg0: unknown, | ||
arg1: unknown, | ||
arg2: unknown, | ||
) => void | ||
type TestCallback<T> = (this: Context, arg0: T, arg1: any, arg2: any) => void | ||
interface TestFunction { | ||
each: ( | ||
values: unknown[], | ||
) => (titlePattern: string, fn: TestCallback) => void | ||
// definition for it.each | ||
each<T = unknown>( | ||
values: T[], | ||
): (titlePattern: string, fn: TestCallback<T>) => void | ||
} | ||
interface SuiteFunction { | ||
each: ( | ||
values: unknown[], | ||
) => (titlePattern: string, fn: TestCallback) => void | ||
// definition for describe.each | ||
each<T = unknown>( | ||
values: T[], | ||
): (titlePattern: string, fn: TestCallback<T>) => void | ||
} | ||
} |
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
5917
72
60