test: fix full ci suite follow-ups

This commit is contained in:
Peter Steinberger
2026-04-27 01:10:28 +01:00
parent 3b514ad5f3
commit b825c8d34b
3 changed files with 82 additions and 12 deletions

View File

@@ -69,6 +69,12 @@ import { createUtilsVitestConfig } from "./vitest/vitest.utils.config.ts";
import { createWizardVitestConfig } from "./vitest/vitest.wizard.config.ts";
const EXTENSIONS_CHANNEL_GLOB = ["extensions", "channel", "**"].join("/");
const PRIVATE_PLUGIN_SDK_SUBPATHS = [
"qa-channel",
"qa-channel-protocol",
"qa-lab",
"qa-runtime",
] as const;
function bundledExcludePatternCouldMatchFile(pattern: string, file: string): boolean {
if (pattern === file) {
@@ -82,6 +88,28 @@ function bundledExcludePatternCouldMatchFile(pattern: string, file: string): boo
}
describe("resolveVitestIsolation", () => {
it("aliases private QA plugin SDK subpaths for source tests only", () => {
expect(sharedVitestConfig.resolve.alias).toEqual(
expect.arrayContaining(
PRIVATE_PLUGIN_SDK_SUBPATHS.map((subpath) =>
expect.objectContaining({
find: `openclaw/plugin-sdk/${subpath}`,
replacement: path.join(process.cwd(), "src", "plugin-sdk", `${subpath}.ts`),
}),
),
),
);
expect(sharedVitestConfig.resolve.alias).not.toEqual(
expect.arrayContaining(
PRIVATE_PLUGIN_SDK_SUBPATHS.map((subpath) =>
expect.objectContaining({
find: `@openclaw/plugin-sdk/${subpath}`,
}),
),
),
);
});
it("defaults shared scoped configs to the non-isolated runner", () => {
expect(resolveVitestIsolation({})).toBe(false);
});

View File

@@ -1,6 +1,7 @@
import path from "node:path";
import { fileURLToPath } from "node:url";
import { pluginSdkSubpaths } from "../../scripts/lib/plugin-sdk-entries.mjs";
import privateLocalOnlyPluginSdkSubpaths from "../../scripts/lib/plugin-sdk-private-local-only-subpaths.json" with { type: "json" };
import {
detectVitestHostInfo as detectVitestHostInfoImpl,
isCiLikeEnv,
@@ -113,6 +114,9 @@ const workerConfig = resolveSharedVitestWorkerConfig({
isWindows,
localScheduling,
});
const sourcePluginSdkSubpaths = [
...new Set([...pluginSdkSubpaths, ...privateLocalOnlyPluginSdkSubpaths]),
].toSorted((left, right) => left.localeCompare(right));
if (!isCI && localScheduling.throttledBySystem && shouldPrintVitestThrottle(process.env)) {
console.error(
@@ -131,7 +135,7 @@ export const sharedVitestConfig = {
find: "openclaw/extension-api",
replacement: path.join(repoRoot, "src", "extensionAPI.ts"),
},
...pluginSdkSubpaths.map((subpath) => ({
...sourcePluginSdkSubpaths.map((subpath) => ({
find: `openclaw/plugin-sdk/${subpath}`,
replacement: path.join(repoRoot, "src", "plugin-sdk", `${subpath}.ts`),
})),