File tree Expand file tree Collapse file tree
packages/jest-create-cache-key-function/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,15 +12,16 @@ import {readFileSync} from 'fs';
1212import { relative } from 'path' ;
1313import type { Config } from '@jest/types' ;
1414
15+ // Should mirror `import('@jest/transform').TransformOptions`
1516type CacheKeyOptions = {
1617 config : Config . ProjectConfig ;
18+ configString : string ;
1719 instrument : boolean ;
1820} ;
1921
2022type 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
4142function 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' ) ;
You can’t perform that action at this time.
0 commit comments