diff --git a/cmd/root_test.go b/cmd/root_test.go index 90a63a99..55781a32 100644 --- a/cmd/root_test.go +++ b/cmd/root_test.go @@ -1564,18 +1564,11 @@ func TestStdin(t *testing.T) { func TestDeterministicOrderingInPipeline(t *testing.T) { as := require.New(t) - // capture current cwd, so we can replace it after the test is finished - cwd, err := os.Getwd() - as.NoError(err) - - t.Cleanup(func() { - // return to the previous working directory - as.NoError(os.Chdir(cwd)) - }) - tempDir := test.TempExamples(t) configPath := tempDir + "/treefmt.toml" + test.ChangeWorkDir(t, tempDir) + test.WriteConfig(t, configPath, &config.Config{ FormatterConfigs: map[string]*config.Formatter{ // a and b have no priority set, which means they default to 0 and should execute first @@ -1600,8 +1593,7 @@ func TestDeterministicOrderingInPipeline(t *testing.T) { }, }) - _, err = treefmt(t, "-C", tempDir) - as.NoError(err) + treefmt2(t, withNoError(t)) matcher := regexp.MustCompile("^fmt-(.*)")