Skip to content

Commit

Permalink
Fix test failures caused by adding a new field to Package
Browse files Browse the repository at this point in the history
  • Loading branch information
dnephin committed Jun 6, 2020
1 parent c6c06f8 commit dff8591
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 5 additions & 1 deletion testjson/execution_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"time"

"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
"gotest.tools/v3/assert"
"gotest.tools/v3/golden"
)
Expand Down Expand Up @@ -45,7 +46,10 @@ func TestExecution_Add_PackageCoverage(t *testing.T) {
assert.DeepEqual(t, pkg, expected, cmpPackage)
}

var cmpPackage = cmp.AllowUnexported(Package{})
var cmpPackage = cmp.Options{
cmp.AllowUnexported(Package{}),
cmpopts.EquateEmpty(),
}

func TestScanTestOutput_MinimalConfig(t *testing.T) {
in := bytes.NewReader(golden.Get(t, "go-test-json.out"))
Expand Down
8 changes: 5 additions & 3 deletions testjson/format_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"time"

gocmp "github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
"gotest.tools/v3/assert"
"gotest.tools/v3/assert/opt"
"gotest.tools/v3/golden"
Expand Down Expand Up @@ -117,13 +118,14 @@ var expectedExecution = &Execution{
var cmpExecutionShallow = gocmp.Options{
gocmp.AllowUnexported(Execution{}, Package{}),
gocmp.FilterPath(stringPath("started"), opt.TimeWithThreshold(10*time.Second)),
cmpopts.EquateEmpty(),
cmpPackageShallow,
}

var cmpPackageShallow = gocmp.Options{
// TODO: use opt.PathField(Package{}, "output")
gocmp.FilterPath(stringPath("packages.output"), gocmp.Ignore()),
gocmp.FilterPath(stringPath("packages.Passed"), gocmp.Ignore()),
gocmp.FilterPath(opt.PathField(Package{}, "output"), gocmp.Ignore()),
gocmp.FilterPath(opt.PathField(Package{}, "Passed"), gocmp.Ignore()),
gocmp.FilterPath(opt.PathField(Package{}, "subTests"), gocmp.Ignore()),
gocmp.Comparer(func(x, y TestCase) bool {
return x.Test == y.Test
}),
Expand Down

0 comments on commit dff8591

Please sign in to comment.