From 66d53a82d03e86bf8e01f0fd5462fd1f13891c84 Mon Sep 17 00:00:00 2001 From: "opencodejr[bot]" <348916617+opencodejr[bot]@users.noreply.github.com> Date: Tue, 24 Nov 2026 10:19:10 -0500 Subject: [PATCH] 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> --- .gitattributes | 2 ++ packages/core/test/opencode-api-skill.test.ts | 5 ++++- packages/core/test/tool-cd.test.ts | 4 +++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.gitattributes b/.gitattributes index 83f99733d55..72c9f12d717 100644 --- a/.gitattributes +++ b/.gitattributes @@ -23,6 +23,8 @@ packages/cli-rs/crates/ui/src/keymap/generated.rs linguist-generated packages/cli-rs/crates/ui/src/theme/generated/** linguist-generated packages/cli-rs/crates/util/fixtures/time.tsv linguist-generated packages/core/src/**/*.txt text eol=lf +# test/opencode-api-skill.test.ts compares the generated API reference byte for byte, so Windows checkouts keep LF. +packages/core/src/plugin/skill/opencode/** text eol=lf packages/httpapi-codegen/test/generated/*.ts text eol=lf # The site tests compare source text and humans.txt byte for byte, so Windows checkouts keep LF. services/site/** text=auto eol=lf diff --git a/packages/core/test/opencode-api-skill.test.ts b/packages/core/test/opencode-api-skill.test.ts index 30e3ecf64dd..2da3901bc5d 100644 --- a/packages/core/test/opencode-api-skill.test.ts +++ b/packages/core/test/opencode-api-skill.test.ts @@ -4,7 +4,10 @@ import { directory, render } from "../script/generate-api-skill" test("the opencode skill's API reference matches openapi.json", async () => { const files = await render() - const current = await Array.fromAsync(new Bun.Glob("**/*.md").scan({ cwd: directory })) + // Bun.Glob yields native separators, so Windows lists `api\session.md` where render() keys `api/session.md`. + const current = (await Array.fromAsync(new Bun.Glob("**/*.md").scan({ cwd: directory }))).map((file) => + file.split(path.sep).join("/"), + ) expect(current.toSorted()).toEqual(Object.keys(files).toSorted()) for (const [file, content] of Object.entries(files)) { // Run `bun run generate` from packages/protocol (or `bun run generate:api-skill` from packages/core) when this fails. diff --git a/packages/core/test/tool-cd.test.ts b/packages/core/test/tool-cd.test.ts index 4e3fe9043b8..1b15567191a 100644 --- a/packages/core/test/tool-cd.test.ts +++ b/packages/core/test/tool-cd.test.ts @@ -344,7 +344,9 @@ describe("CdTool", () => { // On a sandboxed workspace Location, a sandbox path matching a host worktree path must still prompt. const sandboxAssertions: Permission.AssertInput[] = [] const memory = makeMemoryDriver() - const sandboxWorktreePath = AbsolutePath.make("/outside-wt") + // A sandboxed Location resolves plain paths with the host's path rules (`D:\outside-wt` on Windows), so create + // the directory where that resolution lands for the memory driver to find it. + const sandboxWorktreePath = AbsolutePath.make(path.resolve("/outside-wt")) yield* memory.overrides!.mkdir!(sandboxWorktreePath) const wrkID = Workspace.ID.make("wrk_wt_test") const sandboxLayer = buildLayer({