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

Added method to get an iterator for all files in HasteFS #7010

Merged

Conversation

rubennorte
Copy link
Contributor

@rubennorte rubennorte commented Sep 20, 2018

Summary

This method is faster if the consumer only want to traverse the files (no need to create a new array). It is especially relevant if the number of files in the map is large.

Test plan

Only flow typechecking. This file isn't unit tested, but the code is so simple it doesn't really need it. Manually tested in the terminal.

Edit: tested through jest-resolve-dependencies, where it's used now

@@ -44,6 +44,10 @@ export default class HasteFS {
return Array.from(this._files.keys());
}

getFileIterator(): Iterator<string> {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rafeca you'll be able to use this in Metro. It should be way faster if you just want to iterate over the files.

@SimenB
Copy link
Member

SimenB commented Sep 20, 2018

Changelog? 😀

@codecov-io
Copy link

codecov-io commented Sep 20, 2018

Codecov Report

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

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #7010      +/-   ##
==========================================
+ Coverage   66.94%   66.95%   +<.01%     
==========================================
  Files         250      250              
  Lines       10401    10404       +3     
  Branches        4        3       -1     
==========================================
+ Hits         6963     6966       +3     
  Misses       3437     3437              
  Partials        1        1
Impacted Files Coverage Δ
packages/jest-haste-map/src/haste_fs.js 58.62% <ø> (+1.47%) ⬆️
packages/jest-resolve-dependencies/src/index.js 97.72% <100%> (+0.1%) ⬆️

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 ab06a7b...5f85745. Read the comment docs.

@rubennorte rubennorte merged commit ee751bf into jestjs:master Sep 20, 2018
@rubennorte rubennorte deleted the add-method-to-iterate-files-in-haste-fs branch October 16, 2018 17:33
@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.

4 participants