From 15091999e365829d2dae6684aabad18e4145bae1 Mon Sep 17 00:00:00 2001 From: Gani Georgiev Date: Sat, 14 Feb 2026 12:08:57 +0200 Subject: [PATCH] use temp dir for the $filesystem.local test --- plugins/jsvm/binds_test.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/plugins/jsvm/binds_test.go b/plugins/jsvm/binds_test.go index 6ffc42e0..55e54950 100644 --- a/plugins/jsvm/binds_test.go +++ b/plugins/jsvm/binds_test.go @@ -9,6 +9,7 @@ import ( "mime/multipart" "net/http" "net/http/httptest" + "os" "path/filepath" "strconv" "strings" @@ -1008,8 +1009,15 @@ func TestFilesystemBinds(t *testing.T) { })) defer srv.Close() + tmpDir, err := os.MkdirTemp("", "jsvm") + if err != nil { + t.Fatal(err) + } + defer os.RemoveAll(tmpDir) + vm := goja.New() vm.Set("mh", &multipart.FileHeader{Filename: "test"}) + vm.Set("tmpDir", tmpDir) vm.Set("testFile", filepath.Join(app.DataDir(), "data.db")) vm.Set("baseURL", srv.URL) baseBinds(vm) @@ -1032,7 +1040,7 @@ func TestFilesystemBinds(t *testing.T) { // local { - v, err := vm.RunString(`$filesystem.local("test")`) + v, err := vm.RunString(`$filesystem.local(tmpDir)`) if err != nil { t.Fatal(err) }