jest
jest copied to clipboard
fix: lower length of key to improve usage in win32
- limit key to to 16 characters
- provide it as a parameter with the default so it can allow changes from the user
- document method
Summary
32 character is still too long for my user name.
Test plan
Could we default to a smaller key on windows and keep it at 32 for other platforms?
How do you determine you're in Windows? Also isn't 32 quite large for a cache key, the probability of collisions shouldn't be that high.
I presume I'd put the check on the exported function and change the signature so it allows undefined
and use either 32 or 16 once it is there.
How do you determine you're in Windows?
Like this: https://github.com/facebook/jest/blob/bc84c8a15649aaaefdd624dc83824518c17467ed/packages/jest-util/src/createProcessObject.ts#L11
Also documentation needs an update:
https://github.com/facebook/jest/blob/bc84c8a15649aaaefdd624dc83824518c17467ed/packages/jest-create-cache-key-function/README.md?plain=1#L13-L21
Could you add a test as well?
The rest looks good to me.
Could you add a test as well?
The rest looks good to me.
Can you point out one I can use as a starting point?
Would be fine to add one more test case here: https://github.com/facebook/jest/blob/main/packages/jest-create-cache-key-function/src/tests/index.test.ts
CI is failing here - would you be able to take a look @trajano?
Something changed on jasmine that prevents this from working now platform cannot be overiden anymore.
I can't create the test as I cannot mock process.platform
anymore.
Thanks at least now I know how to change platform on tests
https://github.com/facebook/jest/releases/tag/v29.5.0
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.