@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.d.ts CHANGED
@@ -279,6 +279,8 @@ interface EvaluateMeta {
279
279
  * `runDatasetWith` / `runDatasetJobsWithSharedConcurrency` was invoked). Shared across all jobs in a batch.
280
280
  */
281
281
  triggerTimestamp: number;
282
+ /** Same instant as {@link triggerTimestamp}, as an ISO 8601 string (`toISOString()`). */
283
+ triggeredAt: string;
282
284
  /**
283
285
  * Identifier of the current test-case execution shared across all evaluators
284
286
  * for this specific test-case run.
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()),
@@ -1567,6 +1584,7 @@ function processOneEvaluation(task, unit, totalEvaluations, publishEvent, persis
1567
1584
  meta: {
1568
1585
  triggerId: task.triggerId,
1569
1586
  triggerTimestamp: task.triggerTimestamp,
1587
+ triggeredAt: new Date(task.triggerTimestamp).toISOString(),
1570
1588
  runId: evaluatorRunId,
1571
1589
  datasetName: task.dataset.getDisplayLabel(),
1572
1590
  testCaseId: testCaseItem.id,