66 "runtime"
77 "testing"
88
9- "github.com/localstack/lstk/test/integration/env"
109 "github.com/stretchr/testify/assert"
1110 "github.com/stretchr/testify/require"
1211)
@@ -16,19 +15,13 @@ func TestLogging_NonTTY_WritesToLogFile(t *testing.T) {
1615
1716 tmpHome := t .TempDir ()
1817 var logPath string
19- var e env.Environ
2018 if runtime .GOOS == "windows" {
21- appData := filepath .Join (tmpHome , "AppData" , "Roaming" )
22- e = env .Without ("HOME" , "XDG_CONFIG_HOME" , "APPDATA" , "USERPROFILE" , "HOMEDRIVE" , "HOMEPATH" ).
23- With (env .Home , tmpHome ).
24- With ("USERPROFILE" , tmpHome ).
25- With ("APPDATA" , appData )
26- logPath = filepath .Join (appData , "lstk" , "lstk.log" )
19+ logPath = filepath .Join (tmpHome , "AppData" , "Roaming" , "lstk" , "lstk.log" )
2720 } else {
2821 require .NoError (t , os .MkdirAll (filepath .Join (tmpHome , ".config" ), 0755 ))
29- e = env .Without ("HOME" , "XDG_CONFIG_HOME" ).With (env .Home , tmpHome )
3022 logPath = filepath .Join (tmpHome , ".config" , "lstk" , "lstk.log" )
3123 }
24+ e := testEnvWithHome (tmpHome , "" )
3225
3326 ctx := testContext (t )
3427 _ , _ , err := runLstk (t , ctx , "" , e , "--version" )
@@ -49,7 +42,7 @@ func TestLogging_TTY_WritesToLogFile(t *testing.T) {
4942 tmpHome := t .TempDir ()
5043 require .NoError (t , os .MkdirAll (filepath .Join (tmpHome , ".config" ), 0755 ))
5144 logPath := filepath .Join (tmpHome , ".config" , "lstk" , "lstk.log" )
52- e := env . Without ( "HOME" , "XDG_CONFIG_HOME" ). With ( env . Home , tmpHome )
45+ e := testEnvWithHome ( tmpHome , "" )
5346
5447 ctx := testContext (t )
5548 _ , err := runLstkInPTY (t , ctx , e , "--version" )
0 commit comments