feat: 重构配置生命周期为 Authoring/Normalized/Resolved 三层
将变量替换和 expect 简写展开统一放入 Normalized 阶段, 运行时 AJV 使用 Normalized schema,导出 schema 面向 Authoring Config。 主要变更: - 新增 normalizer.ts 实现 normalizeAuthoringConfig() - 拆分 Authoring/Normalized 双 schema,checker 接口支持 authoring/normalized 片段 - config-loader 流程:normalize → Normalized AJV → semantic → resolve - validator 兼容层自动分派 raw/normalized expect 形态 - 删除 rawExpect,store.expect 列写入 null - Authoring schema 对 integer/boolean/enum 字段接受变量引用 - 修复 DB/HTTP validate 入口守卫和 LLM options integer 变量引用 - 优化 compact() 避免 undefined 覆盖隐患 - 移除 content.ts 恒为 true 的前置条件 - 同步 5 个主规范并归档 change
This commit is contained in:
@@ -911,11 +911,6 @@ targets:
|
||||
const config = await loadConfig(configPath);
|
||||
const t = config.targets[0]!;
|
||||
if (t.type === "http") {
|
||||
expect(t.rawExpect).toEqual({
|
||||
body: [{ contains: "ok" }, { json: { equals: "ok", path: "$.status" } }],
|
||||
durationMs: { lte: 3000 },
|
||||
status: [200, 201],
|
||||
});
|
||||
expect(t.expect).toEqual({
|
||||
body: [
|
||||
{ kind: "value", matcher: { contains: "ok" } },
|
||||
@@ -952,12 +947,6 @@ targets:
|
||||
const config = await loadConfig(configPath);
|
||||
const t = config.targets[0]!;
|
||||
if (t.type === "cmd") {
|
||||
expect(t.rawExpect).toEqual({
|
||||
durationMs: { lte: 5000 },
|
||||
exitCode: [0, 2],
|
||||
stderr: [{ empty: true }],
|
||||
stdout: [{ contains: "ok" }, { regex: "done" }],
|
||||
});
|
||||
expect(t.expect).toEqual({
|
||||
durationMs: { lte: 5000 },
|
||||
exitCode: [0, 2],
|
||||
@@ -1291,7 +1280,7 @@ targets:
|
||||
equals: "ok"
|
||||
`,
|
||||
);
|
||||
await expectConfigLoadError(configPath, "json.path");
|
||||
await expectConfigLoadError(configPath, "path 必须为以");
|
||||
});
|
||||
|
||||
test("body css selector 为空抛出错误", async () => {
|
||||
@@ -1310,7 +1299,7 @@ targets:
|
||||
selector: ""
|
||||
`,
|
||||
);
|
||||
await expectConfigLoadError(configPath, "css.selector 必须为非空字符串");
|
||||
await expectConfigLoadError(configPath, "selector 必须为非空字符串");
|
||||
});
|
||||
|
||||
test("旧 match matcher 抛出错误", async () => {
|
||||
@@ -1329,7 +1318,7 @@ targets:
|
||||
match: "[invalid"
|
||||
`,
|
||||
);
|
||||
await expectConfigLoadError(configPath, "match 是未知 matcher");
|
||||
await expectConfigLoadError(configPath, "match 是未知字段");
|
||||
});
|
||||
|
||||
test("operator gte 非数字抛出错误", async () => {
|
||||
@@ -1410,7 +1399,7 @@ targets:
|
||||
path: ""
|
||||
`,
|
||||
);
|
||||
await expectConfigLoadError(configPath, "xpath.path 必须为非空字符串");
|
||||
await expectConfigLoadError(configPath, "path 必须为非空字符串");
|
||||
});
|
||||
|
||||
test("expect headers 非对象抛出错误", async () => {
|
||||
|
||||
Reference in New Issue
Block a user