diff --git a/e2etests-cli/main_test.go b/e2etests-cli/main_test.go index ff764ac5e..3c300b337 100644 --- a/e2etests-cli/main_test.go +++ b/e2etests-cli/main_test.go @@ -1006,11 +1006,12 @@ layers: { }, }, { - name: "fmt-check", + name: "fmt-check-unformatted", run: func(t *testing.T, ctx context.Context, dir string, env *xos.Env) { writeFile(t, dir, "foo.d2", `a ---> b`) writeFile(t, dir, "bar.d2", `x ---> y`) - err := runTestMainPersist(t, ctx, dir, env, "fmt", "--check", "foo.d2", "bar.d2") + writeFile(t, dir, "baz.d2", "a -> z\n") + err := runTestMainPersist(t, ctx, dir, env, "fmt", "--check", "foo.d2", "bar.d2", "baz.d2") assert.ErrorString(t, err, "failed to wait xmain test: e2etests-cli/d2: failed to fmt: exiting with code 1: found 2 unformatted files. Run d2 fmt to fix.") gotFoo := readFile(t, dir, "foo.d2") gotBar := readFile(t, dir, "bar.d2") @@ -1018,6 +1019,15 @@ layers: { assert.Equal(t, "x ---> y", string(gotBar)) }, }, + { + name: "fmt-check-formatted", + run: func(t *testing.T, ctx context.Context, dir string, env *xos.Env) { + writeFile(t, dir, "foo.d2", "a -> b\n") + writeFile(t, dir, "bar.d2", "x -> y\n") + err := runTestMainPersist(t, ctx, dir, env, "fmt", "--check", "foo.d2", "bar.d2") + assert.Success(t, err) + }, + }, { name: "watch-regular", serial: true,