@m4trix/evals 0.31.0 → 0.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -346,6 +346,23 @@ function isRunConfigLike(value) {
346
346
  function isTestCaseLike(value) {
347
347
  return hasMethod(value, "getName") && hasMethod(value, "getTags") && hasMethod(value, "getInput");
348
348
  }
349
+ function collectTestCasesFromExportValues(exports) {
350
+ const out = [];
351
+ for (const value of exports) {
352
+ if (isTestCaseLike(value)) {
353
+ out.push(value);
354
+ continue;
355
+ }
356
+ if (Array.isArray(value)) {
357
+ for (const item of value) {
358
+ if (isTestCaseLike(item)) {
359
+ out.push(item);
360
+ }
361
+ }
362
+ }
363
+ }
364
+ return out;
365
+ }
349
366
  async function walkDirectory(rootDir, excludeDirectories) {
350
367
  const out = [];
351
368
  async function walk(currentDir) {
@@ -454,7 +471,7 @@ async function collectTestCasesFromFiles(config) {
454
471
  const found = await Promise.all(
455
472
  matched.map(async (absolutePath) => {
456
473
  const exports = await loadModuleExports(absolutePath);
457
- const testCases = exports.filter(isTestCaseLike);
474
+ const testCases = collectTestCasesFromExportValues(exports);
458
475
  const relPath = path.relative(config.rootDir, absolutePath);
459
476
  return testCases.map((testCase) => ({
460
477
  id: toId("test-case", relPath, testCase.getName()),