mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-21 00:05:49 +02:00
fix: distinguish external test links in the feature map
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
92fe9f40f3
commit
5fd292dd77
2 files changed
+3
-2
No files matched your search
@@ -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"]);
|
||||
});
|
||||
|
||||
|
||||
@@ -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}`);
|
||||
|
||||
Reference in new issue
Block a user