From b7b1dcca65f1443a7bc6a8d345f72ebc5b11f266 Mon Sep 17 00:00:00 2001 From: Siya <57148521+siyabendoezdemir@users.noreply.github.com> Date: Sat, 10 Oct 2026 20:09:56 +0000 Subject: [PATCH 1/2] test: one temp folder per test run, removed when the run ends On Linux, Playwright's and Vitest's global setup make one folder per run and point TMPDIR at it. Workers and the apps they launch inherit it, so every tmpdir() folder a test makes goes under it, and the teardown removes it. Before, each e2e test left about 3 MB of user data in /tmp (over 1 GB a full run, about 124 GB after two days), and a unit run left 49 folders. Checked against a scratch TMPDIR: smoke + core e2e (26 passed) and the unit suite (580 passed) leave nothing but Playwright's transform cache; without the change, smoke leaves 4 orbit-e2e folders and a unit run 49. Co-Authored-By: Claude Opus 5.5 --- playwright.config.ts | 1 + tests/run-tmp.ts | 20 ++++++++++++++++++++ vitest.config.ts | 1 + 3 files changed, 22 insertions(+) create mode 100644 tests/run-tmp.ts diff --git a/playwright.config.ts b/playwright.config.ts index 533ad8b6..142934f1 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -10,4 +10,5 @@ export default defineConfig({ retries: process.env.CI ? 1 : 0, reporter: process.env.CI ? [['list'], ['html', { open: 'never' }]] : 'list', use: { trace: 'retain-on-failure' }, + globalSetup: './tests/run-tmp.ts', }) diff --git a/tests/run-tmp.ts b/tests/run-tmp.ts new file mode 100644 index 00000000..a7ab9227 --- /dev/null +++ b/tests/run-tmp.ts @@ -0,0 +1,20 @@ +import { mkdtempSync, rmSync } from 'node:fs' +import { tmpdir } from 'node:os' +import { join } from 'node:path' + +/** + * Global setup for both test runners: on Linux, one temp folder per run, removed when the run + * ends. Workers, and the apps they launch, inherit `TMPDIR`, so every folder a test makes with + * `tmpdir()` (an app's user data, a download folder, a saved page) and the apps' own temp files + * go under it. Before, each e2e test left its user data in /tmp: about 3 MB a test, over 1 GB a + * full run. A run that is killed leaves its one folder behind. + * + * Linux only: macOS's temp path is long, and Chromium's single-instance socket under it could pass + * the platform's socket path limit. Nothing runs the suite on macOS or Windows now (D42). + */ +export default function runTmp(): () => void { + if (process.platform !== 'linux') return () => {} + const dir = mkdtempSync(join(tmpdir(), 'orbit-run-')) + process.env.TMPDIR = dir + return () => rmSync(dir, { recursive: true, force: true }) +} diff --git a/vitest.config.ts b/vitest.config.ts index f58daa18..4eb2d9bd 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -4,6 +4,7 @@ export default defineConfig({ test: { include: ['tests/unit/**/*.test.ts'], environment: 'node', + globalSetup: ['tests/run-tmp.ts'], // Persistence tests fsync real files; CI disks (macOS runners) can take seconds. testTimeout: 15_000, }, From cb30e1a61f7ab7248cc04d8513277ef5305ceae7 Mon Sep 17 00:00:00 2001 From: Siya <57148521+siyabendoezdemir@users.noreply.github.com> Date: Sun, 11 Oct 2026 02:08:39 +0000 Subject: [PATCH 2/2] test: run-tmp gives the real reason it's Linux only (PR #24 review T2) Co-Authored-By: Claude Opus 5.5 --- tests/run-tmp.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/run-tmp.ts b/tests/run-tmp.ts index a7ab9227..cec57981 100644 --- a/tests/run-tmp.ts +++ b/tests/run-tmp.ts @@ -9,8 +9,8 @@ import { join } from 'node:path' * go under it. Before, each e2e test left its user data in /tmp: about 3 MB a test, over 1 GB a * full run. A run that is killed leaves its one folder behind. * - * Linux only: macOS's temp path is long, and Chromium's single-instance socket under it could pass - * the platform's socket path limit. Nothing runs the suite on macOS or Windows now (D42). + * Linux only: on Windows `tmpdir()` reads TEMP and TMP, not `TMPDIR`, and nothing runs the suite + * on macOS or Windows now (D42), so it's untested there. */ export default function runTmp(): () => void { if (process.platform !== 'linux') return () => {}