mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-20 09:31:54 -06:00
896592b747
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.
32 lines
1.3 KiB
TypeScript
32 lines
1.3 KiB
TypeScript
// Vitest ui config wires the ui test shard.
|
|
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 createUiVitestConfig(
|
|
env?: Record<string, string | undefined>,
|
|
options?: { includePatterns?: string[]; name?: string },
|
|
): ViteUserConfig {
|
|
const includePatterns = options?.includePatterns ?? ["ui/src/**/*.test.ts"];
|
|
// Isolated files must never enter the shared module graph, including scoped runs.
|
|
const exclude = ["ui/src/**/*.e2e.test.ts", ...uiIsolatedTestFiles];
|
|
const config = createScopedVitestConfig(includePatterns, {
|
|
deps: jsdomOptimizedDeps,
|
|
environment: "jsdom",
|
|
env,
|
|
exclude,
|
|
excludeUnitFastTests: false,
|
|
includeOpenClawRuntimeSetup: false,
|
|
isolate: false,
|
|
name: options?.name ?? "ui",
|
|
setupFiles: ["ui/src/test-helpers/lit-warnings.setup.ts"],
|
|
useNonIsolatedRunner: true,
|
|
});
|
|
return { ...config, plugins: [...(config.plugins ?? []), controlUiLocaleModulesPlugin()] };
|
|
}
|
|
|
|
export default createUiVitestConfig();
|