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/README.md +98 -2
- package/README.zh-Hans.md +98 -2
- package/lib/cli.js +25 -60
- package/lib/converter/ast.js +23 -2
- package/lib/converter/collect-source-maps.js +33 -12
- package/lib/converter/converter.js +104 -39
- package/lib/converter/css-coverage.js +76 -0
- package/lib/converter/find-original-range.js +211 -3
- package/lib/converter/untested.js +4 -6
- package/lib/default/options.js +5 -0
- package/lib/generate.js +3 -2
- package/lib/index.d.ts +67 -0
- package/lib/packages/monocart-coverage-assets.js +1 -1
- package/lib/packages/monocart-coverage-converter.js +11 -11
- package/lib/packages/monocart-coverage-vendor.js +2 -1
- package/lib/packages/monocart-coverage-vendor.js.LICENSE +69 -9
- package/lib/platform/share.js +7 -0
- package/lib/test/test-reporter.js +191 -0
- package/lib/test/test-results.js +104 -0
- package/lib/test/test-runner.js +115 -0
- package/lib/utils/source-path.js +21 -6
- package/lib/utils/util.js +6 -1
- package/migrate-to-3.md +4 -0
- package/package.json +29 -21
- package/skills/monocart-coverage-reports/SKILL.md +2 -2
- package/skills/monocart-coverage-reports/references/best-practices.md +218 -0
- package/skills/monocart-coverage-reports/references/cli.md +5 -0
- package/skills/monocart-coverage-reports/references/collection.md +2 -0
- package/skills/monocart-coverage-reports/references/reports-and-ci.md +2 -0
- package/skills/monocart-coverage-reports/references/repository-map.md +7 -3
- package/lib/packages/chunks/chunk-RVOSNMVU.js +0 -2
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;
|