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

Function isTestCode

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

Source from the content-addressed store, hash-verified

24
25/** `node` is test code. `readSource` reads project files, for the Rust readings; without it they are skipped. */
26export function isTestCode(node: Node, readSource?: SourceReader): boolean {
27 if (isTestFile(node.filePath)) return true;
28 if (node.qualifiedName && isTestScope(node.qualifiedName)) return true;
29 if (node.language !== 'rust' || !readSource) return false;
30 const source = readSource(node.filePath);
31 if (source !== undefined && inCfgTestModule(source, node.startLine)) return true;
32 return inCfgTestFile(node.filePath.replace(/\\/g, '/'), readSource);
33}
34
35/**
36 * `filePath` (project-relative) is a Rust module file its parent declares

Callers 2

testCodeReadingMethod · 0.90
mainFunction · 0.90

Calls 4

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

Tested by

no test coverage detected