fix: distinguish external test links in the feature map

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
DottaandPaperclip committed 2026-10-05 17:48:43 -05:00
1 parent 92fe9f40f3
commit 5fd292dd77
2 files changed
+3 -2

No files matched your search

+1 -1
View File
@@ -81,7 +81,7 @@ test("deleted or renamed test references fail even inside runnable commands", (t
test("broken documentation links fail, external URLs and local anchors are accepted", (t) => {
const f = fixture(t);
f.write("feature-map/example.md", recipe + "\n[External](https://example.com) [Here](#gotchas) [Missing](../doc/missing.md#section)\n");
f.write("feature-map/example.md", recipe + "\n[External](https://example.com/tests/external.test.ts) [Here](#gotchas) [Missing](../doc/missing.md#section)\n");
assert.deepEqual(f.check(), ["example.md: broken local link ../doc/missing.md#section"]);
});
+2 -1
View File
@@ -72,7 +72,8 @@ export function checkFeatureMap(repoRoot = defaultRoot) {
}
// Also validate test paths in runnable code blocks or backticked references.
// This deliberately checks filenames, not test titles or behavioral coverage.
const testRefs = [...raw.matchAll(/(?<![\w-])((?:\.github|ui|server|packages|tests|cli|scripts)\/[\w./-]+\.(?:test|spec)\.(?:[cm]?[jt]sx?))\b/g)]
const localReferences = raw.replace(/[a-z][a-z0-9+.-]*:\/\/[^\s)]+/gi, "");
const testRefs = [...localReferences.matchAll(/(?<![\w-])((?:\.github|ui|server|packages|tests|cli|scripts)\/[\w./-]+\.(?:test|spec)\.(?:[cm]?[jt]sx?))\b/g)]
.map((match) => match[1]);
for (const path of new Set(testRefs)) {
if (!localFile(repoRoot, path)) errors.push(`${file}: missing test ${path}`);