Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add getCacheFilePath to HasteMap #7217

Merged
merged 1 commit into from Oct 19, 2018

Conversation

rubennorte
Copy link
Contributor

Summary

This makes it easier for tools to interact with the file without making assumptions about how it's generated.

Test plan

It's just a getter for a class field, so just Flow type checking.

@rubennorte rubennorte force-pushed the expose-cache-path-in-haste-map branch from f888919 to 686f8aa Compare October 19, 2018 10:14
@rubennorte rubennorte merged commit 22f67d4 into jestjs:master Oct 19, 2018
@rubennorte rubennorte deleted the expose-cache-path-in-haste-map branch October 19, 2018 10:48
@cpojer
Copy link
Member

cpojer commented Dec 3, 2018

@rubennorte Can you give some more context about this change? The cache file path is intentionally hidden inside of jest-haste-map and should not be accessible from the outside. Exposing it like this will allow other tools to access the contents and messing with it, potentially saving corrupt state.

If this is for facebook/metro#267, I would recommend changing Metro not to print that message but rather allow Metro to clear the cache, and exposing a HasteMap.clearCache method.

@cpojer
Copy link
Member

cpojer commented Dec 3, 2018

In addition, could you remove this method from Jest again? I really don't think it belongs here.

@rubennorte
Copy link
Contributor Author

@cpojer it wasn't created for that Metro issue, but to be able to restore the cache generated by Jest in a different host with a different root directory (for remote caching).

@cpojer
Copy link
Member

cpojer commented Dec 6, 2018

Yeah, this is exactly the sort of thing we shouldn't really be doing, because it allows swapping out the file from under jest-haste-map. Can you change it so you can specify the haste-map to read from, like HasteMap.createMapFrom(file, config)?

@github-actions
Copy link

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 github-actions bot locked as resolved and limited conversation to collaborators May 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants