Skip to content

Commit

Permalink
Merge pull request #748 from badlamer/master
Browse files Browse the repository at this point in the history
Clean file path from cli
  • Loading branch information
grosser committed Jan 31, 2020
2 parents 0a55916 + 05f59d3 commit f7c448e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/parallel_tests/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
require 'tempfile'
require 'parallel_tests'
require 'shellwords'
require 'pathname'

module ParallelTests
class CLI
Expand Down Expand Up @@ -239,7 +240,7 @@ def parse_options!(argv)
files, remaining = extract_file_paths(argv)
unless options[:execute]
abort "Pass files or folders to run" unless files.any?
options[:files] = files
options[:files] = files.map { |file_path| Pathname.new(file_path).cleanpath.to_s }
end

append_test_options(options, remaining)
Expand Down
6 changes: 5 additions & 1 deletion spec/parallel_tests/cli_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ def call(*args)
call(["-n3"])
end

it "cleanups file paths" do
expect(call(["./test"])).to eq(defaults)
end

it "parses execute" do
expect(call(["--exec", "echo"])).to eq(execute: "echo")
end
Expand Down Expand Up @@ -106,10 +110,10 @@ def call(*args)
context "when the -- option separator is used" do
it "interprets arguments as files/directories" do
expect(call(%w(-- test))).to eq( files: %w(test))
expect(call(%w(-- ./test))).to eq( files: %w(test))
expect(call(%w(-- test test2))).to eq( files: %w(test test2))
expect(call(%w(-- --foo test))).to eq( files: %w(--foo test))
expect(call(%w(-- test --foo test2))).to eq( files: %w(test --foo test2))

end

it "corectly handles arguments with spaces" do
Expand Down

0 comments on commit f7c448e

Please sign in to comment.