Skip to content

armgit / rea

Public Imported from GitHub
0

Reverse engineer anything with agents, from app behavior down to native binaries.

fix(ci): check authored documentation code (#3119)

Ysopwnable500e32399a3b
diff --git a/scripts/ci/plan.mjs b/scripts/ci/plan.mjs
index cb942bfd9..2d68d60c7 100644
--- a/scripts/ci/plan.mjs
+++ b/scripts/ci/plan.mjs
@@ -175,6 +175,8 @@ if (tier === "reused") {
file.startsWith(".github/ISSUE_TEMPLATE/")
) {
selected.docs = true;
+ // Authored documentation code also belongs to the static checkers.
+ selected.code ||= /^docs\/.*\.(?:[cm]?[jt]s|[jt]sx)$/su.test(file);
selected.website ||= matchesAny(file, SCOPES.website);
continue;
}
diff --git a/tests/boundary/filesystem/ciChangeScope.test.ts b/tests/boundary/filesystem/ciChangeScope.test.ts
index 30597523e..3ea3e2173 100644
--- a/tests/boundary/filesystem/ciChangeScope.test.ts
+++ b/tests/boundary/filesystem/ciChangeScope.test.ts
@@ -144,6 +144,51 @@ it("keeps every translated README and authored guide on the documentation lane",
});
});
+it.each(["cjs", "cts", "js", "jsx", "mjs", "mts", "ts", "tsx"])(
+ "selects static checks for authored documentation code (%s) without provider lanes",
+ async (extension) => {
+ const { directory, base } = await fixture();
+ const head = await change(directory, [
+ `docs/.vitepress/helpers/navigation.${extension}`,
+ ]);
+ const plan = await classify(directory, base, head);
+ const { CI_FLAGS } = await loadScopes();
+ expect(plan).toMatchObject({ tier: "fast", code: true, docs: true });
+ for (const flag of CI_FLAGS)
+ if (flag !== "code" && flag !== "docs") expect(plan[flag]).toBe(false);
+ },
+);
+
+it("retains code checks when documentation code is removed or renamed to Markdown", async () => {
+ const { directory } = await fixture();
+ const base = await change(directory, ["docs/.vitepress/config.ts"]);
+ await git(directory, [
+ "mv",
+ "docs/.vitepress/config.ts",
+ "docs/configuration.md",
+ ]);
+ const head = await commit(directory);
+ expect(await classify(directory, base, head)).toMatchObject({
+ code: true,
+ docs: true,
+ runtime: false,
+ package: false,
+ });
+});
+
+it("selects code checks for documentation filenames containing line separators", async () => {
+ const { directory, base } = await fixture();
+ const head = await change(directory, [
+ "docs/.vitepress/navigation\u2028menu.ts",
+ ]);
+ expect(await classify(directory, base, head)).toMatchObject({
+ code: true,
+ docs: true,
+ runtime: false,
+ package: false,
+ });
+});
+
it.each([
"job-timings.mjs",
"job-timings-batch.mjs",
@@ -937,7 +982,7 @@ it.each([
"tsconfig.build.json",
{ code: true, package: true, browser: true, evm: true },
],
- ["docs/.vitepress/config.ts", { code: false, docs: true, package: false }],
+ ["docs/.vitepress/config.ts", { code: true, docs: true, package: false }],
["CHANGELOG.md", { code: false, docs: true, package: false }],
["SECURITY.md", { code: false, docs: true, package: false }],
[".github/pull_request_template.md", { code: false, docs: true }],