test: isolate bundled plugin coverage from unit

This commit is contained in:
Peter Steinberger
2026-04-03 10:56:55 +01:00
parent 64755c52f2
commit 55e43cbc7f
21 changed files with 629 additions and 89 deletions

View File

@@ -78,6 +78,40 @@ describe("test planner", () => {
artifacts.cleanupTempArtifacts();
});
it("keeps bundled-plugin-dependent core tests off the default unit surface", () => {
const env = {
RUNNER_OS: "macOS",
OPENCLAW_TEST_HOST_CPU_COUNT: "10",
OPENCLAW_TEST_HOST_MEMORY_GIB: "64",
OPENCLAW_TEST_LOAD_AWARE: "0",
};
const artifacts = createExecutionArtifacts(env);
const plan = buildExecutionPlan(
{
profile: null,
mode: "local",
surfaces: ["unit", "bundled"],
passthroughArgs: [],
},
{
env,
platform: "darwin",
writeTempJsonArtifact: artifacts.writeTempJsonArtifact,
},
);
expect(plan.selectedUnits.some((unit) => unit.surface === "bundled")).toBe(true);
expect(
plan.selectedUnits
.filter((unit) => unit.surface === "unit")
.every((unit) => unit.env?.OPENCLAW_DISABLE_BUNDLED_PLUGINS === "1"),
).toBe(true);
expect(plan.selectedUnits.find((unit) => unit.surface === "bundled")?.args).toContain(
"vitest.bundled.config.ts",
);
artifacts.cleanupTempArtifacts();
});
it("uses smaller shared extension batches on constrained local hosts", () => {
const env = {
RUNNER_OS: "macOS",
@@ -491,6 +525,21 @@ describe("test planner", () => {
expect(explanation.intentProfile).toBe("normal");
});
it("routes synthetic bundled-plugin fixture tests through the bundled surface", () => {
const explanation = explainExecutionTarget(
{
mode: "local",
fileFilters: ["src/plugin-sdk/facade-runtime.test.ts"],
},
{
env: {},
},
);
expect(explanation.surface).toBe("bundled");
expect(explanation.args).toContain("vitest.bundled.config.ts");
});
it("uses hotspot-backed memory isolation when explaining unit tests", () => {
const explanation = explainExecutionTarget(
{
@@ -724,7 +773,16 @@ describe("test planner", () => {
expect(manifest.jobs.checksWindows.matrix.include).toHaveLength(6);
expect(manifest.jobs.macosNode.matrix.include).toHaveLength(9);
expect(manifest.jobs.checksFast.matrix.include).toHaveLength(
manifest.shardCounts.extensionFast + 1,
manifest.shardCounts.extensionFast + 2,
);
expect(manifest.requiredCheckNames).toContain("checks-fast-bundled");
expect(manifest.jobs.checksFast.matrix.include).toEqual(
expect.arrayContaining([
expect.objectContaining({
check_name: "checks-fast-bundled",
command: "pnpm test:bundled",
}),
]),
);
expect(
manifest.jobs.checksFast.matrix.include