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 29.4.2 to 29.4.3

2

build/bind.js

@@ -21,3 +21,3 @@ 'use strict';

/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
* Copyright (c) Meta Platforms, Inc. and affiliates.
*

@@ -24,0 +24,0 @@ * This source code is licensed under the MIT license found in the

/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
* Copyright (c) Meta Platforms, Inc. and affiliates.
*

@@ -4,0 +4,0 @@ * This source code is licensed under the MIT license found in the

@@ -18,3 +18,3 @@ 'use strict';

/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
* Copyright (c) Meta Platforms, Inc. and affiliates.
*

@@ -21,0 +21,0 @@ * This source code is licensed under the MIT license found in the

@@ -63,3 +63,3 @@ 'use strict';

/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
* Copyright (c) Meta Platforms, Inc. and affiliates.
*

@@ -66,0 +66,0 @@ * This source code is licensed under the MIT license found in the

@@ -23,3 +23,3 @@ 'use strict';

/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
* Copyright (c) Meta Platforms, Inc. and affiliates.
*

@@ -32,26 +32,20 @@ * This source code is licensed under the MIT license found in the

const interpolateVariables = (title, template, index) =>
Object.keys(template)
.reduce(getMatchingKeyPaths(title), []) // aka flatMap
.reduce(replaceKeyPathWithValue(template), title)
title
.replace(
new RegExp(`\\$(${Object.keys(template).join('|')})[.\\w]*`, 'g'),
match => {
const keyPath = match.slice(1).split('.');
const value = getPath(template, keyPath);
return (0, _jestGetType().isPrimitive)(value)
? String(value)
: (0, _prettyFormat().format)(value, {
maxDepth: 1,
min: true
});
}
)
.replace('$#', `${index}`);
exports.interpolateVariables = interpolateVariables;
const getMatchingKeyPaths = title => (matches, key) =>
matches.concat(title.match(new RegExp(`\\$${key}[\\.\\w]*`, 'g')) || []);
const replaceKeyPathWithValue = template => (title, match) => {
const keyPath = match.replace('$', '').split('.');
const value = getPath(template, keyPath);
if ((0, _jestGetType().isPrimitive)(value)) {
return title.replace(match, String(value));
}
return title.replace(
match,
(0, _prettyFormat().format)(value, {
maxDepth: 1,
min: true
})
);
};
/* eslint import/export: 0*/
exports.interpolateVariables = interpolateVariables;
function getPath(template, [head, ...tail]) {

@@ -58,0 +52,0 @@ if (!head || !Object.prototype.hasOwnProperty.call(template, head))

@@ -9,3 +9,3 @@ 'use strict';

/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
* Copyright (c) Meta Platforms, Inc. and affiliates.
*

@@ -12,0 +12,0 @@ * This source code is licensed under the MIT license found in the

@@ -28,3 +28,3 @@ 'use strict';

/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
* Copyright (c) Meta Platforms, Inc. and affiliates.
*

@@ -31,0 +31,0 @@ * This source code is licensed under the MIT license found in the

{
"name": "jest-each",
"version": "29.4.2",
"version": "29.4.3",
"description": "Parameterised tests for Jest",

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

"dependencies": {
"@jest/types": "^29.4.2",
"@jest/types": "^29.4.3",
"chalk": "^4.0.0",
"jest-get-type": "^29.4.2",
"jest-util": "^29.4.2",
"pretty-format": "^29.4.2"
"jest-get-type": "^29.4.3",
"jest-util": "^29.4.3",
"pretty-format": "^29.4.3"
},

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

},
"gitHead": "f0fc92e8443f09546c7ec0472bf9bce44fe5898f"
"gitHead": "a49c88610e49a3242576160740a32a2fe11161e1"
}

Sorry, the diff of this file is not supported yet

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