Skip to content

Commit d0cd199

Browse files
committed
test: reduce Windows-only skips
1 parent 50862e9 commit d0cd199

2 files changed

Lines changed: 23 additions & 31 deletions

File tree

src/core/loaders.test.ts

Lines changed: 21 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -491,22 +491,19 @@ describe("loadAppBootstrap", () => {
491491
});
492492

493493
test("loads untracked files whose names need parser-safe diff headers", async () => {
494-
if (platform() === "win32") {
495-
return;
496-
}
497-
498494
const dir = createTempRepo("hunk-git-quoted-untracked-");
499495

500496
writeFileSync(join(dir, "tracked.ts"), "export const tracked = 1;\n");
501497
git(dir, "add", "tracked.ts");
502498
git(dir, "commit", "-m", "initial");
503499

504-
const quoteFile = 'quote"name.txt';
505-
const tabFile = "tab\tname.txt";
506-
const backslashFile = "back\\slash.txt";
507-
writeFileSync(join(dir, quoteFile), "quote\n");
508-
writeFileSync(join(dir, tabFile), "tab\n");
509-
writeFileSync(join(dir, backslashFile), "backslash\n");
500+
const portableFiles = ["space name.txt"];
501+
const unixOnlyFiles = ['quote"name.txt', "tab\tname.txt", "back\\slash.txt"];
502+
const fixtureFiles =
503+
platform() === "win32" ? portableFiles : [...portableFiles, ...unixOnlyFiles];
504+
for (const file of fixtureFiles) {
505+
writeFileSync(join(dir, file), `${file}\n`);
506+
}
510507

511508
const bootstrap = await loadFromRepo(dir, {
512509
kind: "vcs",
@@ -515,10 +512,10 @@ describe("loadAppBootstrap", () => {
515512
});
516513
const paths = bootstrap.changeset.files.map((file) => file.path);
517514

518-
expect(paths).toContain(quoteFile);
519-
expect(paths).toContain(tabFile);
520-
expect(paths).toContain(backslashFile);
521-
expect(paths).toHaveLength(3);
515+
for (const file of fixtureFiles) {
516+
expect(paths).toContain(file);
517+
}
518+
expect(paths).toHaveLength(fixtureFiles.length);
522519
});
523520

524521
test("still shows an untracked agent sidecar when it lives inside the repo", async () => {
@@ -1115,21 +1112,16 @@ describe("loadAppBootstrap", () => {
11151112
});
11161113

11171114
test("loads quoted noprefix patch text emitted for escaped git paths", async () => {
1118-
if (platform() === "win32") {
1119-
return;
1120-
}
1121-
1122-
const dir = createTempRepo("hunk-patch-quoted-noprefix-");
1123-
const fileName = "src\tfile.txt";
1124-
1125-
writeFileSync(join(dir, fileName), "one\n");
1126-
git(dir, "add", ".");
1127-
git(dir, "commit", "-m", "initial");
1128-
1129-
writeFileSync(join(dir, fileName), "two\n");
1130-
const patchText = git(dir, "-c", "diff.noprefix=true", "diff", "--", fileName);
1131-
1132-
expect(patchText).toContain('diff --git "src\\tfile.txt" "src\\tfile.txt"');
1115+
const patchText = [
1116+
'diff --git "src\\tfile.txt" "src\\tfile.txt"',
1117+
"index 5626abf..f719efd 100644",
1118+
'--- "src\\tfile.txt"',
1119+
'+++ "src\\tfile.txt"',
1120+
"@@ -1 +1 @@",
1121+
"-one",
1122+
"+two",
1123+
"",
1124+
].join("\n");
11331125

11341126
const bootstrap = await loadAppBootstrap({
11351127
kind: "patch",

src/session-broker/brokerServer.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ async function openSessionSocket(port: number) {
9494
() => reject(new Error("Timed out waiting for websocket open.")),
9595
500,
9696
);
97-
timeout.unref?.();
9897

9998
socket.addEventListener(
10099
"open",
@@ -142,7 +141,6 @@ async function waitForSocketClose(socket: WebSocket) {
142141
() => reject(new Error("Timed out waiting for websocket close.")),
143142
1_000,
144143
);
145-
timeout.unref?.();
146144

147145
socket.addEventListener(
148146
"close",
@@ -248,6 +246,8 @@ describe("Hunk session daemon server", () => {
248246
});
249247

250248
test("closes snapshots for missing sessions with a specific not-registered reason", async () => {
249+
// Bun's Windows WebSocket client does not reliably surface this immediate server close.
250+
// The daemon-core test covers the close code/reason without the flaky transport layer.
251251
if (platform() === "win32") {
252252
return;
253253
}

0 commit comments

Comments
 (0)