@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.
package/dist/index.js CHANGED
@@ -1302,6 +1302,23 @@ function isRunConfigLike(value) {
1302
1302
  function isTestCaseLike(value) {
1303
1303
  return hasMethod(value, "getName") && hasMethod(value, "getTags") && hasMethod(value, "getInput");
1304
1304
  }
1305
+ function collectTestCasesFromExportValues(exports) {
1306
+ const out = [];
1307
+ for (const value of exports) {
1308
+ if (isTestCaseLike(value)) {
1309
+ out.push(value);
1310
+ continue;
1311
+ }
1312
+ if (Array.isArray(value)) {
1313
+ for (const item of value) {
1314
+ if (isTestCaseLike(item)) {
1315
+ out.push(item);
1316
+ }
1317
+ }
1318
+ }
1319
+ }
1320
+ return out;
1321
+ }
1305
1322
  async function walkDirectory(rootDir, excludeDirectories) {
1306
1323
  const out = [];
1307
1324
  async function walk(currentDir) {
@@ -1410,7 +1427,7 @@ async function collectTestCasesFromFiles(config) {
1410
1427
  const found = await Promise.all(
1411
1428
  matched.map(async (absolutePath) => {
1412
1429
  const exports = await loadModuleExports(absolutePath);
1413
- const testCases = exports.filter(isTestCaseLike);
1430
+ const testCases = collectTestCasesFromExportValues(exports);
1414
1431
  const relPath = relative(config.rootDir, absolutePath);
1415
1432
  return testCases.map((testCase) => ({
1416
1433
  id: toId("test-case", relPath, testCase.getName()),