Skip to content

Commit

Permalink
feat: support multiple -r paths
Browse files Browse the repository at this point in the history
  • Loading branch information
palkan committed Jan 2, 2025
1 parent 41f74f0 commit cbf7725
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
8 changes: 3 additions & 5 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@ eval_gemfile "gemfiles/rubocop.gemfile"
# Specify your gem's dependencies in anyt.gemspec
gemspec name: "anyt"

if File.directory?(File.join(__dir__, "../anycable"))
if File.directory?(File.join(__dir__, "../anycable-rb"))
$stdout.puts "\n=== Using local AnyCable gems ===\n\n"
path ".." do
gem "anycable"
gem "anycable-rails"
end
gem "anycable", path: "../anycable-rb"
gem "anycable-rails", path: "../anycable-rails"
else
gem "anycable", github: "anycable/anycable"
gem "anycable-rails", github: "anycable/anycable-rails"
Expand Down
6 changes: 3 additions & 3 deletions lib/anyt/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,9 @@ def parse_options!(args)
end

cli.on("-rPATH", "--require=PATH",
"Path to additional tests (e.g. features/*.rb") do |path|
Anyt.config.tests_relative_path = path
ENV["ANYT_TESTS_RELATIVE_PATH"] = path
"Paths to additional tests (e.g. features/*.rb") do |paths|
Anyt.config.tests_relative_path = paths
ENV["ANYT_TESTS_RELATIVE_PATH"] = paths
end

cli.on("--debug", "Enable debug mode.") do
Expand Down
6 changes: 4 additions & 2 deletions lib/anyt/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ class Config < Anyway::Config
coerce_types only_tests: {type: :string, array: true}
coerce_types except_tests: {type: :string, array: true}

def tests_path
def test_paths
return unless tests_relative_path

File.expand_path(tests_relative_path, Dir.pwd)
tests_relative_path.split(",").map do |path|
File.expand_path(path, Dir.pwd)
end
end

def filter_tests?
Expand Down
2 changes: 1 addition & 1 deletion lib/anyt/tests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def load_all_tests

def test_files_patterns
@test_files_patterns ||= DEFAULT_PATTERNS.dup.tap do |patterns|
patterns << Anyt.config.tests_path if Anyt.config.tests_path
patterns.concat(Anyt.config.test_paths) if Anyt.config.test_paths
end
end
end
Expand Down

0 comments on commit cbf7725

Please sign in to comment.