|
@@ -1,4 +1,5 @@
|
|
|
import { describe, expect, test } from "bun:test"
|
|
import { describe, expect, test } from "bun:test"
|
|
|
|
|
+import os from "os"
|
|
|
import path from "path"
|
|
import path from "path"
|
|
|
import { BashTool } from "../../src/tool/bash"
|
|
import { BashTool } from "../../src/tool/bash"
|
|
|
import { Instance } from "../../src/project/instance"
|
|
import { Instance } from "../../src/project/instance"
|
|
@@ -138,14 +139,14 @@ describe("tool.bash permissions", () => {
|
|
|
await bash.execute(
|
|
await bash.execute(
|
|
|
{
|
|
{
|
|
|
command: "ls",
|
|
command: "ls",
|
|
|
- workdir: "/tmp",
|
|
|
|
|
- description: "List /tmp",
|
|
|
|
|
|
|
+ workdir: os.tmpdir(),
|
|
|
|
|
+ description: "List temp dir",
|
|
|
},
|
|
},
|
|
|
testCtx,
|
|
testCtx,
|
|
|
)
|
|
)
|
|
|
const extDirReq = requests.find((r) => r.permission === "external_directory")
|
|
const extDirReq = requests.find((r) => r.permission === "external_directory")
|
|
|
expect(extDirReq).toBeDefined()
|
|
expect(extDirReq).toBeDefined()
|
|
|
- expect(extDirReq!.patterns).toContain("/tmp/*")
|
|
|
|
|
|
|
+ expect(extDirReq!.patterns).toContain(path.join(os.tmpdir(), "*"))
|
|
|
},
|
|
},
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
@@ -366,7 +367,8 @@ describe("tool.bash truncation", () => {
|
|
|
ctx,
|
|
ctx,
|
|
|
)
|
|
)
|
|
|
expect((result.metadata as any).truncated).toBe(false)
|
|
expect((result.metadata as any).truncated).toBe(false)
|
|
|
- expect(result.output).toBe("hello\n")
|
|
|
|
|
|
|
+ const eol = process.platform === "win32" ? "\r\n" : "\n"
|
|
|
|
|
+ expect(result.output).toBe(`hello${eol}`)
|
|
|
},
|
|
},
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|