jest icon indicating copy to clipboard operation
jest copied to clipboard

fix: lower length of key to improve usage in win32

Open trajano opened this issue 1 year ago • 2 comments

  • 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

trajano avatar Jan 26 '23 16:01 trajano

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.

trajano avatar Jan 27 '23 17:01 trajano

How do you determine you're in Windows?

Like this: https://github.com/facebook/jest/blob/bc84c8a15649aaaefdd624dc83824518c17467ed/packages/jest-util/src/createProcessObject.ts#L11

mrazauskas avatar Jan 27 '23 17:01 mrazauskas

Also documentation needs an update:

https://github.com/facebook/jest/blob/bc84c8a15649aaaefdd624dc83824518c17467ed/packages/jest-create-cache-key-function/README.md?plain=1#L13-L21

mrazauskas avatar Jan 28 '23 07:01 mrazauskas

Could you add a test as well?

The rest looks good to me.

mrazauskas avatar Jan 31 '23 09:01 mrazauskas

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?

trajano avatar Feb 01 '23 15:02 trajano

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

mrazauskas avatar Feb 01 '23 15:02 mrazauskas

CI is failing here - would you be able to take a look @trajano?

SimenB avatar Feb 15 '23 10:02 SimenB

Something changed on jasmine that prevents this from working now platform cannot be overiden anymore.

trajano avatar Feb 15 '23 16:02 trajano

I can't create the test as I cannot mock process.platform anymore.

trajano avatar Feb 17 '23 01:02 trajano

Thanks at least now I know how to change platform on tests

trajano avatar Feb 23 '23 08:02 trajano

https://github.com/facebook/jest/releases/tag/v29.5.0

SimenB avatar Mar 06 '23 13:03 SimenB

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.

github-actions[bot] avatar Apr 06 '23 00:04 github-actions[bot]