()
| 45 | } |
| 46 | |
| 47 | export async function readTestFilter(): Promise<TestFilter | null> { |
| 48 | if (!(await exists(FILTER_PATH))) { |
| 49 | throw new Error(`testfilter file not found at \`${FILTER_PATH}\``); |
| 50 | } |
| 51 | |
| 52 | const input = await fs.readFile(FILTER_PATH, 'utf8'); |
| 53 | const lines = input.trim().split('\n'); |
| 54 | |
| 55 | let debug: boolean = false; |
| 56 | const line0 = lines[0]; |
| 57 | if (line0 != null) { |
| 58 | // Try to parse pragmas |
| 59 | let consumedLine0 = false; |
| 60 | if (line0.indexOf('@only') !== -1) { |
| 61 | consumedLine0 = true; |
| 62 | } |
| 63 | if (line0.indexOf('@debug') !== -1) { |
| 64 | debug = true; |
| 65 | consumedLine0 = true; |
| 66 | } |
| 67 | |
| 68 | if (consumedLine0) { |
| 69 | lines.shift(); |
| 70 | } |
| 71 | } |
| 72 | return { |
| 73 | debug, |
| 74 | paths: lines.filter(line => !line.trimStart().startsWith('//')), |
| 75 | }; |
| 76 | } |
| 77 | |
| 78 | export function getBasename(fixture: TestFixture): string { |
| 79 | return stripExtension(path.basename(fixture.inputPath), INPUT_EXTENSIONS); |
no test coverage detected