test: bound oversized log fixtures on Windows

This commit is contained in:
2026-11-03 15:23:07 +03:00
parent c950b9cbfb
commit c7f6f5cf4b
+4 -2
View File
@@ -52,9 +52,11 @@ describe("bounded desktop logs", () => {
const dir = directory(t);
for (const name of ["main.log", "main.log.1"]) {
const file = path.join(dir, name);
// Sparse legacy file: reproduces a huge prior log without allocating it.
// Unix creates a sparse hole automatically. Windows can allocate the
// entire gap, so keep that fixture small while still exceeding the cap.
const legacySize = process.platform === "win32" ? MAX_LOG_BYTES * 3 : 200 * 1024 ** 3;
const fd = fs.openSync(file, "w");
fs.writeSync(fd, Buffer.from(`recent ${name}\n`), 0, Buffer.byteLength(`recent ${name}\n`), 200 * 1024 ** 3);
fs.writeSync(fd, Buffer.from(`recent ${name}\n`), 0, Buffer.byteLength(`recent ${name}\n`), legacySize);
fs.closeSync(fd);
}
let largestRead = 0;