-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Filter non-JS files from require
when using glob with --projects
#5412
Conversation
This ensures `packages/*` catches folders & not README.md
require
when using glon with --patterns
require
when using glon with --patternsrequire
when using glob with --projects
It was difficult to pin down which part of the code was ultimately responsible, as the glob So, because the list of projects are directly |
Codecov Report
@@ Coverage Diff @@
## master #5412 +/- ##
=======================================
Coverage 62.26% 62.26%
=======================================
Files 205 205
Lines 6925 6925
Branches 4 4
=======================================
Hits 4312 4312
Misses 2612 2612
Partials 1 1 Continue to review full report at Codecov.
|
// Ignore globbed files that cannot be `require`d. | ||
if ( | ||
fs.existsSync(root) && | ||
!fs.lstatSync(root).isDirectory() && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we just do a single lstatSync
and try-catch
it to avoid 2 separate IO operations?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's also a possibility. My take is:
-
--projects
is often single to double-digits of entries, whereas the difference between 1 lookup vs. 2 wasn't discernible in my testing. (I originally didn't have the directory check there) -
If there are any edge-cases that aren't accounted for, we'll have the opportunity to see & correct the error in the future, vs. it being silently ignored (& not running any tests for that directory).
…estjs#5412) * Add test for workspaces with a README.md in the root * Filter projects to directories & require-able files only This ensures `packages/*` catches folders & not README.md * Add reference to jestjs#5199 in CHANGELOG.md * Remove custom testDir
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. |
Summary
Fixes #5199, where a monorepo with
packages/README.md
was beingrequire
d as a config file due to the glob from--projects packages/*
.This change filters out non-
require
-able files.Test plan