diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2023-07-29 17:02:04 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2023-07-30 18:35:36 +1000 |
commit | 7b302d8c298ca2eb7e08d63f993186d25252f97e (patch) | |
tree | ef50114f45816c9dc16cfa6e827cbd74fce38469 /pkg/app | |
parent | a1fae4105116775b5c4a0c9c3b01fa822b29cfac (diff) |
Write unit tests with the help of afero
Afero is a package that lets you mock out a filesystem with an in-memory filesystem.
It allows us to easily create the files required for a given test without worrying about
a cleanup step or different tests tripping on eachother when run in parallel.
Later on I'll standardise on using afero over the vanilla os package
Diffstat (limited to 'pkg/app')
-rw-r--r-- | pkg/app/app.go | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/pkg/app/app.go b/pkg/app/app.go index 53e6e4411..2b7a8457d 100644 --- a/pkg/app/app.go +++ b/pkg/app/app.go @@ -11,6 +11,7 @@ import ( "github.com/go-errors/errors" "github.com/sirupsen/logrus" + "github.com/spf13/afero" "github.com/jesseduffield/generics/slices" appTypes "github.com/jesseduffield/lazygit/pkg/app/types" @@ -75,6 +76,7 @@ func NewCommon(config config.AppConfigurer) (*common.Common, error) { Tr: tr, UserConfig: userConfig, Debug: config.GetDebug(), + Fs: afero.NewOsFs(), }, nil } |