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

fix(jest-haste-map): don't throw on missing mapper in Node crawler #8558

Merged
merged 3 commits into from
Jun 13, 2019

Conversation

thymikee
Copy link
Collaborator

@thymikee thymikee commented Jun 12, 2019

Summary

The mapper option passed to HasteMap is not supported in Node crawler, so we shouldn't pass it there. It's likely a cause of a regression in React Native 0.60 RC: facebook/react-native#25241 (comment).

The regression was a part of this refactoring: https://github.com/facebook/jest/pull/8056/files#diff-5c5055968e3661a18f280d5e3f10c969L738

Test plan

Added extra assertion to validate that mapper is not passed to Node crawler.

cc @scotthovestadt @arcanis

@codecov-io
Copy link

codecov-io commented Jun 12, 2019

Codecov Report

Merging #8558 into master will increase coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #8558      +/-   ##
==========================================
+ Coverage   60.57%   60.58%   +0.01%     
==========================================
  Files         269      269              
  Lines       11054    11052       -2     
  Branches     2696     2694       -2     
==========================================
  Hits         6696     6696              
+ Misses       3772     3771       -1     
+ Partials      586      585       -1
Impacted Files Coverage Δ
packages/jest-haste-map/src/crawlers/node.ts 82.89% <ø> (+2.12%) ⬆️

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 3748557...486891c. Read the comment docs.

@thymikee thymikee changed the title fix(jest-haste-map): don't pass mapper to Node crawler fix(jest-haste-map): Don't throw on missing mapper in Node crawler Jun 13, 2019
@thymikee thymikee changed the title fix(jest-haste-map): Don't throw on missing mapper in Node crawler fix(jest-haste-map): don't throw on missing mapper in Node crawler Jun 13, 2019
@@ -139,10 +139,6 @@ export = function nodeCrawl(
removedFiles: FileData;
hasteMap: InternalHasteMap;
}> {
if (options.mapper) {
Copy link
Member

Choose a reason for hiding this comment

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

I think this makes sense, not sure why it'd need to throw. Maybe someone has a good reason, though 😀

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yea. There are other options we ignore in Node crawler (like computeSha1). Maybe it was some kind of development helper that wasn't removed? Anyway, it's gone now :P

@thymikee thymikee requested a review from cpojer June 13, 2019 08:17
Copy link
Member

@cpojer cpojer left a comment

Choose a reason for hiding this comment

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

Thanks.

@mikehardy
Copy link

what's the interplay between this and the referenced metro bug 418 linked above? It just bit me and I'm trying to figure out if this is an unreleased change that needs to be incorporated in a release of jest here, then referenced in metro, or if it's already released here and metro just needs to update? @thymikee you merged this, is it released? @motiz88 this seems needed in metro but I'm not even sure how to propose it...

@thymikee
Copy link
Collaborator Author

Update jest-haste-map in your lock file

@mikehardy
Copy link

I don't like messing around in lock files :-), but I'm okay with patch-package
jest-haste-map+24.8.0.patch.txt

It will tell me when it's released, and I can build for now (if anyone else needs this, just install patch-package, make a patches folder and drop this in there without the .txt extension (that was needed so github would accept the attachment) and add patch-package as a postinstall hook

The question of how to get it integrated is open though ? with a patch I can move alone for now though

@thymikee
Copy link
Collaborator Author

Just remove it from lock file and yarn install again :p

@mikehardy
Copy link

mikehardy commented Jul 11, 2019

Ah! I see what you mean. Would it be the same to say that you could just delete the whole lock file and it works, or do you have to install, then delete just jest haste map from the lock file, and install again?

@SimenB
Copy link
Member

SimenB commented Jul 11, 2019

Deleting just the jest-haste-map entry should be enough, yarn/npm will see it's missing and download the latest version (which contains this fix). You can of course throw away the entire lockfile if you want, but it's not necessary

@SimenB
Copy link
Member

SimenB commented Jul 11, 2019

Metro should probably update, though?

@SimenB
Copy link
Member

SimenB commented Jul 16, 2019

Opened up facebook/metro#432

@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 11, 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.

6 participants