@jest/create-cache-key-function
Last updated 2 years ago by simenb .
MIT · Repository · Original npm · Tarball · package.json
$ npm install @jest/create-cache-key-function 
SYNC missed versions from official npm registry.

jest-create-cache-key-function

This module creates a function which is used for generating cache keys used by code transformers in Jest.

Install

$ npm install --save-dev @jest/create-cache-key-function

API

createCacheKey(files?: Array<string>, values?: Array<String>, length?: number): GetCacheKeyFunction

Returns a function that can be used to generate cache keys based on source code of provided files and provided values.

Parameters

  • files: [Optional] Array of absolute paths to files whose code should be accounted for when generating cache key
  • values: [Optional] Array of string values that should be accounted for when generating cache key
  • length: [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.

Usage

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),
};

Current Tags

  • 30.5.1                                ...           latest (3 months ago)
  • 30.0.0-rc.1                                ...           next (a year ago)

89 Versions

  • 30.5.1                                ...           3 months ago
  • 30.5.0                                ...           3 months ago
  • 30.4.1                                ...           7 months ago
  • 30.4.0                                ...           7 months ago
  • 30.3.0                                ...           9 months ago
  • 30.2.0                                ...           a year ago
  • 30.0.5                                ...           a year ago
  • 30.0.2                                ...           a year ago
  • 30.0.1                                ...           a year ago
  • 30.0.0                                ...           a year ago
  • 30.0.0-rc.1                                ...           a year ago
  • 30.0.0-beta.8                                ...           a year ago
  • 30.0.0-beta.7                                ...           a year ago
  • 30.0.0-beta.6                                ...           a year ago
  • 30.0.0-beta.3                                ...           2 years ago
  • 30.0.0-alpha.7                                ...           2 years ago
  • 30.0.0-alpha.6                                ...           2 years ago
  • 30.0.0-alpha.5                                ...           2 years ago
  • 30.0.0-alpha.4                                ...           3 years ago
  • 30.0.0-alpha.3                                ...           3 years ago
  • 30.0.0-alpha.2                                ...           3 years ago
  • 30.0.0-alpha.1                                ...           3 years ago
  • 29.7.0                                ...           3 years ago
  • 29.6.3                                ...           3 years ago
  • 29.6.2                                ...           3 years ago
  • 29.6.1                                ...           3 years ago
  • 29.6.0                                ...           3 years ago
  • 29.5.0                                ...           4 years ago
  • 29.4.3                                ...           4 years ago
  • 29.4.2                                ...           4 years ago
  • 29.4.1                                ...           4 years ago
  • 29.4.0                                ...           4 years ago
  • 29.3.1                                ...           4 years ago
  • 29.2.1                                ...           4 years ago
  • 29.2.0                                ...           4 years ago
  • 29.1.2                                ...           4 years ago
  • 29.1.0                                ...           4 years ago
  • 29.0.3                                ...           4 years ago
  • 29.0.2                                ...           4 years ago
  • 29.0.1                                ...           4 years ago
  • 29.0.0                                ...           4 years ago
  • 29.0.0-alpha.6                                ...           4 years ago
  • 29.0.0-alpha.4                                ...           4 years ago
  • 29.0.0-alpha.3                                ...           4 years ago
  • 29.0.0-alpha.0                                ...           4 years ago
  • 28.1.3                                ...           4 years ago
  • 28.1.1                                ...           4 years ago
  • 28.1.0                                ...           5 years ago
  • 28.0.2                                ...           5 years ago
  • 28.0.1                                ...           5 years ago
  • 28.0.0                                ...           5 years ago
  • 28.0.0-alpha.9                                ...           5 years ago
  • 28.0.0-alpha.8                                ...           5 years ago
  • 28.0.0-alpha.7                                ...           5 years ago
  • 28.0.0-alpha.6                                ...           5 years ago
  • 28.0.0-alpha.5                                ...           5 years ago
  • 28.0.0-alpha.4                                ...           5 years ago
  • 28.0.0-alpha.3                                ...           5 years ago
  • 28.0.0-alpha.2                                ...           5 years ago
  • 28.0.0-alpha.1                                ...           5 years ago
  • 28.0.0-alpha.0                                ...           5 years ago
  • 27.5.1                                ...           5 years ago
  • 27.5.0                                ...           5 years ago
  • 27.4.2                                ...           5 years ago
  • 27.4.1                                ...           5 years ago
  • 27.4.0                                ...           5 years ago
  • 27.3.1                                ...           5 years ago
  • 27.3.0                                ...           5 years ago
  • 27.2.5                                ...           5 years ago
  • 27.2.4                                ...           5 years ago
  • 27.2.3                                ...           5 years ago
  • 27.2.0                                ...           5 years ago
  • 27.1.1                                ...           5 years ago
  • 27.1.0                                ...           5 years ago
  • 27.0.6                                ...           5 years ago
  • 27.0.2                                ...           5 years ago
  • 27.0.1                                ...           6 years ago
  • 27.0.0-next.11                                ...           6 years ago
  • 27.0.0-next.10                                ...           6 years ago
  • 27.0.0-next.9                                ...           6 years ago
  • 27.0.0-next.8                                ...           6 years ago
  • 27.0.0-next.7                                ...           6 years ago
  • 27.0.0-next.6                                ...           6 years ago
  • 27.0.0-next.4                                ...           6 years ago
  • 27.0.0-next.3                                ...           6 years ago
  • 27.0.0-next.1                                ...           6 years ago
  • 27.0.0-next.0                                ...           6 years ago
  • 26.6.2                                ...           6 years ago
  • 26.5.0                                ...           6 years ago
Downloads
Total 151
Today 32
This Week 45
This Month 113
Last Day 12
Last Week 51
Last Month 38
Dependencies (1)
Dev Dependencies (2)
Dependents (3)

© 2010 - cnpmjs.org x YWFE | Home | YWFE