mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-06 05:51:15 +08:00
docs: document cli program tests
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
// Action reparse tests cover Commander action reparsing for nested CLI commands.
|
||||
import { Command } from "commander";
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { reparseProgramFromActionArgs } from "./action-reparse.js";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Build program tests cover root CLI program construction and command wiring.
|
||||
import process from "node:process";
|
||||
import { Command, CommanderError } from "commander";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Build program version alias tests cover version flag aliases on the root program.
|
||||
import process from "node:process";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { buildProgram } from "./build-program.js";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Command descriptor utility tests cover CLI descriptor helpers and Commander integration.
|
||||
import { Command } from "commander";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Command group descriptor tests cover grouped CLI command metadata and help organization.
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import {
|
||||
buildCommandGroupEntries,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Command registry tests cover CLI command descriptor registry behavior.
|
||||
import { Command } from "commander";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import type { ProgramContext } from "./context.js";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Command tree tests cover CLI command hierarchy construction and lookup.
|
||||
import { Command } from "commander";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { removeCommand, removeCommandByName } from "./command-tree.js";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Config guard tests cover program-level config checks before command execution.
|
||||
import fs from "node:fs";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Program context tests cover shared CLI context helpers and runtime injections.
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import { createProgramContext } from "./context.js";
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Error output tests cover program-level error display and exit messaging.
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { formatCliParseErrorOutput } from "./error-output.js";
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Help tests cover command help generation and inherited help options.
|
||||
import { Command } from "commander";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import type { ProgramContext } from "./context.js";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Program helper tests cover shared command registration and help helpers.
|
||||
import { Command } from "commander";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Message program helper tests cover message command helper behavior and mocks.
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
const messageCommandMock = vi.fn(async () => {});
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Register thread tests cover message thread command registration and option wiring.
|
||||
import { Command } from "commander";
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { setActivePluginRegistry } from "../../../plugins/runtime.js";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Parent default help tests cover parent command help fallback behavior.
|
||||
import { Command } from "commander";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { applyParentDefaultHelpAction, isParentDefaultHelpAction } from "./parent-default-help.js";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Preaction tests cover CLI preaction hooks and command context setup.
|
||||
import { Command } from "commander";
|
||||
import { repoInstallSpec } from "openclaw/plugin-sdk/test-fixtures";
|
||||
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Private QA CLI tests cover private QA command registration and filesystem behavior.
|
||||
import fs from "node:fs";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Program context tests cover command context creation and propagation.
|
||||
import { Command } from "commander";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import type { ProgramContext } from "./context.js";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Register agent tests cover agent command registration and option wiring.
|
||||
import { Command } from "commander";
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { registerAgentCommands } from "./register.agent.js";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Register backup tests cover backup command registration and option wiring.
|
||||
import { Command } from "commander";
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { registerBackupCommand } from "./register.backup.js";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Register configure tests cover configure command registration and option wiring.
|
||||
import { Command } from "commander";
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { registerConfigureCommand } from "./register.configure.js";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Register maintenance tests cover maintenance command registration in the CLI program.
|
||||
import { Command } from "commander";
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { registerMaintenanceCommands } from "./register.maintenance.js";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Register message tests cover message command registration in the CLI program.
|
||||
import { Command } from "commander";
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import type { ProgramContext } from "./context.js";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Register onboard tests cover onboarding command registration and option wiring.
|
||||
import { Command } from "commander";
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { registerOnboardCommand } from "./register.onboard.js";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Register setup tests cover setup command registration and option wiring.
|
||||
import { Command } from "commander";
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { registerSetupCommand } from "./register.setup.js";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Register status/health/session tests cover status-related command registration.
|
||||
import { Command } from "commander";
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { registerStatusHealthSessionsCommands } from "./register.status-health-sessions.js";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Register subCLI tests cover nested CLI command registration boundaries.
|
||||
import { Command } from "commander";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { registerSubCliByName, registerSubCliCommands } from "./register.subclis.js";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Register transcripts tests cover transcript command registration and file handling.
|
||||
import fs from "node:fs/promises";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Root help tests cover top-level help rendering and command visibility.
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { renderRootHelpText } from "./root-help.js";
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Route argument tests cover program route argument parsing and validation.
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
parseAgentsListRouteArgs,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Program route tests cover CLI route table registration and dispatch.
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { defaultRuntime } from "../../runtime.js";
|
||||
import { findRoutedCommand } from "./routes.js";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// SubCLI descriptor tests cover metadata for registered nested command groups.
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
async function importSubCliDescriptors() {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Plugin payload validation tests cover update payload checks for plugin updates.
|
||||
import fs from "node:fs/promises";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Post-core plugin convergence tests cover update convergence checks after core updates.
|
||||
import fs from "node:fs";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Update progress tests cover progress event formatting for update operations.
|
||||
import { describe, expect, it } from "vitest";
|
||||
import type { UpdateRunResult } from "../../infra/update-runner.js";
|
||||
import { inferUpdateFailureHints } from "./progress.js";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Restart helper tests cover update restart helper process selection and error handling.
|
||||
import { execFile, spawn, type ChildProcess } from "node:child_process";
|
||||
import fs from "node:fs/promises";
|
||||
import os from "node:os";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Shared command runner tests cover update helper command execution and error capture.
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import { defaultRuntime } from "../../runtime.js";
|
||||
import { createGlobalCommandRunner, parseTimeoutMsOrExit } from "./shared.js";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Update command tests cover update command orchestration and filesystem effects.
|
||||
import fs from "node:fs/promises";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
|
||||
Reference in New Issue
Block a user