Skip to content
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

Filter custom paths according to include #194

Merged
merged 1 commit into from
Jun 13, 2022
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/packwerk/files_for_processing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def files
include_files = if custom_files.empty?
configured_included_files
else
custom_files
configured_included_files & custom_files
end

include_files - configured_excluded_files
Expand Down
13 changes: 13 additions & 0 deletions test/unit/files_for_processing_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,19 @@ def setup
refute_any_match(files, Set.new([File.join(@configuration.root_path, "components/timeline", "**/*.rb")]))
end

test "fetch with custom paths for files includes only include glob in custom paths" do
files = ::Packwerk::FilesForProcessing.fetch(
relative_file_paths: [
"components/sales/app/models/order.rb",
"components/sales/app/views/order.html.erb",
],
configuration: @configuration
)
included_file_patterns = @configuration.include.map { |pattern| File.join(@configuration.root_path, pattern) }

assert_all_match(files, included_file_patterns)
end

private

def assert_all_match(files, patterns)
Expand Down