Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cypress-each

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cypress-each - npm Package Compare versions

Comparing version 1.8.0 to 1.9.0

2

package.json
{
"name": "cypress-each",
"version": "1.8.0",
"version": "1.9.0",
"description": "Simple implementation for describe.each and it.each",

@@ -5,0 +5,0 @@ "main": "src",

@@ -191,2 +191,11 @@ # cypress-each ![cypress version](https://img.shields.io/badge/cypress-9.0.0-brightgreen) [![renovate-app badge][renovate-badge]][renovate-app] [![ci](https://github.com/bahmutov/cypress-each/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/bahmutov/cypress-each/actions/workflows/ci.yml)

## Custom filter predicate
You can filter the items by passing a predicate function
```js
it.each(items, (x, k) => ...)
// creates a test for every item the predicate returns a truthy value
```
## Exclusive tests

@@ -193,0 +202,0 @@

@@ -6,2 +6,3 @@ // types for it.each and describe.each

type TestTitleFn<T> = (item: T, index: number, items: T[]) => string
type ItemPredicateFunction<T> = (item: T, index: number, items: T[]) => boolean

@@ -16,3 +17,3 @@ declare namespace Mocha {

* @param values Input items to create the tests form OR number of times to repeat a test
* @param totalChunks (Optional) number of chunks to split the items into
* @param totalChunks (Optional) number of chunks to split the items into, or Nth filter, or a predicate function
* @param chunkIndex (Optional) index of the chunk to get items from

@@ -24,3 +25,3 @@ * @example it.each([1, 2, 3])('test %K', (x) => ...)

values: T[] | number,
totalChunks?: number,
totalChunks?: number | ItemPredicateFunction<T>,
chunkIndex?: number,

@@ -27,0 +28,0 @@ ): (titlePattern: string | TestTitleFn<T>, fn: TestCallback<T>) => void

@@ -75,2 +75,5 @@ /// <reference types="cypress" />

values = values.filter((_, k) => k % totalChunks === 0)
} else if (typeof totalChunks === 'function') {
// filter using the given predicate
values = values.filter(totalChunks)
}

@@ -77,0 +80,0 @@

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