
Security News
New React Server Components Vulnerabilities: DoS and Source Code Exposure
New DoS and source code exposure bugs in React Server Components and Next.js: what’s affected and how to update safely.
@jest/create-cache-key-function
Advanced tools
This module creates a function which is used for generating cache keys used by code transformers in Jest.
$ npm install --save-dev @jest/create-cache-key-function
createCacheKey(files?: Array<string>, values?: Array<String>, length?: number): GetCacheKeyFunctionReturns a function that can be used to generate cache keys based on source code of provided files and provided values.
files: [Optional] Array of absolute paths to files whose code should be accounted for when generating cache keyvalues: [Optional] Array of string values that should be accounted for when generating cache keylength: [Optional] Length of the resulting key. The default is 32, or 16 on Windows.Note:
The source code for your test is already taken into account when generating the cache key. The files array should be used to provide files that are not directly related to your code such as external configuration files.
Here is some sample usage code while creating a new transformer for Jest
const createCacheKeyFunction =
require('@jest/create-cache-key-function').default;
const filesToAccountFor = [
__filename,
require.resolve('some-package-name/package.json'),
];
const valuesToAccountFor = [process.env.SOME_LOCAL_ENV, 'Some_Other_Value'];
module.exports = {
process(src, filename, config, options) {},
getCacheKey: createCacheKeyFunction(filesToAccountFor, valuesToAccountFor),
};
FAQs
Unknown package
We found that @jest/create-cache-key-function demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 open source maintainers 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.

Security News
New DoS and source code exposure bugs in React Server Components and Next.js: what’s affected and how to update safely.

Security News
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.

Security News
GitHub has revoked npm classic tokens for publishing; maintainers must migrate, but OpenJS warns OIDC trusted publishing still has risky gaps for critical projects.