@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/cli.js CHANGED
@@ -1083,6 +1083,23 @@ function isRunConfigLike(value) {
1083
1083
  function isTestCaseLike(value) {
1084
1084
  return hasMethod(value, "getName") && hasMethod(value, "getTags") && hasMethod(value, "getInput");
1085
1085
  }
1086
+ function collectTestCasesFromExportValues(exports) {
1087
+ const out = [];
1088
+ for (const value of exports) {
1089
+ if (isTestCaseLike(value)) {
1090
+ out.push(value);
1091
+ continue;
1092
+ }
1093
+ if (Array.isArray(value)) {
1094
+ for (const item of value) {
1095
+ if (isTestCaseLike(item)) {
1096
+ out.push(item);
1097
+ }
1098
+ }
1099
+ }
1100
+ }
1101
+ return out;
1102
+ }
1086
1103
  async function walkDirectory(rootDir, excludeDirectories) {
1087
1104
  const out = [];
1088
1105
  async function walk(currentDir) {
@@ -1191,7 +1208,7 @@ async function collectTestCasesFromFiles(config) {
1191
1208
  const found = await Promise.all(
1192
1209
  matched.map(async (absolutePath) => {
1193
1210
  const exports = await loadModuleExports(absolutePath);
1194
- const testCases = exports.filter(isTestCaseLike);
1211
+ const testCases = collectTestCasesFromExportValues(exports);
1195
1212
  const relPath = relative(config.rootDir, absolutePath);
1196
1213
  return testCases.map((testCase) => ({
1197
1214
  id: toId("test-case", relPath, testCase.getName()),