refactor: prune test-only seams and obsolete helpers (#10275)

This commit is contained in:
morluto authored and GitHub committed 2026-11-12 19:24:54 -05:00
1 parent a8527d43b8
commit 02ebd3e02d
291 files changed
+1882 -1377

No files matched your search

+24
View File
@@ -0,0 +1,24 @@
import { open } from "node:fs/promises";
/** Observe completed writes to a real prepared-image file. */
export const hopperImageCopyFileSystem = (
destination: string,
afterWrite: (bytes: number) => Promise<void>,
openFile: typeof open = open,
) => ({
open: (async (...args: Parameters<typeof open>) => {
const handle = await openFile(...args);
if (args[0] === destination) {
const writeFile = handle.writeFile.bind(handle);
handle.writeFile = (async (
...writeArgs: Parameters<typeof writeFile>
) => {
await writeFile(...writeArgs);
const data = writeArgs[0];
if (!Buffer.isBuffer(data)) throw new Error("Expected a buffer write");
await afterWrite(data.length);
}) as typeof handle.writeFile;
}
return handle;
}) as typeof open,
});