Skip to content

Commit e4e6096

Browse files
committed
ignore: fix hanging test
1 parent c472734 commit e4e6096

1 file changed

Lines changed: 12 additions & 10 deletions

File tree

‎packages/opencode/test/tool/bash.test.ts‎

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { describe, expect, test } from "bun:test"
22
import path from "path"
33
import { BashTool } from "../../src/tool/bash"
44
import { Instance } from "../../src/project/instance"
5+
import { Permission } from "../../src/permission"
56

67
const ctx = {
78
sessionID: "test",
@@ -33,19 +34,20 @@ describe("tool.bash", () => {
3334
})
3435
})
3536

36-
test("cd ../ should fail outside of project root", async () => {
37+
test("cd ../ should ask for permission for external directory", async () => {
3738
await Instance.provide({
3839
directory: projectRoot,
3940
fn: async () => {
40-
expect(
41-
bash.execute(
42-
{
43-
command: "cd ../",
44-
description: "Try to cd to parent directory",
45-
},
46-
ctx,
47-
),
48-
).rejects.toThrow("This command references paths outside of")
41+
bash.execute(
42+
{
43+
command: "cd ../",
44+
description: "Try to cd to parent directory",
45+
},
46+
ctx,
47+
)
48+
// Give time for permission to be asked
49+
await new Promise((resolve) => setTimeout(resolve, 100))
50+
expect(Permission.pending()[ctx.sessionID]).toBeDefined()
4951
},
5052
})
5153
})

0 commit comments

Comments
 (0)