Socket
Socket
Sign inDemoInstall

jest-each

Package Overview
Dependencies
Maintainers
6
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 30.0.0-alpha.2 to 30.0.0-alpha.3

30

build/index.js

@@ -45,3 +45,3 @@ /*!

const bindWrap = (table, ...taggedTemplateData) => {
const error = new (_jestUtil().ErrorWithStack)(undefined, bindWrap);
const errorWithStack = new (_jestUtil().ErrorWithStack)(undefined, bindWrap);
return function eachBind(title, test, timeout) {

@@ -52,8 +52,8 @@ title = (0, _jestUtil().convertDescriptorToString)(title);

for (const row of tests) {
needsEachError ? cb(row.title, applyArguments(supportsDone, row.arguments, test), timeout, error) : cb(row.title, applyArguments(supportsDone, row.arguments, test), timeout);
needsEachError ? cb(row.title, applyArguments(supportsDone, row.arguments, test), timeout, errorWithStack) : cb(row.title, applyArguments(supportsDone, row.arguments, test), timeout);
}
return;
} catch (e) {
const err = new Error(e.message);
err.stack = error.stack?.replace(/^Error: /s, `Error: ${e.message}`);
} catch (error) {
const err = new Error(error.message);
err.stack = errorWithStack.stack?.replace(/^Error: /s, `Error: ${error.message}`);
return cb(title, () => {

@@ -77,3 +77,3 @@ throw err;

};
const getHeadingKeys = headings => (0, _validation.extractValidTemplateHeadings)(headings).replace(/\s/g, '').split('|');
const getHeadingKeys = headings => (0, _validation.extractValidTemplateHeadings)(headings).replaceAll(/\s/g, '').split('|');
const applyArguments = (supportsDone, params, test) => supportsDone && params.length < test.length ? done => test(...params, done) : () => test(...params);

@@ -117,3 +117,3 @@

const SUPPORTED_PLACEHOLDERS = /%[sdifjoOp#]/g;
const SUPPORTED_PLACEHOLDERS = /%[#Odfijops]/g;
const PRETTY_PLACEHOLDER = '%p';

@@ -128,3 +128,3 @@ const INDEX_PLACEHOLDER = '%#';

arguments: [template],
title: (0, _interpolation.interpolateVariables)(title, template, index).replace(ESCAPED_PLACEHOLDER_PREFIX, PLACEHOLDER_PREFIX)
title: (0, _interpolation.interpolateVariables)(title, template, index).replaceAll(ESCAPED_PLACEHOLDER_PREFIX, PLACEHOLDER_PREFIX)
}));

@@ -147,6 +147,6 @@ }

return util().format(formattedTitle, normalisedValue);
}, interpolateTitleIndex(interpolateEscapedPlaceholders(title), rowIndex)).replace(new RegExp(JEST_EACH_PLACEHOLDER_ESCAPE, 'g'), PLACEHOLDER_PREFIX);
const normalisePlaceholderValue = value => typeof value === 'string' ? value.replace(new RegExp(PLACEHOLDER_PREFIX, 'g'), JEST_EACH_PLACEHOLDER_ESCAPE) : value;
}, interpolateTitleIndex(interpolateEscapedPlaceholders(title), rowIndex)).replaceAll(new RegExp(JEST_EACH_PLACEHOLDER_ESCAPE, 'g'), PLACEHOLDER_PREFIX);
const normalisePlaceholderValue = value => typeof value === 'string' ? value.replaceAll(new RegExp(PLACEHOLDER_PREFIX, 'g'), JEST_EACH_PLACEHOLDER_ESCAPE) : value;
const getMatchingPlaceholders = title => title.match(SUPPORTED_PLACEHOLDERS) || [];
const interpolateEscapedPlaceholders = title => title.replace(ESCAPED_PLACEHOLDER_PREFIX, JEST_EACH_PLACEHOLDER_ESCAPE);
const interpolateEscapedPlaceholders = title => title.replaceAll(ESCAPED_PLACEHOLDER_PREFIX, JEST_EACH_PLACEHOLDER_ESCAPE);
const interpolateTitleIndex = (title, index) => title.replace(INDEX_PLACEHOLDER, index.toString());

@@ -192,3 +192,3 @@ const interpolatePrettyPlaceholder = (title, value) => title.replace(PRETTY_PLACEHOLDER, (0, _prettyFormat().format)(value, {

const interpolateVariables = (title, template, index) => title.replace(new RegExp(`\\$(${Object.keys(template).join('|')})[.\\w]*`, 'g'), match => {
const interpolateVariables = (title, template, index) => title.replaceAll(new RegExp(`\\$(${Object.keys(template).join('|')})[.\\w]*`, 'g'), match => {
const keyPath = match.slice(1).split('.');

@@ -240,5 +240,3 @@ const value = getPath(template, keyPath);

}, (_, index) => row.slice(index * headings.length, index * headings.length + headings.length));
const convertTableToTemplates = (table, headings) => table.map(row => row.reduce((acc, value, index) => Object.assign(acc, {
[headings[index]]: value
}), {}));
const convertTableToTemplates = (table, headings) => table.map(row => Object.fromEntries(row.map((value, index) => [headings[index], value])));

@@ -283,3 +281,3 @@ /***/ }),

if (!Array.isArray(table)) {
throw new Error('`.each` must be called with an Array or Tagged Template Literal.\n\n' + `Instead was called with: ${(0, _prettyFormat().format)(table, {
throw new TypeError('`.each` must be called with an Array or Tagged Template Literal.\n\n' + `Instead was called with: ${(0, _prettyFormat().format)(table, {
maxDepth: 1,

@@ -286,0 +284,0 @@ min: true

{
"name": "jest-each",
"version": "30.0.0-alpha.2",
"version": "30.0.0-alpha.3",
"description": "Parameterised tests for Jest",

@@ -30,7 +30,7 @@ "main": "./build/index.js",

"dependencies": {
"@jest/types": "30.0.0-alpha.2",
"@jest/types": "30.0.0-alpha.3",
"chalk": "^4.0.0",
"jest-get-type": "30.0.0-alpha.2",
"jest-util": "30.0.0-alpha.2",
"pretty-format": "30.0.0-alpha.2"
"jest-get-type": "30.0.0-alpha.3",
"jest-util": "30.0.0-alpha.3",
"pretty-format": "30.0.0-alpha.3"
},

@@ -43,3 +43,3 @@ "engines": {

},
"gitHead": "c04d13d7abd22e47b0997f6027886aed225c9ce4"
"gitHead": "e267aff33d105399f2134bad7c8f82285104f3da"
}
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