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

Avoid reading files from Haste map if not needed #6667

Merged
merged 2 commits into from
Jul 10, 2018
Merged

Avoid reading files from Haste map if not needed #6667

merged 2 commits into from
Jul 10, 2018

Conversation

mjesun
Copy link
Contributor

@mjesun mjesun commented Jul 10, 2018

Metro also uses jest-haste-map, but there is no need to extract dependencies from it, since Metro has its own algorithms. This PR implements a boolean flag that avoids reading from the filesystem when we do not want to extract dependencies. The default is kept to true so it's backwards compatible.

I also added specific tests for non-UTF-8 files, and for non-computed dependencies too. The argument is made mandatory at the worker level.

@SimenB
Copy link
Member

SimenB commented Jul 10, 2018

Changelog 😀

@codecov-io
Copy link

Codecov Report

Merging #6667 into master will increase coverage by 0.03%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #6667      +/-   ##
==========================================
+ Coverage   63.73%   63.77%   +0.03%     
==========================================
  Files         235      235              
  Lines        8940     8943       +3     
  Branches        3        3              
==========================================
+ Hits         5698     5703       +5     
+ Misses       3241     3239       -2     
  Partials        1        1
Impacted Files Coverage Δ
packages/jest-haste-map/src/worker.js 76.92% <100%> (+3.58%) ⬆️
packages/jest-haste-map/src/index.js 96.34% <100%> (ø) ⬆️

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 81d6888...270feb8. Read the comment docs.

@mjesun mjesun merged commit 6e1ec16 into jestjs:master Jul 10, 2018
@mjesun mjesun deleted the haste-map-avoid-reading-files branch July 10, 2018 15:48
calebeby referenced this pull request in Pigmice2733/scouting-frontend Jul 11, 2018
This Pull Request updates dependency [jest](https://github.com/facebook/jest) from `v23.3.0` to `v23.4.0`



<details>
<summary>Release Notes</summary>

### [`v23.4.0`](https://github.com/facebook/jest/blob/master/CHANGELOG.md#&#8203;2340)
[Compare Source](jestjs/jest@v23.3.0...v23.4.0)
##### Features

- `[jest-haste-map]` Add `computeDependencies` flag to avoid opening files if not needed ([#&#8203;6667](`https://github.com/facebook/jest/pull/6667`))
- `[jest-runtime]` Support `require.resolve.paths` ([#&#8203;6471](`https://github.com/facebook/jest/pull/6471`))
- `[jest-runtime]` Support `paths` option for `require.resolve` ([#&#8203;6471](`https://github.com/facebook/jest/pull/6471`))
##### Fixes

- `[jest-runner]` Force parallel runs for watch mode, to avoid TTY freeze ([#&#8203;6647](`https://github.com/facebook/jest/pull/6647`))
- `[jest-cli]` properly reprint resolver errors in watch mode ([#&#8203;6407](`https://github.com/facebook/jest/pull/6407`))
- `[jest-cli]` Write configuration to stdout when the option was explicitly passed to Jest ([#&#8203;6447](`https://github.com/facebook/jest/pull/6447`))
- `[jest-cli]` Fix regression on non-matching suites ([6657](`https://github.com/facebook/jest/pull/6657`))
- `[jest-runtime]` Roll back `micromatch` version to prevent regression when matching files ([#&#8203;6661](`https://github.com/facebook/jest/pull/6661`))

---

</details>




---

This PR has been generated by [Renovate Bot](https://renovatebot.com).
@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.

5 participants