mirror of
https://github.com/garrytan/gstack.git
synced 2026-10-31 14:06:50 +01:00
test-of-test ratchet: a repo script or setup read by path counts as product code
codex-invocation-sites (runs scripts/gen-skill-docs.ts), gstack-config-gbrain-refresh (copies bin/<name> through a variable) and setup-cso-windows-probe (reads setup and scripts/build-cso-windows.ps1) exercise product code the detector could not see.
This commit is contained in:
1 parent
c43326b638
commit
bc8e2181be
1 file changed
+3
-1
@@ -210,7 +210,9 @@ function testsOnlyTestCode(file: string): { counted: boolean; helper?: string }
|
||||
const targets = directSpecifiers(source).map(specifier => resolveRepoSpecifier(ROOT, file, specifier)).filter(Boolean) as string[];
|
||||
if (targets.some(target => !target.startsWith('test/') && !target.startsWith('node_modules/'))) return { counted: false };
|
||||
if (/(['"`])[^'"`\n]*(?:\bbin\/|SKILL\.md|CLAUDE\.md|\.tmpl)[^'"`\n]*\1/.test(source)) return { counted: false };
|
||||
if (/(['"`])(?:\.\/)?\.github\b[^'"`\n]*\1|(['"`])bin\2\s*,\s*(['"`])[\w.-]+\3/.test(source)) return { counted: false };
|
||||
if (/(['"`])(?:\.\/)?\.github\b[^'"`\n]*\1|(['"`])bin\2\s*,\s*(?:(['"`])[\w.-]+\3|[A-Za-z_$])/.test(source)) return { counted: false };
|
||||
// A repo script run or read by path (`scripts/gen-skill-docs.ts`, `path.join(ROOT, 'setup')`) is product code too.
|
||||
if (/(['"`])(?:\.\/)?scripts\/[\w./-]+\1|ROOT\s*,\s*(['"`])setup\2/.test(source)) return { counted: false };
|
||||
return { counted: true, helper: targets.find(target => target.startsWith('test/helpers/') && !target.endsWith('.test.ts')) };
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user