refactor: 统一错误处理机制
- 引入 ConfigError/TemplateError/BuildError/FileError 与 wrapAsyncError,统一错误输出 - generator 入口接入 wrapAsyncError,确保命令行执行路径一致 - 兜底逻辑使用 instanceof,保留 BuildError/TemplateError 上下文信息 - 合并格式化提交(仅缩进/换行调整)
This commit is contained in:
@@ -13,4 +13,3 @@ test('P1-5:404.html 回跳应将 /<id> 转为 ?page=<id>(并支持仓库前
|
||||
assert.ok(html.includes('segments.length === 2'), '应支持仓库站点 /<repo>/<id>');
|
||||
assert.ok(html.includes('l.replace(target)'), '应使用 location.replace 执行回跳');
|
||||
});
|
||||
|
||||
|
||||
@@ -20,9 +20,7 @@ test('P1-7:页面内不应注入整站 configJSON,应仅保留扩展元信
|
||||
const config = loadConfig();
|
||||
const html = generateHTML(config);
|
||||
|
||||
const match = html.match(
|
||||
/<script id="menav-config-data"[^>]*>([\s\S]*?)<\/script>/m
|
||||
);
|
||||
const match = html.match(/<script id="menav-config-data"[^>]*>([\s\S]*?)<\/script>/m);
|
||||
assert.ok(match, '应输出 menav-config-data 脚本块');
|
||||
|
||||
const raw = String(match[1] || '').trim();
|
||||
@@ -53,4 +51,3 @@ test('P1-7:页面内不应注入整站 configJSON,应仅保留扩展元信
|
||||
assert.ok(!/"sites"\s*:/.test(raw), '不应包含 sites 字段');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user