chore: 添加 .oxfmtrc.json 并格式化全部代码
This commit is contained in:
@@ -1,11 +1,6 @@
|
||||
import { describe, it, expect } from "bun:test";
|
||||
import { formatError } from "../../src/cli/output.ts";
|
||||
import {
|
||||
UsageError,
|
||||
ConfigError,
|
||||
CommandError,
|
||||
InternalError,
|
||||
} from "../../src/cli/errors.ts";
|
||||
import { UsageError, ConfigError, CommandError, InternalError } from "../../src/cli/errors.ts";
|
||||
|
||||
describe("formatError", () => {
|
||||
it("只输出错误行(无 hint/usage)", () => {
|
||||
@@ -25,15 +20,13 @@ describe("formatError", () => {
|
||||
usage: "rune plan <change-name>",
|
||||
});
|
||||
const output = formatError(err);
|
||||
expect(output).toBe(
|
||||
"错误: 缺少参数\n\n用法: rune plan <change-name>",
|
||||
);
|
||||
expect(output).toBe("错误: 缺少参数\n\n用法: rune plan <change-name>");
|
||||
});
|
||||
|
||||
it("输出完整格式(错误 + 用法 + 提示)", () => {
|
||||
const err = new UsageError("缺少必填参数 <change-name>", {
|
||||
usage: "rune plan <change-name>",
|
||||
hint: "请指定变更名称,如 \"add-login\"",
|
||||
hint: '请指定变更名称,如 "add-login"',
|
||||
});
|
||||
const output = formatError(err);
|
||||
expect(output).toBe(
|
||||
|
||||
Reference in New Issue
Block a user