Skip to content

Commit d75f136

Browse files
authored
test: include groups when describing package details (#933)
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
1 parent 032296d commit d75f136

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pkg/lockfile/helpers_test.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,13 @@ func packageToString(pkg lockfile.PackageDetails) string {
4242
commit = "<no commit>"
4343
}
4444

45-
return fmt.Sprintf("%s@%s (%s, %s)", pkg.Name, pkg.Version, pkg.Ecosystem, commit)
45+
groups := strings.Join(pkg.DepGroups, ", ")
46+
47+
if groups == "" {
48+
groups = "<no groups>"
49+
}
50+
51+
return fmt.Sprintf("%s@%s (%s, %s, %s)", pkg.Name, pkg.Version, pkg.Ecosystem, commit, groups)
4652
}
4753

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

0 commit comments

Comments
 (0)