-
-
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
Native file crawling doesn't work with POSIX find #10263
Comments
I've added a dockerfile to https://github.com/richardlau/jesttest where I've substituted a "bad"
|
Thanks for the detailed issue @richardlau! Your third option sounds like the best one to me as long as it doesn't cause regressions for Windows users. I'm not sure why we never attempt Would you be up for a PR? If not, I can get to it in a couple of weeks (currently on holiday) |
Yes, I'll open a PR. |
Awesome! We have |
Opened #10308. |
Released in 26.2.0, thanks for the help! |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
🐛 Bug Report
I've been investigating module failures with CITGM that we're seeing on AIX in the Node.js CI that are using Jest to test and are all reporting "No tests found". As an example, Jest itself (using @SimenB 's nodejs/citgm#728): https://ci.nodejs.org/job/citgm-smoker-nobuild/876/nodes=aix71-ppc64/console
I tracked the problem down to the file crawler in
jest-haste-map
passing a non-POSIX option-iname
tofind
:https://github.com/facebook/jest/blob/d79de34e964dc405b379d2f59583748f8dcc99e3/packages/jest-haste-map/src/crawlers/node.ts#L132
This works with, e.g. the GNU version of
find
but on systems where the defaultfind
only supports the POSIX options (e.g. AIX) the subsequentspawn
:https://github.com/facebook/jest/blob/d79de34e964dc405b379d2f59583748f8dcc99e3/packages/jest-haste-map/src/crawlers/node.ts#L139
exits with a non-zero exit code (which isn't checked) and results in no files being found.
POSIX find: https://pubs.opengroup.org/onlinepubs/009695399/utilities/find.html
AIX find: https://www.ibm.com/support/knowledgecenter/ssw_aix_72/f_commands/find.html
Linux find: https://man7.org/linux/man-pages/man1/find.1.html
(note https://man7.org/linux/man-pages/man1/find.1.html#STANDARDS_CONFORMANCE on which options are POSIX compliant. https://man7.org/linux/man-pages/man1/find.1.html#HISTORY suggests
-iname
was added in findutils 3.8 but I'm guessing it's very unlikely to find a version of findutils older than that out in the wild?)FWIW this is what happens when you try to run
find . -iname ''
on AIX:I can see there's a
forceNodeFilesystemAPI
internal option that if I force totrue
fixes the behavior (as it bypasses the native find):https://github.com/facebook/jest/blob/d79de34e964dc405b379d2f59583748f8dcc99e3/packages/jest-haste-map/src/crawlers/node.ts#L25-L30
There doesn't seem to be a way to set that option externally (which could be a workaround)? #9329 is semi-related but in this case
find
exists but the options that are being passed to it are incompatible.Possible solutions I can see:
forceNodeFilesystemAPI
externally -- Jest crashes on systems without find #9329 (comment) appears to discourage this.child.spawn
and fall back to the non-native crawl if it is non-zero.hasNativeFindSupport
-- maybe try runningfind . -iname ''
and check for a non-zero exit code? That could potentially also replace theprocess.platform === 'win32'
check in case someone on Windows has the GNU version offind
(e.g. fromgit
) on their PATH ahead of the default Windowsfind
.To Reproduce
Steps to reproduce the behavior:
Run
jest
on any module on AIX (or system with a pure POSIX version offind
. I recreated it with a minimal module following the Getting Started - Jest guide.The following is the output from running
jest
:See the repo in the "Link to repl or repo" section below for an reproduction using docker where find is wrapped to reject the
-iname
option.Expected behavior
Tests are found and run.
Link to repl or repo (highly encouraged)
https://github.com/richardlau/jesttest
envinfo
(I've been testing with the current
master
branch from https://github.com/nodejs/node. The CITGM run from https://ci.nodejs.org/job/citgm-smoker-nobuild/876/nodes=aix71-ppc64/console was using Node.js v14.5.0.)The text was updated successfully, but these errors were encountered: