Skip to content

feat(config): allow passing option to force node crawl#11264

Merged
SimenB merged 4 commits intojestjs:masterfrom
SimenB:force-node-crawl-options
Apr 2, 2021
Merged

feat(config): allow passing option to force node crawl#11264
SimenB merged 4 commits intojestjs:masterfrom
SimenB:force-node-crawl-options

Conversation

@SimenB
Copy link
Copy Markdown
Member

@SimenB SimenB commented Apr 2, 2021

Summary

Due to #9351 (comment), I want to allow people to configure it.

We should consider defaulting to the Node crawl, but that's separate. With this, at least people can choose

Test plan

Verified via debug statements the option makes it all the way through from jest config to haste-map

@SimenB SimenB merged commit 6d87f9e into jestjs:master Apr 2, 2021
@SimenB SimenB deleted the force-node-crawl-options branch April 2, 2021 13:42
@jtbandes
Copy link
Copy Markdown

Thanks for making this change! Just want to add a note that I was benchmarking jest locally (M1 MacBook Air with macOS 11.2.3), and noticed that find is much slower than the fs implementation because it does not exclude any files. The ignore patterns are only applied after find returns results:

https://github.com/facebook/jest/blob/c8b1835b53945412f52b37d9219a8f52d9449ff1/packages/jest-haste-map/src/crawlers/node.ts#L177-L181

In our relatively small monorepo, this results in a find execution that takes several seconds and produces a huge output (43512 lines / 6MB of text).

@SimenB
Copy link
Copy Markdown
Member Author

SimenB commented Apr 23, 2021

Ah, that's a very good point. Exclusions in find look absolutely horrible, tho 🙈

https://stackoverflow.com/a/4210072/1850276

@jtbandes
Copy link
Copy Markdown

Yep. I also understand that it may be difficult to translate to a find command because ignore() is currently a function rather than a list of glob patterns. So I wonder if using the native find is even worth it at all — but anyway I appreciate the option to disable it, otherwise it lists out every .js file inside node_modules.

@github-actions
Copy link
Copy Markdown

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 24, 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.

3 participants