Skip to content

Commit

Permalink
fix: optimize getGlobalCacheKey (#14455)
Browse files Browse the repository at this point in the history
  • Loading branch information
Connormiha authored Aug 29, 2023
1 parent 7ed8025 commit f2c78d0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

### Fixes

### Performance

- `[@jest/create-cache-key-function]` Cache access of `NODE_ENV` and `BABEL_ENV` ([#14455](https://github.com/jestjs/jest/pull/14455))

### Chore & Maintenance

## 29.6.4
Expand Down
6 changes: 4 additions & 2 deletions packages/jest-create-cache-key-function/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,16 @@ type NewGetCacheKeyFunction = (

type GetCacheKeyFunction = OldGetCacheKeyFunction | NewGetCacheKeyFunction;

const {NODE_ENV, BABEL_ENV} = process.env;

function getGlobalCacheKey(
files: Array<string>,
values: Array<string>,
length: number,
) {
return [
process.env.NODE_ENV,
process.env.BABEL_ENV,
NODE_ENV,
BABEL_ENV,
...values,
...files.map((file: string) => readFileSync(file)),
]
Expand Down

0 comments on commit f2c78d0

Please sign in to comment.