cypress-each
Advanced tools
Comparing version 1.6.0 to 1.7.0
{ | ||
"name": "cypress-each", | ||
"version": "1.6.0", | ||
"version": "1.7.0", | ||
"description": "Simple implementation for describe.each and it.each", | ||
@@ -5,0 +5,0 @@ "main": "src", |
@@ -8,6 +8,8 @@ # cypress-each ![cypress version](https://img.shields.io/badge/cypress-8.7.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) | ||
- [Refactor Tests To Be Independent And Fast Using Cypress-Each Plugin](https://glebbahmutov.com/blog/refactor-using-each/) | ||
- [Test your sitemap using Cypress](https://glebbahmutov.com/blog/test-sitemap/) | ||
## Videos | ||
- Watch [Using cypress-each To Create Separate Tests](https://youtu.be/utPKRV_fL1E) | ||
- [Using cypress-each To Create Separate Tests](https://youtu.be/utPKRV_fL1E) | ||
- [Test Each URL From Sitemap In Its Own Separate Cypress Test](https://youtu.be/qkofPocd7lY) | ||
@@ -114,2 +116,11 @@ ## Install and use | ||
You can use `%N` to insert the total number of items | ||
```js | ||
it.each(['first', 'second'])('test %K of %N', (x) => { ... }) | ||
// creates the tests | ||
// "test 1 of 2" | ||
// "test 2 of 2" | ||
``` | ||
### Title function | ||
@@ -116,0 +127,0 @@ |
@@ -35,3 +35,6 @@ /// <reference types="cypress" /> | ||
if (typeof titlePattern === 'string') { | ||
const testTitle = titlePattern.replace('%k', k).replace('%K', k + 1) | ||
const testTitle = titlePattern | ||
.replace('%k', k) | ||
.replace('%K', k + 1) | ||
.replace('%N', values.length) | ||
if (Array.isArray(value)) { | ||
@@ -70,3 +73,2 @@ return formatTitle(testTitle, ...value) | ||
values.forEach(function (value, k) { | ||
// const testTitle = titlePattern.replace('%k', k).replace('%K', k + 1) | ||
const title = makeTitle(titlePattern, value, k, values) | ||
@@ -118,3 +120,2 @@ if (!title) { | ||
values.forEach((value, k) => { | ||
// const testTitle = titlePattern.replace('%k', k).replace('%K', k + 1) | ||
const title = makeTitle(titlePattern, value, k, values) | ||
@@ -140,2 +141,2 @@ | ||
module.exports = { formatTitle, getChunk } | ||
module.exports = { formatTitle, makeTitle, getChunk } |
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
15958
158
291