Skip to content

Commit

Permalink
Refactor to work with t.Cleanup
Browse files Browse the repository at this point in the history
Resolves: #991 (comment)
  • Loading branch information
ankur22 committed Aug 3, 2023
1 parent 43ff9a0 commit f2cb59a
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions tests/browser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,12 @@ func TestTmpDirCleanup(t *testing.T) {
t.Parallel()

tmpDirPath, err := os.MkdirTemp("./", "")
defer func() {
err := os.RemoveAll(tmpDirPath)
require.NoError(t, err)
}()
t.Cleanup(
func() {
err := os.RemoveAll(tmpDirPath)
require.NoError(t, err)
},
)
require.NoError(t, err)

b := newTestBrowser(
Expand All @@ -100,10 +102,12 @@ func TestTmpDirCleanupOnContextClose(t *testing.T) {
t.Parallel()

tmpDirPath, err := os.MkdirTemp("./", "")
defer func() {
err := os.RemoveAll(tmpDirPath)
require.NoError(t, err)
}()
t.Cleanup(
func() {
err := os.RemoveAll(tmpDirPath)
require.NoError(t, err)
},
)
require.NoError(t, err)

b := newTestBrowser(
Expand Down

0 comments on commit f2cb59a

Please sign in to comment.