Skip to content
This repository was archived by the owner on Jan 30, 2025. It is now read-only.

Commit 1bacf59

Browse files
committed
Refactor test to write to separate dir
There will be two temp clean dir tests. We need them to not look at what each other are creating and cause the test to pass/fail. So the current test will need to write to a new dir that is different to what the new test will write to.
1 parent 8f780df commit 1bacf59

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

tests/browser_test.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,22 @@ func TestBrowserNewContext(t *testing.T) {
6969
func TestTmpDirCleanup(t *testing.T) {
7070
t.Parallel()
7171

72-
const tmpDirPath = "./"
72+
const tmpDirPath = "./1/"
73+
err := os.Mkdir(tmpDirPath, os.ModePerm)
74+
require.NoError(t, err)
75+
76+
defer func() {
77+
err = os.Remove(tmpDirPath)
78+
require.NoError(t, err)
79+
}()
7380

7481
b := newTestBrowser(
7582
t,
7683
withSkipClose(),
7784
withEnvLookup(env.ConstLookup("TMPDIR", tmpDirPath)),
7885
)
7986
p := b.NewPage(nil)
80-
err := p.Close(nil)
87+
err = p.Close(nil)
8188
require.NoError(t, err)
8289

8390
matches, err := filepath.Glob(tmpDirPath + "xk6-browser-data-*")

0 commit comments

Comments
 (0)