Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/typeprof/cli/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def find_files
files = []
@cli_options[:argv].each do |path|
if File.directory?(path)
files.concat(Dir.glob("#{ path }/**/*.{rb,rbs}"))
files.concat(Dir.glob("#{ path }/**/*.{rb,rbs}").select {|f| File.file?(f) })
elsif File.file?(path)
files << path
else
Expand Down
15 changes: 15 additions & 0 deletions test/cli_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,21 @@ def foo: (String) -> String
END
end

def test_e2e_dir_with_rb_suffix
# A directory whose name ends with `.rb` (e.g. the `http_parser.rb`
# gem name appearing in rubygems' VCR cassettes) must be skipped,
# not opened as a Ruby file.
# https://github.com/rubygems/rubygems/tree/v4.0.11/bundler/spec/support/artifice/vcr_cassettes/realworld/index.rubygems.org/info/http_parser.rb
assert_equal(<<~END, test_run("dir_with_rb_suffix", ["."]))
# TypeProf #{ TypeProf::VERSION }

# ./main.rb
class Object
def foo: (String) -> String
end
END
end

def test_e2e_show_stats
result = test_run("show_stats", ["--no-show-typeprof-version", "--show-stats", "."])
stats = result[/# TypeProf Evaluation Statistics.*/m]
Expand Down
5 changes: 5 additions & 0 deletions test/fixtures/dir_with_rb_suffix/main.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
def foo(n)
n
end

foo("str")
Empty file.
Loading