阶段0-基线与护栏: 修复不可移植/抖动测试全绿(341过), vitest串行执行防桌面竞争, 新增运行时能力注册快照(909个id)
This commit is contained in:
1 parent
f35f0ac979
commit
4139400dbd
9 files changed
+1030
-36
No files matched your search
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* 能力注册快照(任务 0.3,见 docs/rpa-core-refactor-tasks.md)
|
||||
*
|
||||
* 以与生产完全相同的路径(import "../src/main/capabilities" 的副作用注册)
|
||||
* 拉起全部能力模块,把运行时注册表的 id 清单写入
|
||||
* resources/capability-snapshot.json。
|
||||
*
|
||||
* 用法:npm run snapshot
|
||||
* 抽离改造各阶段完成后重跑并 git diff,快照变化必须为零(行为回归基准)。
|
||||
*/
|
||||
import { writeFileSync } from "node:fs";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { capabilityCount, capabilityIds } from "../src/main/capabilities";
|
||||
|
||||
const OUT_FILE = path.join(
|
||||
path.dirname(fileURLToPath(import.meta.url)),
|
||||
"..",
|
||||
"resources",
|
||||
"capability-snapshot.json"
|
||||
);
|
||||
|
||||
describe("能力注册快照", () => {
|
||||
it("全量注册后导出能力 id 清单", () => {
|
||||
const ids = [...capabilityIds()].sort();
|
||||
expect(ids.length).toBeGreaterThan(0);
|
||||
const snapshot = {
|
||||
generatedAt: new Date().toISOString(),
|
||||
count: ids.length,
|
||||
ids
|
||||
};
|
||||
writeFileSync(OUT_FILE, JSON.stringify(snapshot, null, 2) + "\n", "utf8");
|
||||
console.log(`[能力快照] ${capabilityCount()} 个能力已写入 ${path.basename(OUT_FILE)}`);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user