mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-08 18:33:39 +02:00
perf(test): fix unit shard config regressions
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import { withTempDir, withTempDirSync } from "./test-helpers/temp-dir.js";
|
||||
import { withTempDir } from "./test-helpers/temp-dir.js";
|
||||
import {
|
||||
ensureDir,
|
||||
resolveConfigDir,
|
||||
@@ -34,7 +34,7 @@ describe("sleep", () => {
|
||||
|
||||
describe("resolveConfigDir", () => {
|
||||
it("prefers ~/.openclaw when legacy dir is missing", async () => {
|
||||
await withTempDirSync({ prefix: "openclaw-config-dir-" }, async (root) => {
|
||||
await withTempDir({ prefix: "openclaw-config-dir-" }, async (root) => {
|
||||
const newDir = path.join(root, ".openclaw");
|
||||
await fs.promises.mkdir(newDir, { recursive: true });
|
||||
const resolved = resolveConfigDir({} as NodeJS.ProcessEnv, () => root);
|
||||
|
||||
@@ -97,4 +97,16 @@ describe("unit vitest config", () => {
|
||||
"test/setup-openclaw-runtime.ts",
|
||||
]);
|
||||
});
|
||||
|
||||
it("appends extra exclude patterns instead of replacing the base unit excludes", () => {
|
||||
const unitConfig = createUnitVitestConfigWithOptions(
|
||||
{},
|
||||
{
|
||||
extraExcludePatterns: ["src/security/**"],
|
||||
},
|
||||
);
|
||||
expect(unitConfig.test?.exclude).toEqual(
|
||||
expect.arrayContaining(["src/commands/**", "src/config/**", "src/security/**"]),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -189,6 +189,10 @@ export const sharedVitestConfig = {
|
||||
find: `openclaw/plugin-sdk/${subpath}`,
|
||||
replacement: path.join(repoRoot, "src", "plugin-sdk", `${subpath}.ts`),
|
||||
})),
|
||||
...pluginSdkSubpaths.map((subpath) => ({
|
||||
find: `@openclaw/plugin-sdk/${subpath}`,
|
||||
replacement: path.join(repoRoot, "packages", "plugin-sdk", "src", `${subpath}.ts`),
|
||||
})),
|
||||
{
|
||||
find: "openclaw/plugin-sdk",
|
||||
replacement: path.join(repoRoot, "src", "plugin-sdk", "index.ts"),
|
||||
|
||||
@@ -48,7 +48,8 @@ export function createUnitVitestConfigWithOptions(
|
||||
exclude: [
|
||||
...new Set([
|
||||
...exclude,
|
||||
...(options.extraExcludePatterns ?? unitTestAdditionalExcludePatterns),
|
||||
...unitTestAdditionalExcludePatterns,
|
||||
...(options.extraExcludePatterns ?? []),
|
||||
...loadExtraExcludePatternsFromEnv(env),
|
||||
]),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user