func clearConfig(dir string) {
	if err := os.Unsetenv("TMHOME"); err != nil {
		panic(err)
	}
	if err := os.Unsetenv("TM_HOME"); err != nil {
		panic(err)
	}
	if err := os.RemoveAll(dir); err != nil {
		panic(err)
	}
	viper.Reset()
	config = cfg.DefaultConfig()
}
clearConfig clears env vars, the given root dir, and resets viper.
package commands
import (
	"fmt"
	"io/ioutil"
	"os"
	"path/filepath"
	"strconv"
	"testing"
	"github.com/spf13/cobra"
	"github.com/spf13/viper"
	"github.com/stretchr/testify/assert"
	"github.com/stretchr/testify/require"
	cfg "github.com/tendermint/tendermint/config"
	"github.com/tendermint/tendermint/libs/cli"
	tmos "github.com/tendermint/tendermint/libs/os"
)