(step, targetPath, targetLine)
| 93 | * Reads the step's stack via `step.line()` to get `file:row:col`. |
| 94 | */ |
| 95 | export function matchStepFile(step, targetPath, targetLine) { |
| 96 | if (!targetPath) return false |
| 97 | const stepLine = step.line && step.line() |
| 98 | if (!stepLine) return false |
| 99 | |
| 100 | const parsed = parseStepLine(stepLine) |
| 101 | if (!parsed) return false |
| 102 | |
| 103 | const fileMatches = parsed.file.includes(targetPath) || parsed.file.endsWith(targetPath) |
| 104 | if (!fileMatches) return false |
| 105 | |
| 106 | if (targetLine != null && !Number.isNaN(targetLine) && parsed.line !== targetLine) return false |
| 107 | return true |
| 108 | } |
| 109 | |
| 110 | function parseStepLine(stepLine) { |
| 111 | let line = stepLine.trim() |
no test coverage detected