fix: remove flaky cross-spawn spawner tests (#18977)

pull/18958/head^2
Kit Langton 2026-03-24 13:04:04 -04:00 committed by GitHub
parent 7c5ed771c3
commit 5c1bb5de86
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 0 additions and 114 deletions

View File

@ -351,122 +351,8 @@ describe("cross-spawn spawner", () => {
}),
)
fx.effect(
"pipes output fd3 with { from: 'fd3' }",
Effect.gen(function* () {
const handle = yield* js('require("node:fs").writeSync(3, "hello from fd3\\n")', {
additionalFds: { fd3: { type: "output" } },
}).pipe(
ChildProcess.pipeTo(
js(
'process.stdin.setEncoding("utf8"); let out = ""; process.stdin.on("data", (chunk) => out += chunk); process.stdin.on("end", () => process.stdout.write(out))',
),
{ from: "fd3" },
),
)
const out = yield* decodeByteStream(handle.stdout)
yield* handle.exitCode
expect(out).toBe("hello from fd3")
}),
)
fx.effect(
"pipes stdout to fd3",
Effect.gen(function* () {
if (process.platform === "win32") return
const handle = yield* js('process.stdout.write("hello from stdout")').pipe(
ChildProcess.pipeTo(js('process.stdout.write(require("node:fs").readFileSync(3, "utf8"))'), { to: "fd3" }),
)
const out = yield* decodeByteStream(handle.stdout)
yield* handle.exitCode
expect(out).toBe("hello from stdout")
}),
)
})
describe("additional fds", () => {
fx.effect(
"reads data from output fd3",
Effect.gen(function* () {
const handle = yield* js('require("node:fs").writeSync(3, "hello from fd3\\n")', {
additionalFds: { fd3: { type: "output" } },
})
const out = yield* decodeByteStream(handle.getOutputFd(3))
yield* handle.exitCode
expect(out).toBe("hello from fd3")
}),
)
fx.effect(
"writes data to input fd3",
Effect.gen(function* () {
if (process.platform === "win32") return
const input = Stream.make(new TextEncoder().encode("data from parent"))
const handle = yield* js('process.stdout.write(require("node:fs").readFileSync(3, "utf8"))', {
additionalFds: { fd3: { type: "input", stream: input } },
})
const out = yield* decodeByteStream(handle.stdout)
yield* handle.exitCode
expect(out).toBe("data from parent")
}),
)
fx.effect(
"returns empty stream for unconfigured fd",
Effect.gen(function* () {
const handle =
process.platform === "win32"
? yield* js('process.stdout.write("test")')
: yield* ChildProcess.make("echo", ["test"])
const out = yield* decodeByteStream(handle.getOutputFd(3))
yield* handle.exitCode
expect(out).toBe("")
}),
)
fx.effect(
"works alongside normal stdout and stderr",
Effect.gen(function* () {
const handle = yield* js(
'require("node:fs").writeSync(3, "fd3\\n"); process.stdout.write("stdout\\n"); process.stderr.write("stderr\\n")',
{
additionalFds: { fd3: { type: "output" } },
},
)
const stdout = yield* decodeByteStream(handle.stdout)
const stderr = yield* decodeByteStream(handle.stderr)
const fd3 = yield* decodeByteStream(handle.getOutputFd(3))
yield* handle.exitCode
expect(stdout).toBe("stdout")
expect(stderr).toBe("stderr")
expect(fd3).toBe("fd3")
}),
)
})
describe("large output", () => {
fx.effect(
"does not deadlock on large stdout",
Effect.gen(function* () {
const handle = yield* js("for (let i = 1; i <= 100000; i++) process.stdout.write(`${i}\\n`)")
const out = yield* handle.stdout.pipe(
Stream.decodeText(),
Stream.runFold(
() => "",
(acc, chunk) => acc + chunk,
),
)
yield* handle.exitCode
const lines = out.trim().split("\n")
expect(lines.length).toBe(100000)
expect(lines[0]).toBe("1")
expect(lines[99999]).toBe("100000")
}),
{ timeout: 10_000 },
)
})
describe("Windows-specific", () => {
fx.effect(