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