MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / isTestCode

Function isTestCode

src/graph/test-code.ts:28–35  ·  view source on GitHub ↗
(node: Node, readSource?: SourceReader)

Source from the content-addressed store, hash-verified

26
27/** `node` is test code. `readSource` reads project files, for the Rust readings; without it they are skipped. */
28export function isTestCode(node: Node, readSource?: SourceReader): boolean {
29 if (isTestFile(node.filePath)) return true;
30 if (node.qualifiedName && isTestScope(node.qualifiedName)) return true;
31 if (node.language !== 'rust' || !readSource) return false;
32 const source = readSource(node.filePath);
33 if (source !== undefined && inCfgTestModule(source, node.startLine)) return true;
34 return inCfgTestFile(node.filePath.replace(/\\/g, '/'), readSource);
35}
36
37/**
38 * {@link isTestCode} for the nodes of one answer, over the project at

Callers 2

mainFunction · 0.90
testCodeReadingFunction · 0.70

Calls 5

isTestFileFunction · 0.90
isTestScopeFunction · 0.90
readSourceFunction · 0.85
inCfgTestModuleFunction · 0.85
inCfgTestFileFunction · 0.85

Tested by

no test coverage detected