diff --git a/tests/desktop-logger.test.ts b/tests/desktop-logger.test.ts index 896bbce..8273020 100644 --- a/tests/desktop-logger.test.ts +++ b/tests/desktop-logger.test.ts @@ -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;