(node: Node, readSource?: SourceReader)
| 26 | |
| 27 | /** `node` is test code. `readSource` reads project files, for the Rust readings; without it they are skipped. */ |
| 28 | export 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 |
no test coverage detected