Files
openclaw/test/vitest/vitest.ui-isolated.config.ts
Peter Steinberger 896592b747 test(vitest): give config creators nameable return types
A vitest/vite type bump made inferred creator return types reach
vite-internal names (TS4058/TS4082), failing check-test-types repo-wide.
Annotate the scoped/extension config roots and the spread-rebuilding
creators with ViteUserConfig; also drop an unused workflow read, mutating
sorts, and an untyped record index left by 1f591bba56.
2026-08-10 09:35:51 -07:00

30 lines
1.3 KiB
TypeScript

// Vitest ui-isolated config runs jsdom ui tests that need a fresh module graph.
// The shared ui shard runs non-isolated for speed, but tests that spy on module
// internals and assert the component uses that spy must not share a module cache
// with stateful predecessor files (see uiIsolatedTestFiles).
import type { ViteUserConfig } from "vitest/config";
import { controlUiLocaleModulesPlugin } from "../../ui/config/control-ui-locales.ts";
import { createScopedVitestConfig } from "./vitest.scoped-config.ts";
import { jsdomOptimizedDeps } from "./vitest.shared.config.ts";
import { uiIsolatedTestFiles } from "./vitest.ui-isolated-paths.mjs";
// Explicit nameable return type: inference reaches vite-internal names (TS4058/TS4082).
export function createUiIsolatedVitestConfig(
env?: Record<string, string | undefined>,
): ViteUserConfig {
const config = createScopedVitestConfig(uiIsolatedTestFiles, {
deps: jsdomOptimizedDeps,
environment: "jsdom",
env,
excludeUnitFastTests: false,
includeOpenClawRuntimeSetup: false,
isolate: true,
name: "ui-isolated",
setupFiles: ["ui/src/test-helpers/lit-warnings.setup.ts"],
useNonIsolatedRunner: false,
});
return { ...config, plugins: [...(config.plugins ?? []), controlUiLocaleModulesPlugin()] };
}
export default createUiIsolatedVitestConfig();