mirror of
https://github.com/modelstudioai/cli.git
synced 2026-09-14 19:49:23 +08:00
test(e2e): align with UsageError validation contract
Missing required flags now throw UsageError (exit code 2, error on stderr, JSON under --output json) instead of printing help and exiting 0. Update assertions and titles accordingly: - missing-flag cases: exitCode 0/1 -> 2, retitle to "errors as usage error (2)" - auth / video-task-get under --output json: assert the error JSON on stderr - proxy probe: import setupProxyFromEnv from runtime/src/proxy.ts - drop tests for the removed config export-schema command - fix t2v dry-run: cliTimeoutPrefix misplaced between --model and its value
This commit is contained in:
@@ -16,13 +16,13 @@ describe("e2e: advisor recommend", () => {
|
||||
});
|
||||
|
||||
describe.skipIf(!isDashScopeE2EReady())("e2e: advisor recommend (DashScope)", () => {
|
||||
test("advisor recommend without --message prints help and exits", async () => {
|
||||
test("advisor recommend without --message errors as usage error (2)", async () => {
|
||||
const { stdout, stderr, exitCode } = await runCli([
|
||||
"advisor",
|
||||
"recommend",
|
||||
"--non-interactive",
|
||||
]);
|
||||
expect(exitCode).toBe(0);
|
||||
expect(exitCode).toBe(2);
|
||||
expect(`${stdout}\n${stderr}`).toMatch(/--message|Usage:/i);
|
||||
});
|
||||
|
||||
|
||||
@@ -32,9 +32,9 @@ describe("e2e: auth", () => {
|
||||
expect(stderr).toMatch(/status|output/i);
|
||||
});
|
||||
|
||||
test("auth login 缺少 --api-key 时打印子命令帮助并退出 (0)", async () => {
|
||||
test("auth login 缺少 --api-key 时报用法错误并退出 (2)", async () => {
|
||||
const { stderr, exitCode } = await runCli(["auth", "login", "--non-interactive"]);
|
||||
expect(exitCode, stderr).toBe(0);
|
||||
expect(exitCode, stderr).toBe(2);
|
||||
expect(stderr).toMatch(/--api-key|Usage:/i);
|
||||
});
|
||||
|
||||
@@ -69,7 +69,7 @@ describe("e2e: auth", () => {
|
||||
expect(stdout).toContain("Would validate and save API key.");
|
||||
});
|
||||
|
||||
test("auth login 缺少密钥且 --output json 时仍打印子命令帮助 (0)", async () => {
|
||||
test("auth login 缺少密钥且 --output json 时报用法错误并退出 (2)", async () => {
|
||||
const { stderr, exitCode } = await runCli([
|
||||
"auth",
|
||||
"login",
|
||||
@@ -77,8 +77,10 @@ describe("e2e: auth", () => {
|
||||
"--output",
|
||||
"json",
|
||||
]);
|
||||
expect(exitCode).toBe(0);
|
||||
expect(stderr).toMatch(/--api-key|Usage:/i);
|
||||
expect(exitCode).toBe(2);
|
||||
const err = JSON.parse(stderr.trim()) as { error?: { code?: number; message?: string } };
|
||||
expect(err.error?.code).toBe(2);
|
||||
expect(err.error?.message).toMatch(/--api-key|console/i);
|
||||
});
|
||||
|
||||
test("auth logout --dry-run 不写入配置", async () => {
|
||||
|
||||
@@ -10,7 +10,7 @@ describe("e2e: config", () => {
|
||||
const { stdout, stderr, exitCode } = await runCli(["config"]);
|
||||
expect(exitCode, stderr).toBe(0);
|
||||
const out = `${stdout}\n${stderr}`;
|
||||
expect(out).toMatch(/config|show|set|export-schema/i);
|
||||
expect(out).toMatch(/config|show|set/i);
|
||||
});
|
||||
|
||||
test("config show --help 正常退出", async () => {
|
||||
@@ -25,12 +25,6 @@ describe("e2e: config", () => {
|
||||
expect(stderr).toMatch(/set|--key|--value/i);
|
||||
});
|
||||
|
||||
test("config export-schema --help 正常退出", async () => {
|
||||
const { stderr, exitCode } = await runCli(["config", "export-schema", "--help"]);
|
||||
expect(exitCode, stderr).toBe(0);
|
||||
expect(stderr).toMatch(/export-schema|--command/i);
|
||||
});
|
||||
|
||||
test("config show --output json", async () => {
|
||||
const { stdout, stderr, exitCode } = await runCli([
|
||||
"config",
|
||||
@@ -63,9 +57,9 @@ describe("e2e: config", () => {
|
||||
expect(stdout).toMatch(/config_file|timeout|base_url/i);
|
||||
});
|
||||
|
||||
test("config set 缺少 --key / --value 时打印子命令帮助并退出 (0)", async () => {
|
||||
test("config set 缺少 --key / --value 时报用法错误并退出 (2)", async () => {
|
||||
const { stderr, exitCode } = await runCli(["config", "set", "--non-interactive"]);
|
||||
expect(exitCode, stderr).toBe(0);
|
||||
expect(exitCode, stderr).toBe(2);
|
||||
expect(stderr).toMatch(/--key|--value|Usage:/i);
|
||||
});
|
||||
|
||||
@@ -146,46 +140,4 @@ describe("e2e: config", () => {
|
||||
const data = parseStdoutJson<{ would_set?: { default_text_model?: string } }>(stdout);
|
||||
expect(data.would_set?.default_text_model).toBe("qwen3.7-max");
|
||||
});
|
||||
|
||||
test("config export-schema --command 导出单条工具 JSON", async () => {
|
||||
const { stdout, stderr, exitCode } = await runCli([
|
||||
"config",
|
||||
"export-schema",
|
||||
"--command",
|
||||
"text chat",
|
||||
"--non-interactive",
|
||||
]);
|
||||
expect(exitCode, stderr).toBe(0);
|
||||
const schema = parseStdoutJson<{ name?: string; input_schema?: { type?: string } }>(stdout);
|
||||
expect(schema.name).toMatch(/bailian_text_chat/);
|
||||
expect(schema.input_schema?.type).toBe("object");
|
||||
});
|
||||
|
||||
test("config export-schema 不存在的子命令时报错", async () => {
|
||||
const { stderr, exitCode } = await runCli([
|
||||
"config",
|
||||
"export-schema",
|
||||
"--command",
|
||||
"this-command-does-not-exist-xyz",
|
||||
"--non-interactive",
|
||||
"--output",
|
||||
"json",
|
||||
]);
|
||||
expect(exitCode).toBe(2);
|
||||
const err = JSON.parse(stderr.trim()) as { error?: { message?: string } };
|
||||
expect(err.error?.message).toMatch(/not found/i);
|
||||
});
|
||||
|
||||
test("config export-schema 导出全部为 JSON 数组", async () => {
|
||||
const { stdout, stderr, exitCode } = await runCli([
|
||||
"config",
|
||||
"export-schema",
|
||||
"--non-interactive",
|
||||
]);
|
||||
expect(exitCode, stderr).toBe(0);
|
||||
const arr = parseStdoutJson<Array<{ name?: string }>>(stdout);
|
||||
expect(Array.isArray(arr)).toBe(true);
|
||||
expect(arr.length).toBeGreaterThan(0);
|
||||
expect(arr[0]?.name).toMatch(/^bailian_/);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -25,7 +25,7 @@ describe("e2e: file upload", () => {
|
||||
});
|
||||
|
||||
describe.skipIf(!isDashScopeE2EReady())("e2e: file upload(DashScope)", () => {
|
||||
test("file upload 缺少 --file 时打印子命令帮助并退出 (0)", async () => {
|
||||
test("file upload 缺少 --file 时报用法错误并退出 (2)", async () => {
|
||||
const { stderr, exitCode } = await runCli([
|
||||
"file",
|
||||
"upload",
|
||||
@@ -33,11 +33,11 @@ describe.skipIf(!isDashScopeE2EReady())("e2e: file upload(DashScope)", () =>
|
||||
"qwen3-vl-plus",
|
||||
"--non-interactive",
|
||||
]);
|
||||
expect(exitCode).toBe(0);
|
||||
expect(exitCode).toBe(2);
|
||||
expect(stderr).toMatch(/--file|Usage:/i);
|
||||
});
|
||||
|
||||
test("file upload 缺少 --model 时打印子命令帮助并退出 (0)", async () => {
|
||||
test("file upload 缺少 --model 时报用法错误并退出 (2)", async () => {
|
||||
const testFile = join(__dirname, ".smoke-32.png");
|
||||
const { stderr, exitCode } = await runCli([
|
||||
"file",
|
||||
@@ -46,7 +46,7 @@ describe.skipIf(!isDashScopeE2EReady())("e2e: file upload(DashScope)", () =>
|
||||
testFile,
|
||||
"--non-interactive",
|
||||
]);
|
||||
expect(exitCode).toBe(0);
|
||||
expect(exitCode).toBe(2);
|
||||
expect(stderr).toMatch(/--model|Usage:/i);
|
||||
});
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ describe("e2e: image edit", () => {
|
||||
});
|
||||
|
||||
describe.skipIf(!isBailianE2EMediaEnabled() || !isDashScopeE2EReady())("e2e: image edit", () => {
|
||||
test("image edit 缺少 --image 时打印子命令帮助并退出 (0)", async () => {
|
||||
test("image edit 缺少 --image 时报用法错误并退出 (2)", async () => {
|
||||
const { stderr, exitCode } = await runCli([
|
||||
"image",
|
||||
"edit",
|
||||
@@ -40,11 +40,11 @@ describe.skipIf(!isBailianE2EMediaEnabled() || !isDashScopeE2EReady())("e2e: ima
|
||||
"仅提示词",
|
||||
"--non-interactive",
|
||||
]);
|
||||
expect(exitCode).toBe(0);
|
||||
expect(exitCode).toBe(2);
|
||||
expect(stderr).toMatch(/--image|Usage:/i);
|
||||
});
|
||||
|
||||
test("image edit 缺少 --prompt 时打印子命令帮助并退出 (0)", async () => {
|
||||
test("image edit 缺少 --prompt 时报用法错误并退出 (2)", async () => {
|
||||
const testPng = join(__dirname, ".smoke-32.png");
|
||||
const { stderr, exitCode } = await runCli([
|
||||
"image",
|
||||
@@ -53,7 +53,7 @@ describe.skipIf(!isBailianE2EMediaEnabled() || !isDashScopeE2EReady())("e2e: ima
|
||||
testPng,
|
||||
"--non-interactive",
|
||||
]);
|
||||
expect(exitCode).toBe(0);
|
||||
expect(exitCode).toBe(2);
|
||||
expect(stderr).toMatch(/--prompt|Usage:/i);
|
||||
});
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ describe("e2e: image generate", () => {
|
||||
describe.skipIf(!isBailianE2EMediaEnabled() || !isDashScopeE2EReady())(
|
||||
"e2e: image generate",
|
||||
() => {
|
||||
test("image generate 缺少 --prompt 时打印子命令帮助并退出 (0)", async () => {
|
||||
test("image generate 缺少 --prompt 时报用法错误并退出 (2)", async () => {
|
||||
const { stderr, exitCode } = await runCli([
|
||||
"image",
|
||||
"generate",
|
||||
@@ -40,7 +40,7 @@ describe.skipIf(!isBailianE2EMediaEnabled() || !isDashScopeE2EReady())(
|
||||
"qwen-image-2.0",
|
||||
"--non-interactive",
|
||||
]);
|
||||
expect(exitCode).toBe(0);
|
||||
expect(exitCode).toBe(2);
|
||||
expect(stderr).toMatch(/--prompt|Usage:/i);
|
||||
});
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ describe("e2e: knowledge retrieve", () => {
|
||||
expect(stderr).toMatch(/deprecated/i);
|
||||
});
|
||||
|
||||
test("缺少 --index-id 时打印帮助并退出 (0)", async () => {
|
||||
test("缺少 --index-id 时报用法错误并退出 (2)", async () => {
|
||||
const { stderr, exitCode } = await runCli([
|
||||
"knowledge",
|
||||
"retrieve",
|
||||
@@ -45,11 +45,11 @@ describe("e2e: knowledge retrieve", () => {
|
||||
"test",
|
||||
"--non-interactive",
|
||||
]);
|
||||
expect(exitCode).toBe(0);
|
||||
expect(exitCode).toBe(2);
|
||||
expect(stderr).toMatch(/--index-id|Usage:/i);
|
||||
});
|
||||
|
||||
test("缺少 --query 时打印帮助并退出 (0)", async () => {
|
||||
test("缺少 --query 时报用法错误并退出 (2)", async () => {
|
||||
const { stderr, exitCode } = await runCli([
|
||||
"knowledge",
|
||||
"retrieve",
|
||||
@@ -57,7 +57,7 @@ describe("e2e: knowledge retrieve", () => {
|
||||
"idx_test",
|
||||
"--non-interactive",
|
||||
]);
|
||||
expect(exitCode).toBe(0);
|
||||
expect(exitCode).toBe(2);
|
||||
expect(stderr).toMatch(/--query|Usage:/i);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -142,9 +142,9 @@ describe("e2e: mcp", () => {
|
||||
expect(data.url).toBe("https://example.com/custom/mcp");
|
||||
});
|
||||
|
||||
test("mcp tools 缺少 --server 时打印子命令帮助并退出 (0)", async () => {
|
||||
test("mcp tools 缺少 --server 时报用法错误并退出 (2)", async () => {
|
||||
const { stderr, exitCode } = await runCli(["mcp", "tools", "--non-interactive"]);
|
||||
expect(exitCode, stderr).toBe(0);
|
||||
expect(exitCode, stderr).toBe(2);
|
||||
expect(stderr).toMatch(/--server|Usage:/i);
|
||||
});
|
||||
|
||||
@@ -258,9 +258,9 @@ describe("e2e: mcp", () => {
|
||||
expect(stderr).toMatch(/--json is not valid JSON|--json must decode/);
|
||||
});
|
||||
|
||||
test("mcp call 缺少 --target 时打印子命令帮助并退出 (0)", async () => {
|
||||
test("mcp call 缺少 --target 时报用法错误并退出 (2)", async () => {
|
||||
const { stderr, exitCode } = await runCli(["mcp", "call", "--non-interactive"]);
|
||||
expect(exitCode, stderr).toBe(0);
|
||||
expect(exitCode, stderr).toBe(2);
|
||||
expect(stderr).toMatch(/--target|Usage:/i);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -69,7 +69,7 @@ describe("e2e: memory", () => {
|
||||
describe.skipIf(!isBailianE2EEnabled() || !isDashScopeE2EReady())(
|
||||
"e2e: memory CRUD + search",
|
||||
() => {
|
||||
test("memory add 缺少 --user-id 时打印子命令帮助并退出 (0)", async () => {
|
||||
test("memory add 缺少 --user-id 时报用法错误并退出 (2)", async () => {
|
||||
const { stderr, exitCode } = await runCli([
|
||||
"memory",
|
||||
"add",
|
||||
@@ -78,7 +78,7 @@ describe.skipIf(!isBailianE2EEnabled() || !isDashScopeE2EReady())(
|
||||
"仅内容无用户",
|
||||
"--non-interactive",
|
||||
]);
|
||||
expect(exitCode).toBe(0);
|
||||
expect(exitCode).toBe(2);
|
||||
expect(stderr).toMatch(/--user-id|Usage:/i);
|
||||
});
|
||||
|
||||
@@ -92,7 +92,7 @@ describe.skipIf(!isBailianE2EEnabled() || !isDashScopeE2EReady())(
|
||||
userId,
|
||||
"--non-interactive",
|
||||
]);
|
||||
expect(exitCode).toBe(1);
|
||||
expect(exitCode).toBe(2);
|
||||
expect(stderr).toMatch(/messages|content|required/i);
|
||||
});
|
||||
|
||||
|
||||
@@ -20,14 +20,14 @@ describe("e2e: omni", () => {
|
||||
describe.skipIf(!isBailianE2EMediaEnabled() || !isDashScopeE2EReady())(
|
||||
"e2e: omni(DashScope 媒体)",
|
||||
() => {
|
||||
test("omni 缺少 --message 时打印子命令帮助并退出 (0)", async () => {
|
||||
test("omni 缺少 --message 时报用法错误并退出 (2)", async () => {
|
||||
const { stderr, exitCode } = await runCli([
|
||||
"omni",
|
||||
"--model",
|
||||
"qwen3.5-omni-flash",
|
||||
"--non-interactive",
|
||||
]);
|
||||
expect(exitCode).toBe(0);
|
||||
expect(exitCode).toBe(2);
|
||||
expect(stderr).toMatch(/--message|Usage:/i);
|
||||
});
|
||||
|
||||
|
||||
@@ -127,9 +127,9 @@ describe("e2e: pipeline", () => {
|
||||
expect(data.issues?.join("\n")).toMatch(/pipeline graph contains cycle/i);
|
||||
});
|
||||
|
||||
test("pipeline run 缺少 --file 时打印子命令帮助并退出 (0)", async () => {
|
||||
test("pipeline run 缺少 --file 时报用法错误并退出 (2)", async () => {
|
||||
const { stderr, exitCode } = await runCli(["pipeline", "run", "--non-interactive"]);
|
||||
expect(exitCode, stderr).toBe(0);
|
||||
expect(exitCode, stderr).toBe(2);
|
||||
expect(stderr).toMatch(/Usage: bl pipeline run --file <path>|--file/i);
|
||||
});
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ const FAKE_URL = `https://${FAKE_HOST}/probe`;
|
||||
* 代理行为由进程环境变量决定,正是被测对象;fetch 成败不重要,我们只看代理是否收到 CONNECT。
|
||||
*/
|
||||
const PROBE_SCRIPT = `
|
||||
import { setupProxyFromEnv } from ${JSON.stringify(join(cliPackageRoot, "src", "proxy.ts"))};
|
||||
import { setupProxyFromEnv } from ${JSON.stringify(join(cliPackageRoot, "..", "runtime", "src", "proxy.ts"))};
|
||||
setupProxyFromEnv();
|
||||
try {
|
||||
await fetch(${JSON.stringify(FAKE_URL)}, { signal: AbortSignal.timeout(5000) });
|
||||
|
||||
@@ -43,9 +43,9 @@ describe("e2e: search web", () => {
|
||||
});
|
||||
|
||||
describe.skipIf(!isDashScopeE2EReady())("e2e: search web", () => {
|
||||
test("search web 缺少 --query 时打印子命令帮助并退出 (0)", async () => {
|
||||
test("search web 缺少 --query 时报用法错误并退出 (2)", async () => {
|
||||
const { stderr, exitCode } = await runCli(["search", "web", "--non-interactive"]);
|
||||
expect(exitCode).toBe(0);
|
||||
expect(exitCode).toBe(2);
|
||||
expect(stderr).toMatch(/--query|Usage:/i);
|
||||
});
|
||||
|
||||
|
||||
@@ -27,9 +27,9 @@ describe("e2e: speech list-voices", () => {
|
||||
});
|
||||
|
||||
describe.skipIf(!isDashScopeE2EReady())("e2e: speech list-voices", () => {
|
||||
test("speech synthesize 缺少 --text 且非 --list-voices 时打印子命令帮助并退出 (0)", async () => {
|
||||
test("speech synthesize 缺少 --text 且非 --list-voices 时报用法错误并退出 (2)", async () => {
|
||||
const { stderr, exitCode } = await runCli(["speech", "synthesize", "--non-interactive"]);
|
||||
expect(exitCode).toBe(0);
|
||||
expect(exitCode).toBe(2);
|
||||
expect(stderr).toMatch(/--text|Usage:/i);
|
||||
});
|
||||
|
||||
|
||||
@@ -31,9 +31,9 @@ describe("e2e: speech recognize", () => {
|
||||
describe.skipIf(!isBailianE2EMediaEnabled() || !isDashScopeE2EReady())(
|
||||
"e2e: speech recognize(DashScope 媒体)",
|
||||
() => {
|
||||
test("speech recognize 缺少 --url 时打印子命令帮助并退出 (0)", async () => {
|
||||
test("speech recognize 缺少 --url 时报用法错误并退出 (2)", async () => {
|
||||
const { stderr, exitCode } = await runCli(["speech", "recognize", "--non-interactive"]);
|
||||
expect(exitCode).toBe(0);
|
||||
expect(exitCode).toBe(2);
|
||||
expect(stderr).toMatch(/--url|Usage:/i);
|
||||
});
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ describe("e2e: speech synthesize", () => {
|
||||
describe.skipIf(!isBailianE2EMediaEnabled() || !isDashScopeE2EReady())(
|
||||
"e2e: speech synthesize(DashScope 媒体)",
|
||||
() => {
|
||||
test("speech synthesize 缺少 --text 时打印子命令帮助并退出 (0)", async () => {
|
||||
test("speech synthesize 缺少 --text 时报用法错误并退出 (2)", async () => {
|
||||
const { stderr, exitCode } = await runCli([
|
||||
"speech",
|
||||
"synthesize",
|
||||
@@ -40,7 +40,7 @@ describe.skipIf(!isBailianE2EMediaEnabled() || !isDashScopeE2EReady())(
|
||||
"longxiaochun_v3",
|
||||
"--non-interactive",
|
||||
]);
|
||||
expect(exitCode).toBe(0);
|
||||
expect(exitCode).toBe(2);
|
||||
expect(stderr).toMatch(/--text|Usage:/i);
|
||||
});
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ describe("e2e: text chat", () => {
|
||||
});
|
||||
|
||||
describe.skipIf(!isDashScopeE2EReady())("e2e: text chat(DashScope)", () => {
|
||||
test("text chat 缺少 --message 时打印子命令帮助并退出 (0)", async () => {
|
||||
test("text chat 缺少 --message 时报用法错误并退出 (2)", async () => {
|
||||
const { stderr, exitCode } = await runCli([
|
||||
"text",
|
||||
"chat",
|
||||
@@ -28,7 +28,7 @@ describe.skipIf(!isDashScopeE2EReady())("e2e: text chat(DashScope)", () => {
|
||||
"qwen3.7-max",
|
||||
"--non-interactive",
|
||||
]);
|
||||
expect(exitCode).toBe(0);
|
||||
expect(exitCode).toBe(2);
|
||||
expect(stderr).toMatch(/--message|Usage:/i);
|
||||
});
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ describe("e2e: video download", () => {
|
||||
describe.skipIf(!isBailianE2EVideoEnabled() || !isDashScopeE2EReady())(
|
||||
"e2e: video download(DashScope 视频)",
|
||||
() => {
|
||||
test("video download 缺少 --task-id 时打印子命令帮助并退出 (0)", async () => {
|
||||
test("video download 缺少 --task-id 时报用法错误并退出 (2)", async () => {
|
||||
const { stderr, exitCode } = await runCli([
|
||||
"video",
|
||||
"download",
|
||||
@@ -44,11 +44,11 @@ describe.skipIf(!isBailianE2EVideoEnabled() || !isDashScopeE2EReady())(
|
||||
"/tmp/will-not-be-used.mp4",
|
||||
"--non-interactive",
|
||||
]);
|
||||
expect(exitCode).toBe(0);
|
||||
expect(exitCode).toBe(2);
|
||||
expect(stderr).toMatch(/--task-id|Usage:/i);
|
||||
});
|
||||
|
||||
test("video download 缺少 --out 时打印子命令帮助并退出 (0)", async () => {
|
||||
test("video download 缺少 --out 时报用法错误并退出 (2)", async () => {
|
||||
const { stderr, exitCode } = await runCli([
|
||||
"video",
|
||||
"download",
|
||||
@@ -56,7 +56,7 @@ describe.skipIf(!isBailianE2EVideoEnabled() || !isDashScopeE2EReady())(
|
||||
PLACEHOLDER_TASK_ID,
|
||||
"--non-interactive",
|
||||
]);
|
||||
expect(exitCode).toBe(0);
|
||||
expect(exitCode).toBe(2);
|
||||
expect(stderr).toMatch(/--out|Usage:/i);
|
||||
});
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ describe("e2e: video edit", () => {
|
||||
describe.skipIf(!isBailianE2EVideoEnabled() || !isDashScopeE2EReady())(
|
||||
"e2e: video edit(DashScope 视频)",
|
||||
() => {
|
||||
test("video edit 缺少 --video 时打印子命令帮助并退出 (0)", async () => {
|
||||
test("video edit 缺少 --video 时报用法错误并退出 (2)", async () => {
|
||||
const { stderr, exitCode } = await runCli([
|
||||
"video",
|
||||
"edit",
|
||||
@@ -42,7 +42,7 @@ describe.skipIf(!isBailianE2EVideoEnabled() || !isDashScopeE2EReady())(
|
||||
"仅提示词",
|
||||
"--non-interactive",
|
||||
]);
|
||||
expect(exitCode).toBe(0);
|
||||
expect(exitCode).toBe(2);
|
||||
expect(stderr).toMatch(/--video|Usage:/i);
|
||||
});
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ describe("e2e: video generate (i2v)", () => {
|
||||
describe.skipIf(!isBailianE2EVideoEnabled() || !isDashScopeE2EReady())(
|
||||
"e2e: video generate (i2v)(DashScope 视频)",
|
||||
() => {
|
||||
test("video generate 缺少 --prompt 时打印子命令帮助并退出 (0)", async () => {
|
||||
test("video generate 缺少 --prompt 时报用法错误并退出 (2)", async () => {
|
||||
const { stderr, exitCode } = await runCli([
|
||||
"video",
|
||||
"generate",
|
||||
@@ -42,7 +42,7 @@ describe.skipIf(!isBailianE2EVideoEnabled() || !isDashScopeE2EReady())(
|
||||
"https://example.com/placeholder.png",
|
||||
"--non-interactive",
|
||||
]);
|
||||
expect(exitCode).toBe(0);
|
||||
expect(exitCode).toBe(2);
|
||||
expect(stderr).toMatch(/--prompt|Usage:/i);
|
||||
});
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ describe("e2e: video generate (t2v)", () => {
|
||||
describe.skipIf(!isBailianE2EVideoEnabled() || !isDashScopeE2EReady())(
|
||||
"e2e: video generate (t2v)(DashScope 视频)",
|
||||
() => {
|
||||
test("video generate 缺少 --prompt 时打印子命令帮助并退出 (0)", async () => {
|
||||
test("video generate 缺少 --prompt 时报用法错误并退出 (2)", async () => {
|
||||
const { stderr, exitCode } = await runCli([
|
||||
"video",
|
||||
"generate",
|
||||
@@ -40,7 +40,7 @@ describe.skipIf(!isBailianE2EVideoEnabled() || !isDashScopeE2EReady())(
|
||||
"happyhorse-1.0-t2v",
|
||||
"--non-interactive",
|
||||
]);
|
||||
expect(exitCode).toBe(0);
|
||||
expect(exitCode).toBe(2);
|
||||
expect(stderr).toMatch(/--prompt|Usage:/i);
|
||||
});
|
||||
|
||||
@@ -49,8 +49,8 @@ describe.skipIf(!isBailianE2EVideoEnabled() || !isDashScopeE2EReady())(
|
||||
"video",
|
||||
"generate",
|
||||
"--dry-run",
|
||||
"--model",
|
||||
...cliTimeoutPrefix(),
|
||||
"--model",
|
||||
"happyhorse-1.0-t2v",
|
||||
"--prompt",
|
||||
"干跑校验",
|
||||
|
||||
@@ -31,7 +31,7 @@ describe("e2e: video ref (r2v)", () => {
|
||||
describe.skipIf(!isBailianE2EVideoEnabled() || !isDashScopeE2EReady())(
|
||||
"e2e: video ref (r2v)(DashScope 视频)",
|
||||
() => {
|
||||
test("video ref 缺少 --prompt 时打印子命令帮助并退出 (0)", async () => {
|
||||
test("video ref 缺少 --prompt 时报用法错误并退出 (2)", async () => {
|
||||
const { stderr, exitCode } = await runCli([
|
||||
"video",
|
||||
"ref",
|
||||
@@ -42,7 +42,7 @@ describe.skipIf(!isBailianE2EVideoEnabled() || !isDashScopeE2EReady())(
|
||||
"https://example.com/x.png",
|
||||
"--non-interactive",
|
||||
]);
|
||||
expect(exitCode).toBe(0);
|
||||
expect(exitCode).toBe(2);
|
||||
expect(stderr).toMatch(/--prompt|Usage:/i);
|
||||
});
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ describe("e2e: video task get", () => {
|
||||
describe.skipIf(!isBailianE2EEnabled() || !taskId || !isDashScopeE2EReady())(
|
||||
"e2e: video task get(DashScope)",
|
||||
() => {
|
||||
test("video task get 缺少 --task-id 时打印子命令帮助并退出 (0)", async () => {
|
||||
test("video task get 缺少 --task-id 时报用法错误并退出 (2)", async () => {
|
||||
const { stderr, exitCode } = await runCli([
|
||||
"video",
|
||||
"task",
|
||||
@@ -33,8 +33,10 @@ describe.skipIf(!isBailianE2EEnabled() || !taskId || !isDashScopeE2EReady())(
|
||||
"--output",
|
||||
"json",
|
||||
]);
|
||||
expect(exitCode).toBe(0);
|
||||
expect(stderr).toMatch(/--task-id|Usage:/i);
|
||||
expect(exitCode).toBe(2);
|
||||
const err = JSON.parse(stderr.trim()) as { error?: { code?: number; message?: string } };
|
||||
expect(err.error?.code).toBe(2);
|
||||
expect(err.error?.message).toMatch(/--task-id/i);
|
||||
});
|
||||
|
||||
test("video task get --dry-run 仅回显 task_id 且不调任务接口", async () => {
|
||||
|
||||
Reference in New Issue
Block a user