Skip to content

Commit 66d53a8

Browse files
fix(core): make the API skill and cd worktree tests pass on Windows (#66115)
Co-authored-by: opencodejr[bot] <348916617+opencodejr[bot]@users.noreply.github.com>
1 parent af54cae commit 66d53a8

3 files changed

Lines changed: 9 additions & 2 deletions

File tree

‎.gitattributes‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ packages/cli-rs/crates/ui/src/keymap/generated.rs linguist-generated
2323
packages/cli-rs/crates/ui/src/theme/generated/** linguist-generated
2424
packages/cli-rs/crates/util/fixtures/time.tsv linguist-generated
2525
packages/core/src/**/*.txt text eol=lf
26+
# test/opencode-api-skill.test.ts compares the generated API reference byte for byte, so Windows checkouts keep LF.
27+
packages/core/src/plugin/skill/opencode/** text eol=lf
2628
packages/httpapi-codegen/test/generated/*.ts text eol=lf
2729
# The site tests compare source text and humans.txt byte for byte, so Windows checkouts keep LF.
2830
services/site/** text=auto eol=lf

‎packages/core/test/opencode-api-skill.test.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ import { directory, render } from "../script/generate-api-skill"
44

55
test("the opencode skill's API reference matches openapi.json", async () => {
66
const files = await render()
7-
const current = await Array.fromAsync(new Bun.Glob("**/*.md").scan({ cwd: directory }))
7+
// Bun.Glob yields native separators, so Windows lists `api\session.md` where render() keys `api/session.md`.
8+
const current = (await Array.fromAsync(new Bun.Glob("**/*.md").scan({ cwd: directory }))).map((file) =>
9+
file.split(path.sep).join("/"),
10+
)
811
expect(current.toSorted()).toEqual(Object.keys(files).toSorted())
912
for (const [file, content] of Object.entries(files)) {
1013
// Run `bun run generate` from packages/protocol (or `bun run generate:api-skill` from packages/core) when this fails.

‎packages/core/test/tool-cd.test.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,9 @@ describe("CdTool", () => {
344344
// On a sandboxed workspace Location, a sandbox path matching a host worktree path must still prompt.
345345
const sandboxAssertions: Permission.AssertInput[] = []
346346
const memory = makeMemoryDriver()
347-
const sandboxWorktreePath = AbsolutePath.make("/outside-wt")
347+
// A sandboxed Location resolves plain paths with the host's path rules (`D:\outside-wt` on Windows), so create
348+
// the directory where that resolution lands for the memory driver to find it.
349+
const sandboxWorktreePath = AbsolutePath.make(path.resolve("/outside-wt"))
348350
yield* memory.overrides!.mkdir!(sandboxWorktreePath)
349351
const wrkID = Workspace.ID.make("wrk_wt_test")
350352
const sandboxLayer = buildLayer({

0 commit comments

Comments
 (0)