@rstest/core 0.8.1 → 0.8.3

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.
Files changed (57) hide show
  1. package/dist/0~130.js +1 -2
  2. package/dist/0~1472.js +2 -3
  3. package/dist/0~1981.js +1 -2
  4. package/dist/0~2173.js +65 -27
  5. package/dist/0~2255.js +1 -2
  6. package/dist/0~3062.js +1 -2
  7. package/dist/0~3346.js +1 -2
  8. package/dist/0~3919.js +1 -2
  9. package/dist/0~4403.js +4 -4
  10. package/dist/0~4809.js +1 -2
  11. package/dist/0~5835.js +1 -2
  12. package/dist/0~62.js +1 -2
  13. package/dist/0~6588.js +4 -4
  14. package/dist/0~6907.js +1 -2
  15. package/dist/0~6923.js +1 -2
  16. package/dist/0~7583.js +1 -2
  17. package/dist/0~7882.js +7 -579
  18. package/dist/0~8426.js +1 -2
  19. package/dist/0~89.js +16 -12
  20. package/dist/0~9348.js +1 -2
  21. package/dist/0~9634.js +21 -8
  22. package/dist/1157.js +48 -97
  23. package/dist/1294.js +1 -2
  24. package/dist/1672.js +1 -2
  25. package/dist/3160.js +111 -8
  26. package/dist/3216.js +1 -2
  27. package/dist/4397.js +1 -2
  28. package/dist/4484.js +1 -2
  29. package/dist/487.js +1 -2
  30. package/dist/4881.js +1 -2
  31. package/dist/4899.js +2 -2
  32. package/dist/5734.js +1 -2
  33. package/dist/6151.js +13 -10
  34. package/dist/6198.js +1 -2
  35. package/dist/6973.js +1 -2
  36. package/dist/7011.js +1 -2
  37. package/dist/721.js +1 -2
  38. package/dist/9131.js +1329 -27
  39. package/dist/browser-runtime/2~907.js +0 -2
  40. package/dist/browser-runtime/389.js +14 -11
  41. package/dist/browser-runtime/389.js.LICENSE.txt +22 -0
  42. package/dist/browser-runtime/index.d.ts +100 -111
  43. package/dist/browser-runtime/rslib-runtime.js +0 -2
  44. package/dist/browser.d.ts +156 -110
  45. package/dist/browser.js +2 -2
  46. package/dist/globalSetupWorker.js +1 -2
  47. package/dist/index.d.ts +100 -110
  48. package/dist/index.js +1 -2
  49. package/dist/mockRuntimeCode.js +63 -174
  50. package/dist/rslib-runtime.js +1 -2
  51. package/dist/worker.d.ts +99 -110
  52. package/dist/worker.js +1 -2
  53. package/package.json +4 -4
  54. package/dist/browser-runtime/2~907.js.map +0 -1
  55. package/dist/browser-runtime/389.js.map +0 -1
  56. package/dist/browser-runtime/rslib-runtime.js.map +0 -1
  57. /package/dist/{1157.js.LICENSE.txt → 3160.js.LICENSE.txt} +0 -0
package/dist/browser.d.ts CHANGED
@@ -4,6 +4,7 @@ import { createColors } from 'picocolors';
4
4
  import { Logger } from 'rslog';
5
5
  import * as rsbuild from '@rsbuild/core';
6
6
  import type { RsbuildConfig } from '@rsbuild/core';
7
+ import type { RsbuildPlugin } from '@rsbuild/core';
7
8
  import type { Writable } from 'node:stream';
8
9
 
9
10
  /**
@@ -340,6 +341,14 @@ export declare interface BrowserTestRunOptions {
340
341
  * This allows the caller to unify reporter output with node mode tests.
341
342
  */
342
343
  skipOnTestRunEnd?: boolean;
344
+ /**
345
+ * Pre-calculated sharded entries for browser projects.
346
+ * If provided, the browser controller will use these instead of collecting its own.
347
+ * Key is project environmentName.
348
+ */
349
+ shardedEntries?: Map<string, {
350
+ entries: Record<string, string>;
351
+ }>;
343
352
  }
344
353
 
345
354
  /**
@@ -360,11 +369,14 @@ export declare interface BrowserTestRunResult {
360
369
  hasFailure: boolean;
361
370
  }
362
371
 
363
- declare type BuiltInReporterNames = keyof typeof reportersMap;
372
+ declare type BuiltInReporterNames = 'default' | 'verbose' | 'md' | 'github-actions' | 'junit';
364
373
 
365
374
  declare type BuiltinReporterOptions = {
366
375
  default: DefaultReporterOptions;
367
376
  verbose: VerboseReporterOptions;
377
+ md: MdReporterOptions;
378
+ 'github-actions': Record<string, unknown>;
379
+ junit: Record<string, unknown>;
368
380
  };
369
381
 
370
382
  declare type ChaiConfig = Partial<Omit<typeof config, 'useProxy' | 'proxyExcludedKeys' | 'deepEqual'>>;
@@ -504,6 +516,18 @@ declare interface Coverage {
504
516
  coverage: number;
505
517
  }
506
518
 
519
+ declare class CoverageMap {
520
+ constructor(data: CoverageMapData | CoverageMap);
521
+ addFileCoverage(pathOrObject: string | FileCoverage | FileCoverageData): void;
522
+ files(): string[];
523
+ fileCoverageFor(filename: string): FileCoverage;
524
+ filter(callback: (key: string) => boolean): void;
525
+ getCoverageSummary(): CoverageSummary;
526
+ merge(data: CoverageMapData | CoverageMap): void;
527
+ toJSON(): CoverageMapData;
528
+ data: CoverageMapData;
529
+ }
530
+
507
531
  declare interface CoverageMapData {
508
532
  [key: string]: FileCoverage | FileCoverageData;
509
533
  }
@@ -578,6 +602,37 @@ declare type CoverageOptions = {
578
602
  reportOnFailure?: boolean;
579
603
  };
580
604
 
605
+ declare class CoverageProvider {
606
+ constructor(options: CoverageOptions);
607
+ /**
608
+ * Initialize coverage collection
609
+ */
610
+ init(): void;
611
+ /**
612
+ * Collect coverage data from global coverage object
613
+ */
614
+ collect(): CoverageMap | null;
615
+ /**
616
+ * Create a new coverage map
617
+ */
618
+ createCoverageMap(): CoverageMap;
619
+ /**
620
+ * Generate coverage for untested files
621
+ */
622
+ generateCoverageForUntestedFiles(params: {
623
+ environmentName: string;
624
+ files: string[];
625
+ }): Promise<FileCoverageData[]>;
626
+ /**
627
+ * Generate coverage reports
628
+ */
629
+ generateReports(coverageMap: CoverageMap, options: CoverageOptions): Promise<void>;
630
+ /**
631
+ * Clean up coverage data
632
+ */
633
+ cleanup(): void;
634
+ }
635
+
581
636
  declare class CoverageSummary {
582
637
  constructor(data: CoverageSummary | CoverageSummaryData);
583
638
  merge(obj: CoverageSummary): CoverageSummary;
@@ -669,40 +724,6 @@ declare class DefaultMap<
669
724
  get(key: K): V;
670
725
  }
671
726
 
672
- declare class DefaultReporter implements Reporter {
673
- protected rootPath: string;
674
- protected config: NormalizedConfig;
675
- private options;
676
- protected statusRenderer: StatusRenderer | undefined;
677
- private testState;
678
- constructor({ rootPath, options, config, testState, }: {
679
- rootPath: string;
680
- config: NormalizedConfig;
681
- options: DefaultReporterOptions;
682
- testState: RstestTestState;
683
- });
684
- /**
685
- * Lazily create StatusRenderer on first test file start.
686
- * This avoids intercepting stdout/stderr before tests actually begin,
687
- * ensuring early errors (like missing Playwright browsers) remain visible.
688
- */
689
- private ensureStatusRenderer;
690
- onTestFileStart(): void;
691
- onTestFileResult(test: TestFileResult): void;
692
- onTestCaseResult(): void;
693
- onUserConsoleLog(log: UserConsoleLog): void;
694
- onExit(): Promise<void>;
695
- onTestRunEnd({ results, testResults, duration, getSourcemap, snapshotSummary, filterRerunTestPaths, unhandledErrors, }: {
696
- results: TestFileResult[];
697
- testResults: TestResult[];
698
- duration: Duration;
699
- snapshotSummary: SnapshotSummary;
700
- getSourcemap: GetSourcemap;
701
- unhandledErrors?: Error[];
702
- filterRerunTestPaths?: string[];
703
- }): Promise<void>;
704
- }
705
-
706
727
  declare type DefaultReporterOptions = {
707
728
  /**
708
729
  * prints out summary of all tests
@@ -1037,26 +1058,6 @@ export declare const getTestEntries: ({ include, exclude, rootPath, projectRoot,
1037
1058
  projectRoot: string;
1038
1059
  }) => Promise<Record<string, string>>;
1039
1060
 
1040
- declare class GithubActionsReporter {
1041
- private onWritePath;
1042
- private rootPath;
1043
- constructor({ options, rootPath, }: {
1044
- rootPath: string;
1045
- options: {
1046
- onWritePath: (path: string) => string;
1047
- };
1048
- });
1049
- private log;
1050
- onTestRunEnd({ results, testResults, getSourcemap, }: {
1051
- results: TestFileResult[];
1052
- testResults: TestResult[];
1053
- duration: Duration;
1054
- snapshotSummary: SnapshotSummary;
1055
- getSourcemap: GetSourcemap;
1056
- filterRerunTestPaths?: string[];
1057
- }): Promise<void>;
1058
- }
1059
-
1060
1061
  export declare const globalApis: (keyof Rstest_2)[];
1061
1062
 
1062
1063
  declare interface HtmlOptions {
@@ -1488,28 +1489,6 @@ declare type JsonOptions = FileOptions;
1488
1489
 
1489
1490
  declare type JsonSummaryOptions = FileOptions;
1490
1491
 
1491
- declare class JUnitReporter implements Reporter {
1492
- private rootPath;
1493
- private outputPath?;
1494
- constructor({ rootPath, options: { outputPath }, }: {
1495
- rootPath: string;
1496
- options?: {
1497
- outputPath?: string;
1498
- };
1499
- });
1500
- private sanitizeXml;
1501
- private escapeXml;
1502
- private createJUnitTestCase;
1503
- private createJUnitTestSuite;
1504
- private generateJUnitXml;
1505
- onTestRunEnd({ results, testResults, duration, getSourcemap, }: {
1506
- getSourcemap: GetSourcemap;
1507
- results: TestFileResult[];
1508
- testResults: TestResult[];
1509
- duration: Duration;
1510
- }): Promise<void>;
1511
- }
1512
-
1513
1492
  declare interface LcovOnlyOptions extends FileOptions, ProjectOptions {}
1514
1493
 
1515
1494
  declare interface LcovOptions extends FileOptions, ProjectOptions {}
@@ -1527,6 +1506,11 @@ export declare type ListCommandResult = {
1527
1506
  errors?: FormattedError[];
1528
1507
  };
1529
1508
 
1509
+ export declare const loadCoverageProvider: (options: CoverageOptions, root: string) => Promise<{
1510
+ CoverageProvider: typeof CoverageProvider;
1511
+ pluginCoverage: (options: CoverageOptions) => RsbuildPlugin;
1512
+ }>;
1513
+
1530
1514
  declare type Location_2 = {
1531
1515
  line: number;
1532
1516
  column: number;
@@ -1603,6 +1587,91 @@ declare type MaybePartiallyMockedDeep<T> = T extends Constructor ? MockedClass<T
1603
1587
 
1604
1588
  declare type MaybePromise<T> = T | Promise<T>;
1605
1589
 
1590
+ declare type MdReporterOptions = {
1591
+ /**
1592
+ * Output detail level preset.
1593
+ * - `'normal'`: balanced output with code frames, repro commands, and candidate files
1594
+ * - `'compact'`: minimal output without code frames, candidate files, or full stack traces
1595
+ * - `'full'`: verbose output including console logs and environment info
1596
+ * @default 'normal'
1597
+ */
1598
+ preset?: 'normal' | 'compact' | 'full';
1599
+ /**
1600
+ * Header section controls.
1601
+ * - `false`: omit all header extras (runtime/env)
1602
+ * - `true`: include all default header extras
1603
+ * - object form: toggle individual parts
1604
+ * @default { env: true }
1605
+ */
1606
+ header?: boolean | {
1607
+ env?: boolean;
1608
+ };
1609
+ /**
1610
+ * Reproduction command controls.
1611
+ * - `false`: omit reproduction commands
1612
+ * - `'file'`: only include the test file path
1613
+ * - `'file+name'`: include both file path and `--testNamePattern`
1614
+ * - `true`: same as `'file+name'`
1615
+ * @default 'file+name'
1616
+ */
1617
+ reproduction?: boolean | 'file' | 'file+name';
1618
+ /**
1619
+ * Failure output controls.
1620
+ * @default { max: 50 }
1621
+ */
1622
+ failures?: {
1623
+ max?: number;
1624
+ };
1625
+ /**
1626
+ * Code frame controls.
1627
+ * - `false`: disable code frames
1628
+ * - `true`: enable with default line window
1629
+ * - object form: customize line window
1630
+ * @default { linesAbove: 2, linesBelow: 2 }
1631
+ */
1632
+ codeFrame?: boolean | {
1633
+ linesAbove?: number;
1634
+ linesBelow?: number;
1635
+ };
1636
+ /**
1637
+ * Stack output controls.
1638
+ * - `false`: omit stack info
1639
+ * - `'top'`: include only the top frame
1640
+ * - `number`: include up to N stack frames
1641
+ * - `'full'`: include a large default number of stack frames
1642
+ * @default 'top'
1643
+ */
1644
+ stack?: number | false | 'full' | 'top';
1645
+ /**
1646
+ * Candidate files controls (best-effort files extracted from stack traces).
1647
+ * - `false`: omit candidate files
1648
+ * - `true`: enable with defaults
1649
+ * - object form: customize max items
1650
+ * @default { max: 5 }
1651
+ */
1652
+ candidateFiles?: boolean | {
1653
+ max?: number;
1654
+ };
1655
+ /**
1656
+ * Console output controls.
1657
+ * - `false`: omit console logs
1658
+ * - `true`: include console logs with defaults
1659
+ * - object form: customize limits
1660
+ * @default { maxLogsPerTestPath: 10, maxCharsPerEntry: 500 }
1661
+ */
1662
+ console?: boolean | {
1663
+ maxLogsPerTestPath?: number;
1664
+ maxCharsPerEntry?: number;
1665
+ };
1666
+ /**
1667
+ * Error section controls.
1668
+ * @default { unhandled: true }
1669
+ */
1670
+ errors?: boolean | {
1671
+ unhandled?: boolean;
1672
+ };
1673
+ };
1674
+
1606
1675
  declare type Methods<T> = {
1607
1676
  [K in keyof T]: T[K] extends MockProcedure ? K : never;
1608
1677
  }[keyof T];
@@ -2177,7 +2246,7 @@ export declare const onTestFinished: Rstest_2['onTestFinished'];
2177
2246
 
2178
2247
  declare type OnTestFinishedHandler = (ctx: TestContext) => MaybePromise<void>;
2179
2248
 
2180
- declare type OptionalKeys = 'testNamePattern' | 'plugins' | 'source' | 'resolve' | 'output' | 'performance' | 'tools' | 'dev' | 'onConsoleLog' | 'chaiConfig' | 'hideSkippedTestFiles' | 'resolveSnapshotPath' | 'extends';
2249
+ declare type OptionalKeys = 'testNamePattern' | 'plugins' | 'source' | 'resolve' | 'output' | 'performance' | 'tools' | 'dev' | 'onConsoleLog' | 'chaiConfig' | 'hideSkippedTestFiles' | 'resolveSnapshotPath' | 'extends' | 'shard';
2181
2250
 
2182
2251
  declare interface Options {
2183
2252
  logger: {
@@ -2252,7 +2321,7 @@ declare type Project = {
2252
2321
  configFilePath?: string;
2253
2322
  };
2254
2323
 
2255
- declare type ProjectConfig = Omit<RstestConfig, 'projects' | 'reporters' | 'pool' | 'isolate' | 'coverage' | 'resolveSnapshotPath' | 'onConsoleLog' | 'hideSkippedTests' | 'hideSkippedTestFiles' | 'bail'>;
2324
+ declare type ProjectConfig = Omit<RstestConfig, 'projects' | 'reporters' | 'pool' | 'isolate' | 'coverage' | 'resolveSnapshotPath' | 'onConsoleLog' | 'bail' | 'shard'>;
2256
2325
 
2257
2326
  export declare type ProjectContext = {
2258
2327
  name: string;
@@ -2370,13 +2439,6 @@ export declare interface Reporter {
2370
2439
  onExit?: () => void;
2371
2440
  }
2372
2441
 
2373
- declare const reportersMap: {
2374
- default: typeof DefaultReporter;
2375
- verbose: typeof VerboseReporter;
2376
- 'github-actions': typeof GithubActionsReporter;
2377
- junit: typeof JUnitReporter;
2378
- };
2379
-
2380
2442
  declare type ReporterWithOptions<Name extends BuiltInReporterNames = BuiltInReporterNames> = Name extends keyof BuiltinReporterOptions ? [Name, Partial<BuiltinReporterOptions[Name]>] : [Name, Record<string, unknown>];
2381
2443
 
2382
2444
  declare interface ReportOptions {
@@ -2538,6 +2600,14 @@ declare interface RstestConfig {
2538
2600
  * @default 0
2539
2601
  */
2540
2602
  bail?: number;
2603
+ /**
2604
+ * Split tests into several shards.
2605
+ * This is useful for running tests in parallel on multiple machines.
2606
+ */
2607
+ shard?: {
2608
+ count: number;
2609
+ index: number;
2610
+ };
2541
2611
  /**
2542
2612
  * print console traces when calling any console method.
2543
2613
  *
@@ -3176,19 +3246,6 @@ declare interface SourceMapV3 {
3176
3246
 
3177
3247
  declare type SourcesIndex = number;
3178
3248
 
3179
- declare class StatusRenderer {
3180
- private rootPath;
3181
- private renderer;
3182
- private startTime;
3183
- private testState;
3184
- constructor(rootPath: string, state: RstestTestState, logger?: Options['logger']);
3185
- getContent(): string[];
3186
- onTestFileStart(): void;
3187
- onTestCaseResult(): void;
3188
- onTestFileResult(): void;
3189
- clear(): void;
3190
- }
3191
-
3192
3249
  declare function stringify(object: unknown, maxDepth?: number, { maxLength,...options }?: StringifyOptions): string;
3193
3250
 
3194
3251
  declare interface StringifyOptions extends PrettyFormatOptions {
@@ -3473,17 +3530,6 @@ export declare interface UserConsoleLog {
3473
3530
  type: 'stdout' | 'stderr';
3474
3531
  }
3475
3532
 
3476
- declare class VerboseReporter extends DefaultReporter {
3477
- private verboseOptions;
3478
- constructor({ rootPath, options, config, testState, }: {
3479
- rootPath: string;
3480
- config: NormalizedConfig;
3481
- options: VerboseReporterOptions;
3482
- testState: RstestTestState;
3483
- });
3484
- onTestFileResult(test: TestFileResult): void;
3485
- }
3486
-
3487
3533
  declare type VerboseReporterOptions = Omit<DefaultReporterOptions, 'summary'>;
3488
3534
 
3489
3535
  declare interface Visitor<N extends Node_2 = Node_2> {
package/dist/browser.js CHANGED
@@ -1,8 +1,8 @@
1
- import 'module';
2
- /*#__PURE__*/ import.meta.url;
1
+ import "node:module";
3
2
  export { TEMP_RSTEST_OUTPUT_DIR, getTestEntries, globalApis } from "./1157.js";
4
3
  export { afterAll, afterEach, assert, beforeAll, beforeEach, describe, expect, it, onTestFailed, onTestFinished, rs, rsbuild, rstest, test } from "./4484.js";
5
4
  export { color, isDebug, logger, serializableConfig } from "./3160.js";
6
5
  export { createRstestRuntime } from "./6151.js";
7
6
  export { getSetupFiles } from "./6973.js";
7
+ export { loadCoverageProvider } from "./5734.js";
8
8
  export { setRealTimers } from "./1294.js";
@@ -1,5 +1,4 @@
1
- import 'module';
2
- /*#__PURE__*/ import.meta.url;
1
+ import "node:module";
3
2
  import { __webpack_require__ } from "./rslib-runtime.js";
4
3
  import "./487.js";
5
4
  import { color } from "./3160.js";
package/dist/index.d.ts CHANGED
@@ -312,11 +312,14 @@ declare type BrowserModeConfig = {
312
312
  */
313
313
  declare type BrowserName = 'chromium' | 'firefox' | 'webkit';
314
314
 
315
- declare type BuiltInReporterNames = keyof typeof reportersMap;
315
+ declare type BuiltInReporterNames = 'default' | 'verbose' | 'md' | 'github-actions' | 'junit';
316
316
 
317
317
  declare type BuiltinReporterOptions = {
318
318
  default: DefaultReporterOptions;
319
319
  verbose: VerboseReporterOptions;
320
+ md: MdReporterOptions;
321
+ 'github-actions': Record<string, unknown>;
322
+ junit: Record<string, unknown>;
320
323
  };
321
324
 
322
325
  declare type ChaiConfig = Partial<Omit<typeof config, 'useProxy' | 'proxyExcludedKeys' | 'deepEqual'>>;
@@ -408,6 +411,7 @@ declare type CommonOptions = {
408
411
  hideSkippedTests?: boolean;
409
412
  hideSkippedTestFiles?: boolean;
410
413
  bail?: number | boolean;
414
+ shard?: string;
411
415
  };
412
416
 
413
417
  declare type CompareKeys = ((a: string, b: string) => number) | null | undefined;
@@ -712,40 +716,6 @@ declare class DefaultMap<
712
716
  get(key: K): V;
713
717
  }
714
718
 
715
- declare class DefaultReporter implements Reporter {
716
- protected rootPath: string;
717
- protected config: NormalizedConfig;
718
- private options;
719
- protected statusRenderer: StatusRenderer | undefined;
720
- private testState;
721
- constructor({ rootPath, options, config, testState, }: {
722
- rootPath: string;
723
- config: NormalizedConfig;
724
- options: DefaultReporterOptions;
725
- testState: RstestTestState;
726
- });
727
- /**
728
- * Lazily create StatusRenderer on first test file start.
729
- * This avoids intercepting stdout/stderr before tests actually begin,
730
- * ensuring early errors (like missing Playwright browsers) remain visible.
731
- */
732
- private ensureStatusRenderer;
733
- onTestFileStart(): void;
734
- onTestFileResult(test: TestFileResult): void;
735
- onTestCaseResult(): void;
736
- onUserConsoleLog(log: UserConsoleLog): void;
737
- onExit(): Promise<void>;
738
- onTestRunEnd({ results, testResults, duration, getSourcemap, snapshotSummary, filterRerunTestPaths, unhandledErrors, }: {
739
- results: TestFileResult[];
740
- testResults: TestResult[];
741
- duration: Duration;
742
- snapshotSummary: SnapshotSummary;
743
- getSourcemap: GetSourcemap;
744
- unhandledErrors?: Error[];
745
- filterRerunTestPaths?: string[];
746
- }): Promise<void>;
747
- }
748
-
749
719
  declare type DefaultReporterOptions = {
750
720
  /**
751
721
  * prints out summary of all tests
@@ -1090,26 +1060,6 @@ declare function getMatcherUtils(): {
1090
1060
 
1091
1061
  declare type GetSourcemap = (sourcePath: string) => Promise<SourceMapInput | null>;
1092
1062
 
1093
- declare class GithubActionsReporter {
1094
- private onWritePath;
1095
- private rootPath;
1096
- constructor({ options, rootPath, }: {
1097
- rootPath: string;
1098
- options: {
1099
- onWritePath: (path: string) => string;
1100
- };
1101
- });
1102
- private log;
1103
- onTestRunEnd({ results, testResults, getSourcemap, }: {
1104
- results: TestFileResult[];
1105
- testResults: TestResult[];
1106
- duration: Duration;
1107
- snapshotSummary: SnapshotSummary;
1108
- getSourcemap: GetSourcemap;
1109
- filterRerunTestPaths?: string[];
1110
- }): Promise<void>;
1111
- }
1112
-
1113
1063
  declare interface HtmlOptions {
1114
1064
  verbose: boolean;
1115
1065
  skipEmpty: boolean;
@@ -1543,28 +1493,6 @@ declare type JsonOptions = FileOptions;
1543
1493
 
1544
1494
  declare type JsonSummaryOptions = FileOptions;
1545
1495
 
1546
- declare class JUnitReporter implements Reporter {
1547
- private rootPath;
1548
- private outputPath?;
1549
- constructor({ rootPath, options: { outputPath }, }: {
1550
- rootPath: string;
1551
- options?: {
1552
- outputPath?: string;
1553
- };
1554
- });
1555
- private sanitizeXml;
1556
- private escapeXml;
1557
- private createJUnitTestCase;
1558
- private createJUnitTestSuite;
1559
- private generateJUnitXml;
1560
- onTestRunEnd({ results, testResults, duration, getSourcemap, }: {
1561
- getSourcemap: GetSourcemap;
1562
- results: TestFileResult[];
1563
- testResults: TestResult[];
1564
- duration: Duration;
1565
- }): Promise<void>;
1566
- }
1567
-
1568
1496
  declare interface LcovOnlyOptions extends FileOptions, ProjectOptions {}
1569
1497
 
1570
1498
  declare interface LcovOptions extends FileOptions, ProjectOptions {}
@@ -1671,6 +1599,91 @@ declare type MaybePartiallyMockedDeep<T> = T extends Constructor ? MockedClass<T
1671
1599
 
1672
1600
  declare type MaybePromise<T> = T | Promise<T>;
1673
1601
 
1602
+ declare type MdReporterOptions = {
1603
+ /**
1604
+ * Output detail level preset.
1605
+ * - `'normal'`: balanced output with code frames, repro commands, and candidate files
1606
+ * - `'compact'`: minimal output without code frames, candidate files, or full stack traces
1607
+ * - `'full'`: verbose output including console logs and environment info
1608
+ * @default 'normal'
1609
+ */
1610
+ preset?: 'normal' | 'compact' | 'full';
1611
+ /**
1612
+ * Header section controls.
1613
+ * - `false`: omit all header extras (runtime/env)
1614
+ * - `true`: include all default header extras
1615
+ * - object form: toggle individual parts
1616
+ * @default { env: true }
1617
+ */
1618
+ header?: boolean | {
1619
+ env?: boolean;
1620
+ };
1621
+ /**
1622
+ * Reproduction command controls.
1623
+ * - `false`: omit reproduction commands
1624
+ * - `'file'`: only include the test file path
1625
+ * - `'file+name'`: include both file path and `--testNamePattern`
1626
+ * - `true`: same as `'file+name'`
1627
+ * @default 'file+name'
1628
+ */
1629
+ reproduction?: boolean | 'file' | 'file+name';
1630
+ /**
1631
+ * Failure output controls.
1632
+ * @default { max: 50 }
1633
+ */
1634
+ failures?: {
1635
+ max?: number;
1636
+ };
1637
+ /**
1638
+ * Code frame controls.
1639
+ * - `false`: disable code frames
1640
+ * - `true`: enable with default line window
1641
+ * - object form: customize line window
1642
+ * @default { linesAbove: 2, linesBelow: 2 }
1643
+ */
1644
+ codeFrame?: boolean | {
1645
+ linesAbove?: number;
1646
+ linesBelow?: number;
1647
+ };
1648
+ /**
1649
+ * Stack output controls.
1650
+ * - `false`: omit stack info
1651
+ * - `'top'`: include only the top frame
1652
+ * - `number`: include up to N stack frames
1653
+ * - `'full'`: include a large default number of stack frames
1654
+ * @default 'top'
1655
+ */
1656
+ stack?: number | false | 'full' | 'top';
1657
+ /**
1658
+ * Candidate files controls (best-effort files extracted from stack traces).
1659
+ * - `false`: omit candidate files
1660
+ * - `true`: enable with defaults
1661
+ * - object form: customize max items
1662
+ * @default { max: 5 }
1663
+ */
1664
+ candidateFiles?: boolean | {
1665
+ max?: number;
1666
+ };
1667
+ /**
1668
+ * Console output controls.
1669
+ * - `false`: omit console logs
1670
+ * - `true`: include console logs with defaults
1671
+ * - object form: customize limits
1672
+ * @default { maxLogsPerTestPath: 10, maxCharsPerEntry: 500 }
1673
+ */
1674
+ console?: boolean | {
1675
+ maxLogsPerTestPath?: number;
1676
+ maxCharsPerEntry?: number;
1677
+ };
1678
+ /**
1679
+ * Error section controls.
1680
+ * @default { unhandled: true }
1681
+ */
1682
+ errors?: boolean | {
1683
+ unhandled?: boolean;
1684
+ };
1685
+ };
1686
+
1674
1687
  export declare const mergeProjectConfig: (...configs: ProjectConfig[]) => ProjectConfig;
1675
1688
 
1676
1689
  export declare const mergeRstestConfig: (...configs: RstestConfig[]) => RstestConfig;
@@ -2253,7 +2266,7 @@ export declare const onTestFinished: Rstest['onTestFinished'];
2253
2266
 
2254
2267
  declare type OnTestFinishedHandler = (ctx: TestContext) => MaybePromise<void>;
2255
2268
 
2256
- declare type OptionalKeys = 'testNamePattern' | 'plugins' | 'source' | 'resolve' | 'output' | 'performance' | 'tools' | 'dev' | 'onConsoleLog' | 'chaiConfig' | 'hideSkippedTestFiles' | 'resolveSnapshotPath' | 'extends';
2269
+ declare type OptionalKeys = 'testNamePattern' | 'plugins' | 'source' | 'resolve' | 'output' | 'performance' | 'tools' | 'dev' | 'onConsoleLog' | 'chaiConfig' | 'hideSkippedTestFiles' | 'resolveSnapshotPath' | 'extends' | 'shard';
2257
2270
 
2258
2271
  declare interface Options {
2259
2272
  logger: {
@@ -2320,7 +2333,7 @@ declare type Project = {
2320
2333
  configFilePath?: string;
2321
2334
  };
2322
2335
 
2323
- export declare type ProjectConfig = Omit<RstestConfig, 'projects' | 'reporters' | 'pool' | 'isolate' | 'coverage' | 'resolveSnapshotPath' | 'onConsoleLog' | 'hideSkippedTests' | 'hideSkippedTestFiles' | 'bail'>;
2336
+ export declare type ProjectConfig = Omit<RstestConfig, 'projects' | 'reporters' | 'pool' | 'isolate' | 'coverage' | 'resolveSnapshotPath' | 'onConsoleLog' | 'bail' | 'shard'>;
2324
2337
 
2325
2338
  declare type ProjectConfigAsyncFn = () => Promise<ProjectConfig | NestedProjectConfig>;
2326
2339
 
@@ -2442,13 +2455,6 @@ export declare interface Reporter {
2442
2455
  onExit?: () => void;
2443
2456
  }
2444
2457
 
2445
- declare const reportersMap: {
2446
- default: typeof DefaultReporter;
2447
- verbose: typeof VerboseReporter;
2448
- 'github-actions': typeof GithubActionsReporter;
2449
- junit: typeof JUnitReporter;
2450
- };
2451
-
2452
2458
  declare type ReporterWithOptions<Name extends BuiltInReporterNames = BuiltInReporterNames> = Name extends keyof BuiltinReporterOptions ? [Name, Partial<BuiltinReporterOptions[Name]>] : [Name, Record<string, unknown>];
2453
2459
 
2454
2460
  declare interface ReportOptions {
@@ -2588,6 +2594,14 @@ export declare interface RstestConfig {
2588
2594
  * @default 0
2589
2595
  */
2590
2596
  bail?: number;
2597
+ /**
2598
+ * Split tests into several shards.
2599
+ * This is useful for running tests in parallel on multiple machines.
2600
+ */
2601
+ shard?: {
2602
+ count: number;
2603
+ index: number;
2604
+ };
2591
2605
  /**
2592
2606
  * print console traces when calling any console method.
2593
2607
  *
@@ -3191,19 +3205,6 @@ declare interface SourceMapV3 {
3191
3205
 
3192
3206
  declare type SourcesIndex = number;
3193
3207
 
3194
- declare class StatusRenderer {
3195
- private rootPath;
3196
- private renderer;
3197
- private startTime;
3198
- private testState;
3199
- constructor(rootPath: string, state: RstestTestState, logger?: Options['logger']);
3200
- getContent(): string[];
3201
- onTestFileStart(): void;
3202
- onTestCaseResult(): void;
3203
- onTestFileResult(): void;
3204
- clear(): void;
3205
- }
3206
-
3207
3208
  declare function stringify(object: unknown, maxDepth?: number, { maxLength,...options }?: StringifyOptions): string;
3208
3209
 
3209
3210
  declare interface StringifyOptions extends PrettyFormatOptions {
@@ -3486,17 +3487,6 @@ declare interface UserConsoleLog {
3486
3487
  type: 'stdout' | 'stderr';
3487
3488
  }
3488
3489
 
3489
- declare class VerboseReporter extends DefaultReporter {
3490
- private verboseOptions;
3491
- constructor({ rootPath, options, config, testState, }: {
3492
- rootPath: string;
3493
- config: NormalizedConfig;
3494
- options: VerboseReporterOptions;
3495
- testState: RstestTestState;
3496
- });
3497
- onTestFileResult(test: TestFileResult): void;
3498
- }
3499
-
3500
3490
  declare type VerboseReporterOptions = Omit<DefaultReporterOptions, 'summary'>;
3501
3491
 
3502
3492
  declare interface Visitor<N extends Node_2 = Node_2> {
package/dist/index.js CHANGED
@@ -1,4 +1,3 @@
1
- import 'module';
2
- /*#__PURE__*/ import.meta.url;
1
+ import "node:module";
3
2
  export { afterAll, afterEach, assert, beforeAll, beforeEach, describe, expect, it, onTestFailed, onTestFinished, rs, rstest, test } from "./4484.js";
4
3
  export { createRstest, defineConfig, defineProject, initCli, loadConfig, mergeProjectConfig, mergeRstestConfig, runCLI } from "./9131.js";