mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-08-30 17:14:40 +08:00
fix(ci): normalize test paths on Windows
This commit is contained in:
@@ -44,6 +44,7 @@ export namespace TestProfile {
|
||||
export const names = Object.keys(profiles)
|
||||
|
||||
export function resolve(name: string, all: readonly string[]) {
|
||||
const files = all.map((file) => file.replaceAll("\\", "/"))
|
||||
const profile = profiles[name as keyof typeof profiles]
|
||||
if (!profile) {
|
||||
return {
|
||||
@@ -74,7 +75,7 @@ export namespace TestProfile {
|
||||
)
|
||||
.map(([group]) => group)
|
||||
const globs = patterns.map((pattern) => ({ pattern, glob: new Bun.Glob(pattern) }))
|
||||
const unmatched = globs.filter((item) => !all.some((file) => item.glob.match(file))).map((item) => item.pattern)
|
||||
const unmatched = globs.filter((item) => !files.some((file) => item.glob.match(file))).map((item) => item.pattern)
|
||||
const errors = [
|
||||
malformed.length > 0 ? `Malformed patterns: ${malformed.join(", ")}` : "",
|
||||
duplicates.length > 0 ? `Duplicate patterns: ${duplicates.join(", ")}` : "",
|
||||
@@ -93,7 +94,7 @@ export namespace TestProfile {
|
||||
return {
|
||||
ok: true as const,
|
||||
description: profile.description,
|
||||
files: all.filter((file) => globs.some((item) => item.glob.match(file))),
|
||||
files: files.filter((file) => globs.some((item) => item.glob.match(file))),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,7 +102,9 @@ const bold = (s: string) => (tty ? `\x1b[1m${s}\x1b[0m` : s)
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
const glob = new Bun.Glob("**/*.test.{ts,tsx}")
|
||||
const all = (await Array.fromAsync(glob.scan({ cwd: path.join(root, "test") }))).sort()
|
||||
const all = (await Array.fromAsync(glob.scan({ cwd: path.join(root, "test") })))
|
||||
.map((file) => file.replaceAll("\\", "/"))
|
||||
.sort()
|
||||
|
||||
export const skipped = new Set([
|
||||
// Upstream browser OAuth integration tests bind the fixed callback port and
|
||||
|
||||
@@ -17,6 +17,17 @@ describe("test profiles", () => {
|
||||
expect(result.files).toContain("kilocode/sessions/remote-sender.test.ts")
|
||||
})
|
||||
|
||||
test("normalizes Windows test paths", () => {
|
||||
const result = TestProfile.resolve(
|
||||
"darwin",
|
||||
all.map((file) => file.replaceAll("/", "\\")),
|
||||
)
|
||||
expect(result.ok).toBe(true)
|
||||
if (!result.ok) return
|
||||
expect(result.files).toContain("pty/pty-session.test.ts")
|
||||
expect(result.files.some((file) => file.includes("\\"))).toBe(false)
|
||||
})
|
||||
|
||||
test("unknown profiles fail with available names", () => {
|
||||
const result = TestProfile.resolve("unknown", all)
|
||||
expect(result).toEqual({
|
||||
|
||||
Reference in New Issue
Block a user