mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-01 15:00:24 +00:00
perf(test): expand light lane routing
This commit is contained in:
@@ -93,4 +93,64 @@ describe("scripts/test-projects changed-target routing", () => {
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
it("routes changed plugin-sdk source allowlist files to sibling light tests", () => {
|
||||
const plans = buildVitestRunPlans(["--changed", "origin/main"], process.cwd(), () => [
|
||||
"src/plugin-sdk/lazy-value.ts",
|
||||
]);
|
||||
|
||||
expect(plans).toEqual([
|
||||
{
|
||||
config: "vitest.plugin-sdk-light.config.ts",
|
||||
forwardedArgs: [],
|
||||
includePatterns: ["src/plugin-sdk/lazy-value.test.ts"],
|
||||
watchMode: false,
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
it("routes changed commands source allowlist files to sibling light tests", () => {
|
||||
const plans = buildVitestRunPlans(["--changed", "origin/main"], process.cwd(), () => [
|
||||
"src/commands/status-overview-values.ts",
|
||||
]);
|
||||
|
||||
expect(plans).toEqual([
|
||||
{
|
||||
config: "vitest.commands-light.config.ts",
|
||||
forwardedArgs: [],
|
||||
includePatterns: ["src/commands/status-overview-values.test.ts"],
|
||||
watchMode: false,
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
it("keeps non-allowlisted plugin-sdk source files on the heavy lane", () => {
|
||||
const plans = buildVitestRunPlans(["--changed", "origin/main"], process.cwd(), () => [
|
||||
"src/plugin-sdk/facade-runtime.ts",
|
||||
]);
|
||||
|
||||
expect(plans).toEqual([
|
||||
{
|
||||
config: "vitest.plugin-sdk.config.ts",
|
||||
forwardedArgs: [],
|
||||
includePatterns: ["src/plugin-sdk/**/*.test.ts"],
|
||||
watchMode: false,
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
it("keeps non-allowlisted commands source files on the heavy lane", () => {
|
||||
const plans = buildVitestRunPlans(["--changed", "origin/main"], process.cwd(), () => [
|
||||
"src/commands/channels.add.ts",
|
||||
]);
|
||||
|
||||
expect(plans).toEqual([
|
||||
{
|
||||
config: "vitest.commands.config.ts",
|
||||
forwardedArgs: [],
|
||||
includePatterns: ["src/commands/**/*.test.ts"],
|
||||
watchMode: false,
|
||||
},
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
43
test/vitest-light-paths.test.ts
Normal file
43
test/vitest-light-paths.test.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
isCommandsLightTarget,
|
||||
resolveCommandsLightIncludePattern,
|
||||
} from "../vitest.commands-light-paths.mjs";
|
||||
import {
|
||||
isPluginSdkLightTarget,
|
||||
resolvePluginSdkLightIncludePattern,
|
||||
} from "../vitest.plugin-sdk-paths.mjs";
|
||||
|
||||
describe("light vitest path routing", () => {
|
||||
it("maps plugin-sdk allowlist source and test files to sibling light tests", () => {
|
||||
expect(isPluginSdkLightTarget("src/plugin-sdk/lazy-value.ts")).toBe(true);
|
||||
expect(isPluginSdkLightTarget("src/plugin-sdk/lazy-value.test.ts")).toBe(true);
|
||||
expect(resolvePluginSdkLightIncludePattern("src/plugin-sdk/lazy-value.ts")).toBe(
|
||||
"src/plugin-sdk/lazy-value.test.ts",
|
||||
);
|
||||
expect(resolvePluginSdkLightIncludePattern("src/plugin-sdk/lazy-value.test.ts")).toBe(
|
||||
"src/plugin-sdk/lazy-value.test.ts",
|
||||
);
|
||||
});
|
||||
|
||||
it("keeps non-allowlisted plugin-sdk files off the light lane", () => {
|
||||
expect(isPluginSdkLightTarget("src/plugin-sdk/facade-runtime.ts")).toBe(false);
|
||||
expect(resolvePluginSdkLightIncludePattern("src/plugin-sdk/facade-runtime.ts")).toBeNull();
|
||||
});
|
||||
|
||||
it("maps commands allowlist source and test files to sibling light tests", () => {
|
||||
expect(isCommandsLightTarget("src/commands/text-format.ts")).toBe(true);
|
||||
expect(isCommandsLightTarget("src/commands/text-format.test.ts")).toBe(true);
|
||||
expect(resolveCommandsLightIncludePattern("src/commands/text-format.ts")).toBe(
|
||||
"src/commands/text-format.test.ts",
|
||||
);
|
||||
expect(resolveCommandsLightIncludePattern("src/commands/text-format.test.ts")).toBe(
|
||||
"src/commands/text-format.test.ts",
|
||||
);
|
||||
});
|
||||
|
||||
it("keeps non-allowlisted commands files off the light lane", () => {
|
||||
expect(isCommandsLightTarget("src/commands/channels.add.ts")).toBe(false);
|
||||
expect(resolveCommandsLightIncludePattern("src/commands/channels.add.ts")).toBeNull();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user