File size: 1,005 Bytes
3144483 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | import { fileURLToPath } from "node:url";
import { expect, it } from "vitest";
import { runNodeScript } from "../../test/helpers/run-node-script.js";
it("releases discarded backing buffers while capped commands are still running", async ({
signal,
}) => {
const result = await runNodeScript(
[
"--expose-gc",
"--import",
"tsx",
fileURLToPath(new URL("./exec-output.retention.test-support.ts", import.meta.url)),
],
{ ...process.env, NODE_OPTIONS: "", TSX_DISABLE_CACHE: "1" },
15_000,
{
cwd: fileURLToPath(new URL("../../", import.meta.url)),
signal,
maxBuffer: 64 * 1024,
requireProcessTreeExit: process.platform !== "win32",
},
);
expect(result.error, result.stderr).toBeUndefined();
expect(result.status, result.stderr).toBe(0);
expect(JSON.parse(result.stdout)).toEqual([
{ mode: "head", retained: false },
{ mode: "combined-head", retained: false },
{ mode: "tail", retained: false },
]);
}, 30_000);
|