mirror of
https://github.com/moltbot/moltbot.git
synced 2026-03-07 22:44:16 +00:00
test: fix gate regressions
This commit is contained in:
@@ -19,6 +19,25 @@ const unitIsolatedFilesRaw = [
|
||||
"src/auto-reply/tool-meta.test.ts",
|
||||
"src/auto-reply/envelope.test.ts",
|
||||
"src/commands/auth-choice.test.ts",
|
||||
// Process supervision + docker setup suites are stable but setup-heavy.
|
||||
"src/process/supervisor/supervisor.test.ts",
|
||||
"src/docker-setup.test.ts",
|
||||
// Filesystem-heavy skills sync suite.
|
||||
"src/agents/skills.build-workspace-skills-prompt.syncs-merged-skills-into-target-workspace.test.ts",
|
||||
// Real git hook integration test; keep signal, move off unit-fast critical path.
|
||||
"test/git-hooks-pre-commit.test.ts",
|
||||
// Setup-heavy doctor command suites; keep them off the unit-fast critical path.
|
||||
"src/commands/doctor.warns-state-directory-is-missing.test.ts",
|
||||
"src/commands/doctor.warns-per-agent-sandbox-docker-browser-prune.test.ts",
|
||||
"src/commands/doctor.runs-legacy-state-migrations-yes-mode-without.test.ts",
|
||||
// Setup-heavy CLI update flow suite; move off unit-fast critical path.
|
||||
"src/cli/update-cli.test.ts",
|
||||
// Expensive schema build/bootstrap checks; keep coverage but run in isolated lane.
|
||||
"src/config/schema.test.ts",
|
||||
"src/config/schema.tags.test.ts",
|
||||
// CLI smoke/agent flows are stable but setup-heavy.
|
||||
"src/cli/program.smoke.test.ts",
|
||||
"src/commands/agent.test.ts",
|
||||
"src/media/store.test.ts",
|
||||
"src/media/store.header-ext.test.ts",
|
||||
"src/web/media.test.ts",
|
||||
@@ -210,7 +229,7 @@ const defaultWorkerBudget =
|
||||
unit: Math.max(4, Math.min(14, Math.floor((localWorkers * 7) / 8))),
|
||||
unitIsolated: Math.max(1, Math.min(2, Math.floor(localWorkers / 6) || 1)),
|
||||
extensions: Math.max(1, Math.min(4, Math.floor(localWorkers / 4))),
|
||||
gateway: Math.max(2, Math.min(4, Math.floor(localWorkers / 3))),
|
||||
gateway: Math.max(2, Math.min(6, Math.floor(localWorkers / 2))),
|
||||
}
|
||||
: lowMemLocalHost
|
||||
? {
|
||||
|
||||
@@ -112,7 +112,7 @@ async function runReasoningDefaultCase(params: {
|
||||
describe("directive behavior", () => {
|
||||
installDirectiveBehaviorE2EHooks();
|
||||
|
||||
it("shows /think defaults for reasoning and non-reasoning models", async () => {
|
||||
it("covers /think status and reasoning defaults for reasoning and non-reasoning models", async () => {
|
||||
await withTempHome(async (home) => {
|
||||
await expectThinkStatusForReasoningModel({
|
||||
home,
|
||||
@@ -125,6 +125,25 @@ describe("directive behavior", () => {
|
||||
expectedLevel: "off",
|
||||
});
|
||||
expect(runEmbeddedPiAgent).not.toHaveBeenCalled();
|
||||
|
||||
vi.mocked(runEmbeddedPiAgent).mockClear();
|
||||
|
||||
for (const scenario of [
|
||||
{
|
||||
expectedThinkLevel: "low" as const,
|
||||
expectedReasoningLevel: "off" as const,
|
||||
},
|
||||
{
|
||||
expectedThinkLevel: "off" as const,
|
||||
expectedReasoningLevel: "on" as const,
|
||||
thinkingDefault: "off" as const,
|
||||
},
|
||||
]) {
|
||||
await runReasoningDefaultCase({
|
||||
home,
|
||||
...scenario,
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
it("renders model list and status variants across catalog/config combinations", async () => {
|
||||
@@ -282,26 +301,6 @@ describe("directive behavior", () => {
|
||||
expect(runEmbeddedPiAgent).toHaveBeenCalledOnce();
|
||||
});
|
||||
});
|
||||
it("applies reasoning defaults based on thinkingDefault configuration", async () => {
|
||||
await withTempHome(async (home) => {
|
||||
for (const scenario of [
|
||||
{
|
||||
expectedThinkLevel: "low" as const,
|
||||
expectedReasoningLevel: "off" as const,
|
||||
},
|
||||
{
|
||||
expectedThinkLevel: "off" as const,
|
||||
expectedReasoningLevel: "on" as const,
|
||||
thinkingDefault: "off" as const,
|
||||
},
|
||||
]) {
|
||||
await runReasoningDefaultCase({
|
||||
home,
|
||||
...scenario,
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
it("passes elevated defaults when sender is approved", async () => {
|
||||
await withTempHome(async (home) => {
|
||||
mockEmbeddedTextResult("done");
|
||||
|
||||
@@ -64,14 +64,16 @@ describe("browser control server", () => {
|
||||
});
|
||||
expect(nav.ok).toBe(true);
|
||||
expect(typeof nav.targetId).toBe("string");
|
||||
expect(pwMocks.navigateViaPlaywright).toHaveBeenCalledWith({
|
||||
cdpUrl: state.cdpBaseUrl,
|
||||
targetId: "abcd1234",
|
||||
url: "https://example.com",
|
||||
ssrfPolicy: {
|
||||
dangerouslyAllowPrivateNetwork: true,
|
||||
},
|
||||
});
|
||||
expect(pwMocks.navigateViaPlaywright).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
cdpUrl: state.cdpBaseUrl,
|
||||
targetId: "abcd1234",
|
||||
url: "https://example.com",
|
||||
ssrfPolicy: {
|
||||
dangerouslyAllowPrivateNetwork: true,
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
const click = await postJson<{ ok: boolean }>(`${base}/act`, {
|
||||
kind: "click",
|
||||
|
||||
@@ -636,14 +636,6 @@ describe("update-cli", () => {
|
||||
}
|
||||
});
|
||||
|
||||
it("updateCommand skips restart when --no-restart is set", async () => {
|
||||
vi.mocked(runGatewayUpdate).mockResolvedValue(makeOkUpdateResult());
|
||||
|
||||
await updateCommand({ restart: false });
|
||||
|
||||
expect(runDaemonRestart).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("updateCommand skips success message when restart does not run", async () => {
|
||||
vi.mocked(runGatewayUpdate).mockResolvedValue(makeOkUpdateResult());
|
||||
vi.mocked(runDaemonRestart).mockResolvedValue(false);
|
||||
|
||||
@@ -134,7 +134,7 @@ describe("config io write", () => {
|
||||
logger: silentLogger,
|
||||
});
|
||||
|
||||
const invalidConfig = {
|
||||
const invalidConfig: OpenClawConfig = {
|
||||
channels: {
|
||||
telegram: {
|
||||
dmPolicy: "open",
|
||||
|
||||
@@ -105,12 +105,12 @@ describe("runCommandWithTimeout", () => {
|
||||
"clearInterval(ticker);",
|
||||
"process.exit(0);",
|
||||
"}",
|
||||
"}, 40);",
|
||||
"}, 12);",
|
||||
].join(" "),
|
||||
],
|
||||
{
|
||||
timeoutMs: 5_000,
|
||||
noOutputTimeoutMs: 1_500,
|
||||
noOutputTimeoutMs: 120,
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user