( rootDir: string, filter: TestFilter | null, )
| 100 | }; |
| 101 | |
| 102 | async function readInputFixtures( |
| 103 | rootDir: string, |
| 104 | filter: TestFilter | null, |
| 105 | ): Promise<Map<string, {value: string; filepath: string}>> { |
| 106 | let inputFiles: Array<string>; |
| 107 | if (filter == null) { |
| 108 | inputFiles = glob.sync(`**/*{${INPUT_EXTENSIONS.join(',')}}`, { |
| 109 | cwd: rootDir, |
| 110 | }); |
| 111 | } else { |
| 112 | inputFiles = ( |
| 113 | await Promise.all( |
| 114 | filter.paths.map(pattern => |
| 115 | glob.glob(`${pattern}{${INPUT_EXTENSIONS.join(',')}}`, { |
| 116 | cwd: rootDir, |
| 117 | }), |
| 118 | ), |
| 119 | ) |
| 120 | ).flat(); |
| 121 | } |
| 122 | const inputs: Array<Promise<[string, {value: string; filepath: string}]>> = |
| 123 | []; |
| 124 | for (const filePath of inputFiles) { |
| 125 | // Do not include extensions in unique identifier for fixture |
| 126 | const partialPath = stripExtension(filePath, INPUT_EXTENSIONS); |
| 127 | inputs.push( |
| 128 | fs.readFile(path.join(rootDir, filePath), 'utf8').then(input => { |
| 129 | return [ |
| 130 | partialPath, |
| 131 | { |
| 132 | value: input, |
| 133 | filepath: filePath, |
| 134 | }, |
| 135 | ]; |
| 136 | }), |
| 137 | ); |
| 138 | } |
| 139 | return new Map(await Promise.all(inputs)); |
| 140 | } |
| 141 | async function readOutputFixtures( |
| 142 | rootDir: string, |
| 143 | filter: TestFilter | null, |
no test coverage detected