Skip to content

Commit babb77b

Browse files
committed
chore: update jest-create-cache-key-function
1 parent cc52a5b commit babb77b

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

  • packages/jest-create-cache-key-function/src

packages/jest-create-cache-key-function/src/index.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,16 @@ import {readFileSync} from 'fs';
1212
import {relative} from 'path';
1313
import type {Config} from '@jest/types';
1414

15+
// Should mirror `import('@jest/transform').TransformOptions`
1516
type CacheKeyOptions = {
1617
config: Config.ProjectConfig;
18+
configString: string;
1719
instrument: boolean;
1820
};
1921

2022
type GetCacheKeyFunction = (
21-
fileData: string,
22-
filePath: Config.Path,
23-
configStr: string,
23+
sourceText: string,
24+
sourcePath: Config.Path,
2425
options: CacheKeyOptions,
2526
) => string;
2627

@@ -39,14 +40,14 @@ function getGlobalCacheKey(files: Array<string>, values: Array<string>) {
3940
}
4041

4142
function getCacheKeyFunction(globalCacheKey: string): GetCacheKeyFunction {
42-
return (src, file, _configString, options) => {
43+
return (sourceText, sourcePath, options) => {
4344
const {config, instrument} = options;
4445
return createHash('md5')
4546
.update(globalCacheKey)
4647
.update('\0', 'utf8')
47-
.update(src)
48+
.update(sourceText)
4849
.update('\0', 'utf8')
49-
.update(config.rootDir ? relative(config.rootDir, file) : '')
50+
.update(config.rootDir ? relative(config.rootDir, sourcePath) : '')
5051
.update('\0', 'utf8')
5152
.update(instrument ? 'instrument' : '')
5253
.digest('hex');

0 commit comments

Comments
 (0)