Files
openclaw/test/vitest/vitest.gateway-server.config.ts
Peter Steinberger 49cd6009cc test(gateway): give module-mocking Gateway tests a private module graph
`server.sessions.compaction-read-errors` mocks
`config/sessions/session-accessor.sqlite-read.js`, but production reaches
`loadTranscriptEvents` through re-exports: `server-methods/sessions-compact.ts`
imports it from the `session-accessor.js` barrel and
`preflightSessionTranscriptForManualCompact` imports it from the leaf. The
`gateway-server` project is `isolate: false`, so when a neighbour has already
evaluated those importers they stay bound to the real implementation and the
mock never fires -- the injected read error simply does not happen and all three
tests fail with `expected true to be false`, reading like a product regression.

Trigger: 33744584f3 added `server.chat-metadata-boundary.test.ts`, which boots
a full non-minimal Gateway in `beforeAll` and lands immediately before this file
in the shard. Main has gone red on it repeatedly since (32338154086, 32339521003,
32339928383, 32341300955, 32341946296); e294c154a6 fixed only the sibling
symptom where the factory had not run yet.

Route the file to a new `gateway-server-isolated` project instead, mirroring
`unit-fast-isolated` -- whose comment describes this exact hazard. A fresh graph
per file makes both symptoms structurally impossible rather than order-dependent.
The list is explicit so the reason travels with the file.

Not reproducible on macOS: the exact 24-file stripe in CI's own order, and the
triggering pair three times, are green locally every time.
2026-08-20 00:16:43 -07:00

30 lines
980 B
TypeScript

import {
gatewayServerBackedHttpTestFiles,
gatewayServerExcludedTestFiles,
gatewayServerIsolatedTestFiles,
} from "./vitest.gateway-server-paths.mjs";
// Vitest gateway server config wires the gateway server test shard.
import { createScopedVitestConfig } from "./vitest.scoped-config.ts";
export function createGatewayServerVitestConfig(env?: Record<string, string | undefined>) {
return createScopedVitestConfig(
["src/gateway/**/*server*.test.ts", ...gatewayServerBackedHttpTestFiles],
{
dir: "src/gateway",
env,
exclude: [
"src/gateway/server-methods/**/*.test.ts",
...gatewayServerExcludedTestFiles,
...gatewayServerIsolatedTestFiles,
],
fileParallelism: false,
// Gateway child projects share one include file; preserve this project's ownership.
intersectIncludeFile: true,
isolate: false,
name: "gateway-server",
},
);
}
export default createGatewayServerVitestConfig();