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

Include entry packages, not just dependencies when checking changed packages. #950

Merged
merged 1 commit into from
Mar 25, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion cli/internal/scope/filter/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,11 @@ func (r *Resolver) filterSubtreesWithSelector(selector *TargetSelector) (util.Se
return nil, err
}
for changedPkg := range changedPkgs {
if deps.Include(changedPkg) {
if !selector.excludeSelf && pkg == changedPkg {
roots.Add(pkg)
break
}
if deps.Include(changedPkg) {
roots.Add(pkg)
matched.Add(changedPkg)
break
Expand Down
13 changes: 13 additions & 0 deletions cli/internal/scope/filter/filter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,19 @@ func Test_SCM(t *testing.T) {
},
// Note: missing test here that takes advantage of automatically exempting
// test-only changes from pulling in dependents
//
// turbo-specific tests below here
{
"changed package was requested scope, and we're matching dependencies",
[]*TargetSelector{
{
diff: "HEAD~1",
namePattern: "package-1",
matchDependencies: true,
},
},
[]string{"package-1"},
},
}

for _, tc := range testCases {
Expand Down