( varsPath: string, basePath: string, finalConfig: Record<string, any> | undefined, )
| 175 | } |
| 176 | |
| 177 | async function readLocalStandaloneTestsFile( |
| 178 | varsPath: string, |
| 179 | basePath: string, |
| 180 | finalConfig: Record<string, any> | undefined, |
| 181 | ): Promise<TestCase[]> { |
| 182 | const { |
| 183 | resolvedVarsPath, |
| 184 | pathWithoutFunction, |
| 185 | maybeFunctionName, |
| 186 | fileExtension, |
| 187 | extensionWithoutSheet, |
| 188 | } = getStandaloneTestsFileMetadata(varsPath, basePath); |
| 189 | |
| 190 | if (isJavascriptFile(pathWithoutFunction)) { |
| 191 | telemetry.record('feature_used', { |
| 192 | feature: 'js tests file', |
| 193 | }); |
| 194 | return readJavascriptTestCases(pathWithoutFunction, maybeFunctionName, finalConfig); |
| 195 | } |
| 196 | if (fileExtension === 'py') { |
| 197 | telemetry.record('feature_used', { |
| 198 | feature: 'python tests file', |
| 199 | }); |
| 200 | return readPythonTestCases(pathWithoutFunction, maybeFunctionName, finalConfig); |
| 201 | } |
| 202 | |
| 203 | if (fileExtension === 'csv') { |
| 204 | telemetry.record('feature_used', { |
| 205 | feature: 'csv tests file - local', |
| 206 | }); |
| 207 | return csvRowsToTestCases(await readLocalCsvRows(resolvedVarsPath)); |
| 208 | } |
| 209 | if (extensionWithoutSheet === 'xlsx' || extensionWithoutSheet === 'xls') { |
| 210 | telemetry.record('feature_used', { |
| 211 | feature: 'xlsx tests file - local', |
| 212 | }); |
| 213 | return csvRowsToTestCases(await parseXlsxFile(resolvedVarsPath)); |
| 214 | } |
| 215 | if (fileExtension === 'json') { |
| 216 | telemetry.record('feature_used', { |
| 217 | feature: 'json tests file', |
| 218 | }); |
| 219 | return readJsonTestCases(resolvedVarsPath); |
| 220 | } |
| 221 | if (fileExtension === 'jsonl') { |
| 222 | telemetry.record('feature_used', { |
| 223 | feature: 'jsonl tests file', |
| 224 | }); |
| 225 | return readJsonlTestCases(resolvedVarsPath); |
| 226 | } |
| 227 | if (fileExtension === 'yaml' || fileExtension === 'yml') { |
| 228 | telemetry.record('feature_used', { |
| 229 | feature: 'yaml tests file', |
| 230 | }); |
| 231 | const rawContent = yaml.load(await fsPromises.readFile(resolvedVarsPath, 'utf-8')); |
| 232 | const rows = maybeLoadConfigFromExternalFile(rawContent) as unknown as CsvRow[]; |
| 233 | return csvRowsToTestCases(rows); |
| 234 | } |
no test coverage detected
searching dependent graphs…