Skip non-existing paths in $MODULEPATH silently #419
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
If one or more components in
$MODULEPATH
do not exist as directories, loading tests will fail with an exception.Additional Context
In
map
, anext
will leave anil
value in the array. This is a problem sinceFileTest.directory? nil
raises "TypeError: no implicit conversion of nil into String"I have not seen any difference in behaviour for
FileTest.directory?
ornext
in.map
from Ruby 2.3 to 3.2.Related Issues (if any)
Bug was introduced in v4.0.1, in commit b6bfd6f
For whatever reason, I have stuck to 2.15 for all this time, and that version handles missing directories without complaints. In my case I include "modules" as one of the elements in the path, but not all test environments has/need that directory. It does not seem useful that users have to filter MODULEPATH on their own before launching rspec.
Checklist