Research
Security News
Kill Switch Hidden in npm Packages Typosquatting Chalk and Chokidar
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
jest-each-table
Advanced tools
Create a test-case table for use with Jest's test.each tagged template literal
Take advantage of jest's test.each
tagged template literal functionality
without needing to hardcode the test-cases as template literals.
import createTestTable from 'jest-each-table';
const testcases = createTestTable(
[...Array(10)].map((_, i) => ({
inputs: { left: i, right: i },
output: i + i
}))
);
const testsuite = test.each(...testcases);
testsuite('$inputs.left + $inputs.right = $output', ({ inputs, output }) => {
expect(inputs.left + inputs.right).toBe(output);
});
Jest's test.each
functionality can be used in two ways:
test.each
(function):
This allows an Array
of Arrays
with the arguments that are passed into
the test fn for each row.test.each
(tagged template literal):
This allows a table of test-cases to be defined as an ES2015 string template.Unfortunately test.each
(the function) uses printf
formatting for creating
the test title which has serious drawbacks compared to how the title is
formatted using test.each
(the tagged template literal) which supports
$variable
.
FAQs
Create a test-case table for use with Jest's test.each tagged template literal
The npm package jest-each-table receives a total of 3,539 weekly downloads. As such, jest-each-table popularity was classified as popular.
We found that jest-each-table demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.