mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-28 10:22:32 +00:00
CI: bound extension-fast smoke scope and enforce SLA
This commit is contained in:
@@ -8,13 +8,17 @@ import {
|
||||
} from "../../scripts/test-extension.mjs";
|
||||
|
||||
const scriptPath = path.join(process.cwd(), "scripts", "test-extension.mjs");
|
||||
type DryRunPlan = ReturnType<typeof resolveExtensionTestPlan> & {
|
||||
maxTests?: number;
|
||||
selectedTestFiles: string[];
|
||||
};
|
||||
|
||||
function readPlan(args: string[], cwd = process.cwd()) {
|
||||
const stdout = execFileSync(process.execPath, [scriptPath, ...args, "--dry-run", "--json"], {
|
||||
cwd,
|
||||
encoding: "utf8",
|
||||
});
|
||||
return JSON.parse(stdout) as ReturnType<typeof resolveExtensionTestPlan>;
|
||||
return JSON.parse(stdout) as DryRunPlan;
|
||||
}
|
||||
|
||||
function findZeroTestExtensionId(): string | undefined {
|
||||
@@ -90,5 +94,14 @@ describe("scripts/test-extension.mjs", () => {
|
||||
const plan = readPlan([extensionId!, "--allow-empty"]);
|
||||
expect(plan.extensionId).toBe(extensionId);
|
||||
expect(plan.testFiles).toHaveLength(0);
|
||||
expect(plan.selectedTestFiles).toHaveLength(0);
|
||||
});
|
||||
|
||||
it("limits selected tests when --max-tests is passed", () => {
|
||||
const plan = readPlan(["discord", "--allow-empty", "--max-tests", "1"]);
|
||||
expect(plan.extensionId).toBe("discord");
|
||||
expect(plan.testFiles.length).toBeGreaterThan(1);
|
||||
expect(plan.selectedTestFiles).toHaveLength(1);
|
||||
expect(plan.maxTests).toBe(1);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user