monocart-coverage-reports 3.0.0 → 3.2.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/lib/index.d.ts CHANGED
@@ -271,6 +271,58 @@ declare namespace MCR {
271
271
  files: CoverageFile[];
272
272
  };
273
273
 
274
+ export interface TestError {
275
+ /** Fixed string fields; defaults are "Error" and "" for unavailable/non-string values. */
276
+ name: string;
277
+ message: string;
278
+ /** Own enumerable data properties only: strings, booleans, finite numbers,
279
+ * and null. BigInts become strings; objects, accessors and unsupported values
280
+ * are omitted. Missing properties read as undefined. Values may be sensitive.
281
+ */
282
+ [key: string]: string | number | boolean | null | undefined;
283
+ }
284
+
285
+ export interface TestResult {
286
+ name: string;
287
+ type: "test" | "suite";
288
+ nesting: number;
289
+ testNumber: number;
290
+ file?: string;
291
+ line?: number;
292
+ column?: number;
293
+ /** Duration in milliseconds. */
294
+ duration: number;
295
+ status: "passed" | "failed" | "cancelled" | "skipped" | "todo";
296
+ skip?: string | boolean;
297
+ todo?: string | boolean;
298
+ error?: TestError;
299
+ }
300
+
301
+ export interface TestSummary {
302
+ tests: number;
303
+ suites: number;
304
+ passed: number;
305
+ failed: number;
306
+ cancelled: number;
307
+ skipped: number;
308
+ todo: number;
309
+ /** Duration in milliseconds. */
310
+ duration: number;
311
+ success: boolean;
312
+ }
313
+
314
+ export interface TestResults {
315
+ /** Unique collection ID, also used in test-results-<id>.json. */
316
+ id: string;
317
+ framework: "node:test";
318
+ /** Whether the runner emitted its final summary (not whether tests passed). */
319
+ complete: boolean;
320
+ /** Final runner counts, excluding suites from the test count; null if incomplete. */
321
+ summary: TestSummary | null;
322
+ /** Completed test and suite records, including nested tests. */
323
+ tests: TestResult[];
324
+ }
325
+
274
326
  export type LoggingType = "off" | "error" | "info" | "debug";
275
327
  export interface CoverageReportOptions {
276
328
 
@@ -449,6 +501,17 @@ declare namespace MCR {
449
501
  */
450
502
  test?: string | string[] | null;
451
503
 
504
+ /** Optional hook for `mcr test`; results are collected even when omitted.
505
+ * Runs before publishing the test results cache, onReady and coverage generation,
506
+ * even when assertions fail. Mutate messages/names here to redact persisted raw/debug
507
+ * results. Hook errors prevent publication of test results but not coverage generation.
508
+ * Not called for skipped runs.
509
+ * Missing/invalid reports fail the command without calling this hook. An incomplete
510
+ * report has complete=false and summary=null, and also fails the command.
511
+ * Hook errors fail the command but do not prevent coverage generation.
512
+ */
513
+ onTestEnd?: (testResults: TestResults) => void | Promise<void>;
514
+
452
515
  /** (CLI only) {function} onStart hook */
453
516
  onStart?: (coverageReport: CoverageReport) => void | Promise<void>;
454
517
 
@@ -639,6 +702,10 @@ export import CoverageRange = MCR.CoverageRange;
639
702
  export import IgnoredRange = MCR.IgnoredRange;
640
703
  export import CoverageFile = MCR.CoverageFile;
641
704
  export import CoverageResults = MCR.CoverageResults;
705
+ export import TestError = MCR.TestError;
706
+ export import TestResult = MCR.TestResult;
707
+ export import TestSummary = MCR.TestSummary;
708
+ export import TestResults = MCR.TestResults;
642
709
  export import LoggingType = MCR.LoggingType;
643
710
  export import CoverageReportOptions = MCR.CoverageReportOptions;
644
711
  export import McrCliOptions = MCR.McrCliOptions;