( pathOrGlobs: string | string[], basePath: string = '', )
| 43 | const SHA256_BLOB_SUFFIX = /\.[a-f0-9]{64}$/i; |
| 44 | |
| 45 | export async function readTestFiles( |
| 46 | pathOrGlobs: string | string[], |
| 47 | basePath: string = '', |
| 48 | ): Promise<Record<string, string | string[] | object>> { |
| 49 | if (typeof pathOrGlobs === 'string') { |
| 50 | pathOrGlobs = [pathOrGlobs]; |
| 51 | } |
| 52 | |
| 53 | const ret: Record<string, string | string[] | object> = {}; |
| 54 | for (const pathOrGlob of pathOrGlobs) { |
| 55 | const resolvedPath = path.resolve(basePath, pathOrGlob); |
| 56 | |
| 57 | const paths = globSync(resolvedPath, { |
| 58 | windowsPathsNoEscape: true, |
| 59 | }); |
| 60 | |
| 61 | for (const p of paths) { |
| 62 | const rawData = yaml.load(await fsPromises.readFile(p, 'utf-8')); |
| 63 | const yamlData = maybeLoadConfigFromExternalFile(rawData); |
| 64 | Object.assign(ret, yamlData); |
| 65 | } |
| 66 | } |
| 67 | return ret; |
| 68 | } |
| 69 | |
| 70 | /** |
| 71 | * Reads test cases from a file in various formats (CSV, JSON, YAML, Python, JavaScript) and returns them as TestCase objects. |
no test coverage detected
searching dependent graphs…