@m4trix/evals 0.30.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.cjs CHANGED
@@ -1110,6 +1110,23 @@ function isRunConfigLike(value) {
1110
1110
  function isTestCaseLike(value) {
1111
1111
  return hasMethod(value, "getName") && hasMethod(value, "getTags") && hasMethod(value, "getInput");
1112
1112
  }
1113
+ function collectTestCasesFromExportValues(exports) {
1114
+ const out = [];
1115
+ for (const value of exports) {
1116
+ if (isTestCaseLike(value)) {
1117
+ out.push(value);
1118
+ continue;
1119
+ }
1120
+ if (Array.isArray(value)) {
1121
+ for (const item of value) {
1122
+ if (isTestCaseLike(item)) {
1123
+ out.push(item);
1124
+ }
1125
+ }
1126
+ }
1127
+ }
1128
+ return out;
1129
+ }
1113
1130
  async function walkDirectory(rootDir, excludeDirectories) {
1114
1131
  const out = [];
1115
1132
  async function walk(currentDir) {
@@ -1218,7 +1235,7 @@ async function collectTestCasesFromFiles(config) {
1218
1235
  const found = await Promise.all(
1219
1236
  matched.map(async (absolutePath) => {
1220
1237
  const exports = await loadModuleExports(absolutePath);
1221
- const testCases = exports.filter(isTestCaseLike);
1238
+ const testCases = collectTestCasesFromExportValues(exports);
1222
1239
  const relPath = path.relative(config.rootDir, absolutePath);
1223
1240
  return testCases.map((testCase) => ({
1224
1241
  id: toId("test-case", relPath, testCase.getName()),
@@ -1732,6 +1749,7 @@ function processOneEvaluation(task, unit, totalEvaluations, publishEvent, persis
1732
1749
  meta: {
1733
1750
  triggerId: task.triggerId,
1734
1751
  triggerTimestamp: task.triggerTimestamp,
1752
+ triggeredAt: new Date(task.triggerTimestamp).toISOString(),
1735
1753
  runId: evaluatorRunId,
1736
1754
  datasetName: task.dataset.getDisplayLabel(),
1737
1755
  testCaseId: testCaseItem.id,