Skip to content

Commit

Permalink
test: include groups when describing package details (#933)
Browse files Browse the repository at this point in the history
Ran into this while working on other stuff - currently if two packages
are the same except for their groups, the failure message doesn't
indicate that which is confusing
  • Loading branch information
G-Rath committed Apr 23, 2024
1 parent 032296d commit d75f136
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/lockfile/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,13 @@ func packageToString(pkg lockfile.PackageDetails) string {
commit = "<no commit>"
}

return fmt.Sprintf("%s@%s (%s, %s)", pkg.Name, pkg.Version, pkg.Ecosystem, commit)
groups := strings.Join(pkg.DepGroups, ", ")

if groups == "" {
groups = "<no groups>"
}

return fmt.Sprintf("%s@%s (%s, %s, %s)", pkg.Name, pkg.Version, pkg.Ecosystem, commit, groups)
}

func hasPackage(t *testing.T, packages []lockfile.PackageDetails, pkg lockfile.PackageDetails) bool {
Expand Down

0 comments on commit d75f136

Please sign in to comment.