@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.
@@ -320,6 +320,23 @@ function isRunConfigLike(value) {
320
320
  function isTestCaseLike(value) {
321
321
  return hasMethod(value, "getName") && hasMethod(value, "getTags") && hasMethod(value, "getInput");
322
322
  }
323
+ function collectTestCasesFromExportValues(exports) {
324
+ const out = [];
325
+ for (const value of exports) {
326
+ if (isTestCaseLike(value)) {
327
+ out.push(value);
328
+ continue;
329
+ }
330
+ if (Array.isArray(value)) {
331
+ for (const item of value) {
332
+ if (isTestCaseLike(item)) {
333
+ out.push(item);
334
+ }
335
+ }
336
+ }
337
+ }
338
+ return out;
339
+ }
323
340
  async function walkDirectory(rootDir, excludeDirectories) {
324
341
  const out = [];
325
342
  async function walk(currentDir) {
@@ -428,7 +445,7 @@ async function collectTestCasesFromFiles(config) {
428
445
  const found = await Promise.all(
429
446
  matched.map(async (absolutePath) => {
430
447
  const exports = await loadModuleExports(absolutePath);
431
- const testCases = exports.filter(isTestCaseLike);
448
+ const testCases = collectTestCasesFromExportValues(exports);
432
449
  const relPath = relative(config.rootDir, absolutePath);
433
450
  return testCases.map((testCase) => ({
434
451
  id: toId("test-case", relPath, testCase.getName()),