e2etests-cli: Ignore png and --sketch diffs
This commit is contained in:
parent
86de922ec0
commit
7077f2edef
3 changed files with 12 additions and 13 deletions
|
|
@ -9,6 +9,7 @@ import (
|
|||
|
||||
"oss.terrastruct.com/d2/d2cli"
|
||||
"oss.terrastruct.com/util-go/assert"
|
||||
"oss.terrastruct.com/util-go/diff"
|
||||
"oss.terrastruct.com/util-go/xmain"
|
||||
"oss.terrastruct.com/util-go/xos"
|
||||
)
|
||||
|
|
@ -18,7 +19,6 @@ func TestCLI_E2E(t *testing.T) {
|
|||
|
||||
tca := []struct {
|
||||
name string
|
||||
skip bool
|
||||
run func(t *testing.T, ctx context.Context, dir string, env *xos.Env)
|
||||
}{
|
||||
{
|
||||
|
|
@ -28,7 +28,7 @@ func TestCLI_E2E(t *testing.T) {
|
|||
err := runTestMain(t, ctx, dir, env, "hello-world.d2", "hello-world.png")
|
||||
assert.Success(t, err)
|
||||
png := readFile(t, dir, "hello-world.png")
|
||||
assert.Testdata(t, ".png", png)
|
||||
testdataIgnoreDiff(t, ".png", png)
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
@ -38,19 +38,18 @@ func TestCLI_E2E(t *testing.T) {
|
|||
err := runTestMain(t, ctx, dir, env, "--pad=400", "hello-world.d2", "hello-world.png")
|
||||
assert.Success(t, err)
|
||||
png := readFile(t, dir, "hello-world.png")
|
||||
assert.Testdata(t, ".png", png)
|
||||
testdataIgnoreDiff(t, ".png", png)
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "hello_world_png_sketch",
|
||||
// https://github.com/terrastruct/d2/pull/963#pullrequestreview-1323089392
|
||||
skip: true,
|
||||
run: func(t *testing.T, ctx context.Context, dir string, env *xos.Env) {
|
||||
writeFile(t, dir, "hello-world.d2", `x -> y`)
|
||||
err := runTestMain(t, ctx, dir, env, "--sketch", "hello-world.d2", "hello-world.png")
|
||||
assert.Success(t, err)
|
||||
png := readFile(t, dir, "hello-world.png")
|
||||
assert.Testdata(t, ".png", png)
|
||||
// https://github.com/terrastruct/d2/pull/963#pullrequestreview-1323089392
|
||||
testdataIgnoreDiff(t, ".png", png)
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
@ -127,10 +126,6 @@ scenarios: {
|
|||
t.Run(tc.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
if tc.skip {
|
||||
t.SkipNow()
|
||||
}
|
||||
|
||||
ctx, cancel := context.WithTimeout(ctx, time.Minute*5)
|
||||
defer cancel()
|
||||
|
||||
|
|
@ -194,3 +189,7 @@ func removeD2Files(tb testing.TB, dir string) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
func testdataIgnoreDiff(tb testing.TB, ext string, got []byte) {
|
||||
_ = diff.Testdata(filepath.Join("testdata", tb.Name()), ext, got)
|
||||
}
|
||||
|
|
|
|||
2
go.mod
generated
2
go.mod
generated
|
|
@ -23,7 +23,7 @@ require (
|
|||
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2
|
||||
gonum.org/v1/plot v0.12.0
|
||||
nhooyr.io/websocket v1.8.7
|
||||
oss.terrastruct.com/util-go v0.0.0-20230303042538-fdc0536b018e
|
||||
oss.terrastruct.com/util-go v0.0.0-20230303051516-f04d4d93bed8
|
||||
)
|
||||
|
||||
require (
|
||||
|
|
|
|||
4
go.sum
generated
4
go.sum
generated
|
|
@ -277,6 +277,6 @@ honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWh
|
|||
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
nhooyr.io/websocket v1.8.7 h1:usjR2uOr/zjjkVMy0lW+PPohFok7PCow5sDjLgX4P4g=
|
||||
nhooyr.io/websocket v1.8.7/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0=
|
||||
oss.terrastruct.com/util-go v0.0.0-20230303042538-fdc0536b018e h1:twJhFNDPf1H45J9F2kDsof5lKQg7rW7/5M1waFngIHo=
|
||||
oss.terrastruct.com/util-go v0.0.0-20230303042538-fdc0536b018e/go.mod h1:Fwy72FDIOOM4K8F96ScXkxHHppR1CPfUyo9+x9c1PBU=
|
||||
oss.terrastruct.com/util-go v0.0.0-20230303051516-f04d4d93bed8 h1:sXAJ18qH3RfrhvAo3YaGv1mDewEKV8etsFq1KqhbvIM=
|
||||
oss.terrastruct.com/util-go v0.0.0-20230303051516-f04d4d93bed8/go.mod h1:eMWv0sOtD9T2RUl90DLWfuShZCYp4NrsqNpI8eqO6U4=
|
||||
rsc.io/pdf v0.1.1 h1:k1MczvYDUvJBe93bYd7wrZLLUEcLZAuF824/I4e5Xr4=
|
||||
|
|
|
|||
Loading…
Reference in a new issue