Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
@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.
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>): GetCacheKeyFunction
Get a function that can generate cache keys using source code, 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 keyNote:
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),
};
29.1.0
[expect, @jest/expect]
Support type inference for function parameters in CalledWith
assertions (#13268)[expect, @jest/expect]
Infer type of *ReturnedWith
matchers argument (#13278)[@jest/environment, jest-runtime]
Allow jest.requireActual
and jest.requireMock
to take a type argument (#13253)[@jest/environment]
Allow jest.mock
and jest.doMock
to take a type argument (#13254)[@jest/fake-timers]
Add jest.now()
to return the current fake clock time (#13244, #13246)[@jest/mock]
Add withImplementation
method for temporarily overriding a mock (#13281)[expect]
Export toThrow*
matchers (#13328)[jest-circus, jest-jasmine2]
Fix error messages for Node's assert.throes
(#13322)[jest-haste-map]
Remove __proto__
usage (#13256)[jest-mock]
Improve spyOn
typings to handle optional properties (#13247)[jest-mock]
Fix mocking of getters and setters on classes (#13145)[jest-snapshot]
Throw useful error when an array is passed as property matchers (#13263)[jest-snapshot]
Prioritize parser used in the project (#13323)[jest-transform]
Attempt to work around issues with atomic writes on Windows (#11423)FAQs
This module creates a function which is used for generating cache keys used by code transformers in Jest.
The npm package @jest/create-cache-key-function receives a total of 2,673,065 weekly downloads. As such, @jest/create-cache-key-function popularity was classified as popular.
We found that @jest/create-cache-key-function demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 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
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.