mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-09-24 16:02:55 +08:00
fix(ci): stabilize cross-platform unit tests
This commit is contained in:
@@ -2,6 +2,7 @@ import { describe, expect, test } from "bun:test"
|
||||
import { mkdtemp, rm } from "node:fs/promises"
|
||||
import { tmpdir } from "node:os"
|
||||
import { join } from "node:path"
|
||||
import { fileURLToPath } from "node:url" // kilocode_change - convert file URLs correctly on Windows
|
||||
import { Effect, FileSystem, Schema, SchemaAST, SchemaGetter } from "effect"
|
||||
import { HttpApi, HttpApiEndpoint, HttpApiGroup, HttpApiMiddleware, HttpApiSchema } from "effect/unstable/httpapi"
|
||||
import { format } from "prettier"
|
||||
@@ -621,8 +622,8 @@ describe("HttpApiCodegen.generate", () => {
|
||||
it.effect("keeps the strict generated-consumer fixture current", () =>
|
||||
Effect.gen(function* () {
|
||||
const output = compile(FixtureApi)
|
||||
const actual = yield* Effect.promise(() =>
|
||||
Array.fromAsync(new Bun.Glob("*.ts").scan(new URL("generated", import.meta.url).pathname)),
|
||||
const actual = yield* Effect.promise(
|
||||
() => Array.fromAsync(new Bun.Glob("*.ts").scan(fileURLToPath(new URL("generated", import.meta.url)))), // kilocode_change
|
||||
)
|
||||
expect(actual.sort((a, b) => a.localeCompare(b))).toEqual(
|
||||
output.files.map((file) => file.path).sort((a, b) => a.localeCompare(b)),
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { describe, expect } from "bun:test"
|
||||
import { join } from "node:path" // kilocode_change - use native separators in cross-platform tests
|
||||
import { Effect, FileSystem, Option } from "effect"
|
||||
import { write, type Output } from "../src"
|
||||
import { it } from "./effect"
|
||||
@@ -15,8 +16,8 @@ describe("HttpApiCodegen.write", () => {
|
||||
yield* write(output, "/generated")
|
||||
|
||||
expect(writes).toEqual([
|
||||
{ path: "/generated/session.ts", content: "export const session = {}\n" },
|
||||
{ path: "/generated/.httpapi-codegen.json", content: '[\n "session.ts"\n]\n' },
|
||||
{ path: join("/generated", "session.ts"), content: "export const session = {}\n" }, // kilocode_change
|
||||
{ path: join("/generated", ".httpapi-codegen.json"), content: '[\n "session.ts"\n]\n' }, // kilocode_change
|
||||
])
|
||||
}).pipe(
|
||||
Effect.provideService(
|
||||
@@ -55,7 +56,7 @@ describe("HttpApiCodegen.write", () => {
|
||||
writeFileString: () => Effect.void,
|
||||
}),
|
||||
),
|
||||
Effect.tap(() => Effect.sync(() => expect(removed).toEqual(["/generated/old.ts"]))),
|
||||
Effect.tap(() => Effect.sync(() => expect(removed).toEqual([join("/generated", "old.ts")]))), // kilocode_change
|
||||
)
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user