test(core-eslint): anchor-presence CI guard for // <gen:*> comments

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-08 12:49:35 +02:00
parent bd1610a888
commit 8b3b118bb0
4 changed files with 46 additions and 1 deletions

View File

@@ -0,0 +1,29 @@
import { describe, it, expect } from "vitest";
import { readFileSync } from "node:fs";
import { join, dirname } from "node:path";
import { fileURLToPath } from "node:url";
const __dirname = dirname(fileURLToPath(import.meta.url));
const REPO_ROOT = join(__dirname, "..", "..");
const FEATURES = ["auth", "blog", "media", "marketing-pages", "navigation"];
const ANCHORS = {
"src/index.ts": ["// <gen:events>"],
"src/di/symbols.ts": ["// <gen:event-handler-symbols>", "// <gen:job-symbols>"],
"src/di/bind-production.ts": ["// <gen:event-handlers>", "// <gen:jobs>"],
"src/di/bind-dev-seed.ts": ["// <gen:event-handlers>", "// <gen:jobs>"],
"src/integrations/cms/index.ts": ["// <gen:job-tasks>"],
};
describe("// <gen:*> anchor presence in feature packages", () => {
for (const feature of FEATURES) {
for (const [relPath, anchors] of Object.entries(ANCHORS)) {
it(`packages/${feature}/${relPath} contains all required anchors`, () => {
const path = join(REPO_ROOT, "packages", feature, relPath);
const content = readFileSync(path, "utf8");
for (const anchor of anchors) {
expect(content).toContain(anchor);
}
});
}
}
});