@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/index.cjs CHANGED
@@ -1327,6 +1327,23 @@ function isRunConfigLike(value) {
1327
1327
  function isTestCaseLike(value) {
1328
1328
  return hasMethod(value, "getName") && hasMethod(value, "getTags") && hasMethod(value, "getInput");
1329
1329
  }
1330
+ function collectTestCasesFromExportValues(exports) {
1331
+ const out = [];
1332
+ for (const value of exports) {
1333
+ if (isTestCaseLike(value)) {
1334
+ out.push(value);
1335
+ continue;
1336
+ }
1337
+ if (Array.isArray(value)) {
1338
+ for (const item of value) {
1339
+ if (isTestCaseLike(item)) {
1340
+ out.push(item);
1341
+ }
1342
+ }
1343
+ }
1344
+ }
1345
+ return out;
1346
+ }
1330
1347
  async function walkDirectory(rootDir, excludeDirectories) {
1331
1348
  const out = [];
1332
1349
  async function walk(currentDir) {
@@ -1435,7 +1452,7 @@ async function collectTestCasesFromFiles(config) {
1435
1452
  const found = await Promise.all(
1436
1453
  matched.map(async (absolutePath) => {
1437
1454
  const exports = await loadModuleExports(absolutePath);
1438
- const testCases = exports.filter(isTestCaseLike);
1455
+ const testCases = collectTestCasesFromExportValues(exports);
1439
1456
  const relPath = path.relative(config.rootDir, absolutePath);
1440
1457
  return testCases.map((testCase) => ({
1441
1458
  id: toId("test-case", relPath, testCase.getName()),
@@ -1592,6 +1609,7 @@ function processOneEvaluation(task, unit, totalEvaluations, publishEvent, persis
1592
1609
  meta: {
1593
1610
  triggerId: task.triggerId,
1594
1611
  triggerTimestamp: task.triggerTimestamp,
1612
+ triggeredAt: new Date(task.triggerTimestamp).toISOString(),
1595
1613
  runId: evaluatorRunId,
1596
1614
  datasetName: task.dataset.getDisplayLabel(),
1597
1615
  testCaseId: testCaseItem.id,