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

Updates to UnableToResolveError to account for different platforms. #267

Closed
wants to merge 1 commit into from

Conversation

gdborton
Copy link
Contributor

@gdborton gdborton commented Sep 26, 2018

Summary
This error message is confusing when you get it on a mac, as /tmp/ isn't the
tmp directory that is being used. The message should probably try to account
for settings that are configured by users as well, the Metro Bundler cache at
least is something that can be overwritten.

Test plan

Edited my node_modules/ folder for the metro-sample-app.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 26, 2018
@codecov-io
Copy link

codecov-io commented Sep 26, 2018

Codecov Report

Merging #267 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #267      +/-   ##
==========================================
+ Coverage   85.68%   85.69%   +<.01%     
==========================================
  Files         144      144              
  Lines        4556     4559       +3     
  Branches      712      712              
==========================================
+ Hits         3904     3907       +3     
  Misses        582      582              
  Partials       70       70
Impacted Files Coverage Δ
...src/node-haste/DependencyGraph/ModuleResolution.js 92.18% <100%> (+0.38%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 73dd5e8...8a2eb05. Read the comment docs.

This error message is confusing when you get it on a mac, as /tmp/ isn't the
tmp directory that is being used.  The message should probably try to account
for settings that are configured by users as well, the Metro Bundler cache at
least is something that can be overwritten.
);
const hasteCacheLocation = path.join(
os.tmpdir(),
'haste-map-metro-4-*',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changed from haste-map-react-native-packager-*, but ideally should come from the location where it's configured:

name: 'metro-' + JEST_HASTE_MAP_CACHE_BREAKER,

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could get the actual cache path from jest-haste-map if it was exposed as a getter (from here).

For now, this is perfectly fine, but I would change the second part of hasteCacheLocation to haste-map-metro-* so we don't have to update the error message if we bump the JEST_HASTE_MAP_CACHE_BREAKER variable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call on removing the version, I'll update.

We don't have access to the HasteMap instance right? So we'd need to add it to module_map.js?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we could though change a bit the code here to have the HasteMap instance here once the getter for the cache folder gets eventually added to jest-haste-map.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jest v24 is going to have a getter for the cache path 😃

The first alpha for v24 has just been published and we're going to update Metro to this alpha version soon

Copy link
Contributor

@rafeca rafeca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! What do you think about the small tweak in the path?

);
const hasteCacheLocation = path.join(
os.tmpdir(),
'haste-map-metro-4-*',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could get the actual cache path from jest-haste-map if it was exposed as a getter (from here).

For now, this is perfectly fine, but I would change the second part of hasteCacheLocation to haste-map-metro-* so we don't have to update the error message if we bump the JEST_HASTE_MAP_CACHE_BREAKER variable.

@cpojer
Copy link
Contributor

cpojer commented Feb 25, 2019

The function that @rafeca talked about is now part of jest-haste-map. Would you mind updating your PR to improve the error message with the right location to the cache folder?

Also, it seems like it makes sense to do the same for the Metro cache folder. Could we make it so we display the cache folder based on what Metro really uses instead of hardcoding it?

@cpojer
Copy link
Contributor

cpojer commented Sep 11, 2019

Closing because of inactivity.

@cpojer cpojer closed this Sep 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants