From 7595d6f432f1e1144892925a0b6932334098ff03 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Wed, 12 Aug 2026 13:31:23 -0700 Subject: [PATCH] test(tooling): remove helper replays (#122790) * test(tooling): remove helper replays * refactor(tooling): inline fixture json serialization --- scripts/e2e/lib/fixtures/common.mjs | 3 +- test/scripts/fixture-common.test.ts | 44 ----------------------------- test/scripts/test-projects.test.ts | 29 ------------------- 3 files changed, 1 insertion(+), 75 deletions(-) delete mode 100644 test/scripts/fixture-common.test.ts diff --git a/scripts/e2e/lib/fixtures/common.mjs b/scripts/e2e/lib/fixtures/common.mjs index 9673d044ca83..4a0f88d8b29a 100644 --- a/scripts/e2e/lib/fixtures/common.mjs +++ b/scripts/e2e/lib/fixtures/common.mjs @@ -2,14 +2,13 @@ import fs from "node:fs"; import path from "node:path"; -export const json = (value) => `${JSON.stringify(value, null, 2)}\n`; export const readJson = (file) => JSON.parse(fs.readFileSync(file, "utf8")); export const write = (file, contents) => { fs.mkdirSync(path.dirname(file), { recursive: true }); fs.writeFileSync(file, contents); }; -export const writeJson = (file, value) => write(file, json(value)); +export const writeJson = (file, value) => write(file, `${JSON.stringify(value, null, 2)}\n`); export const requireArg = (value, name) => { if (!value) { diff --git a/test/scripts/fixture-common.test.ts b/test/scripts/fixture-common.test.ts deleted file mode 100644 index 25357201d4d6..000000000000 --- a/test/scripts/fixture-common.test.ts +++ /dev/null @@ -1,44 +0,0 @@ -// Fixture Common tests cover shared E2E fixture file/assertion helpers. -import { readFileSync } from "node:fs"; -import path from "node:path"; -import { afterEach, describe, expect, it } from "vitest"; -import { - assert, - json, - readJson, - requireArg, - write, - writeJson, -} from "../../scripts/e2e/lib/fixtures/common.mjs"; -import { cleanupTempDirs, makeTempDir } from "../helpers/temp-dir.js"; - -const tempDirs: string[] = []; - -afterEach(() => { - cleanupTempDirs(tempDirs); -}); - -describe("fixture common helpers", () => { - it("writes nested text and formatted JSON files", () => { - const root = makeTempDir(tempDirs, "openclaw-fixture-common-"); - const textPath = path.join(root, "nested", "fixture.txt"); - const jsonPath = path.join(root, "config", "fixture.json"); - - write(textPath, "contents"); - writeJson(jsonPath, { enabled: true, nested: { value: 1 } }); - - expect(readFileSync(textPath, "utf8")).toBe("contents"); - expect(readFileSync(jsonPath, "utf8")).toBe( - `${JSON.stringify({ enabled: true, nested: { value: 1 } }, null, 2)}\n`, - ); - expect(readJson(jsonPath)).toEqual({ enabled: true, nested: { value: 1 } }); - expect(json({ ok: true })).toBe(`${JSON.stringify({ ok: true }, null, 2)}\n`); - }); - - it("rejects missing required arguments and failed assertions", () => { - expect(requireArg("value", "field")).toBe("value"); - expect(() => requireArg("", "field")).toThrow("field is required"); - expect(() => assert(false, "fixture failed")).toThrow("fixture failed"); - expect(() => assert(true, "fixture failed")).not.toThrow(); - }); -}); diff --git a/test/scripts/test-projects.test.ts b/test/scripts/test-projects.test.ts index 6bccc005ec7e..21b3a902b5b2 100644 --- a/test/scripts/test-projects.test.ts +++ b/test/scripts/test-projects.test.ts @@ -3357,35 +3357,6 @@ describe("scripts/test-projects full-suite sharding", () => { }); describe("scripts/test-projects parallel cache paths", () => { - it("assigns isolated Vitest fs-module cache paths per parallel shard", () => { - const specs = applyParallelVitestCachePaths( - [ - { config: "test/vitest/vitest.gateway.config.ts", env: {}, pnpmArgs: [] }, - { config: "test/vitest/vitest.extension-matrix.config.ts", env: {}, pnpmArgs: [] }, - ], - { cwd: "/repo", env: {} }, - ); - - expect(specs.map((spec) => spec.env)).toEqual([ - { - OPENCLAW_VITEST_FS_MODULE_CACHE_PATH: path.join( - "/repo", - "node_modules", - ".experimental-vitest-cache", - "0-test-vitest-vitest.gateway.config.ts", - ), - }, - { - OPENCLAW_VITEST_FS_MODULE_CACHE_PATH: path.join( - "/repo", - "node_modules", - ".experimental-vitest-cache", - "1-test-vitest-vitest.extension-matrix.config.ts", - ), - }, - ]); - }); - it("splits an explicit global cache root per parallel shard", () => { const specs = applyParallelVitestCachePaths( [