@rstest/core 0.8.1 → 0.8.2

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.
@@ -1207,5 +1207,3 @@ class Bundle {
1207
1207
  }
1208
1208
  }
1209
1209
  export { Bundle, MagicString, SourceMap };
1210
-
1211
- //# sourceMappingURL=2~907.js.map
@@ -18176,7 +18176,7 @@ const castArray = (arr)=>{
18176
18176
  ];
18177
18177
  };
18178
18178
  const getTaskNames = (test)=>(test.parentNames || []).concat(test.name).filter(Boolean);
18179
- const getTaskNameWithPrefix = (test, delimiter = ">")=>getTaskNames(test).join(` ${delimiter} `);
18179
+ const getTaskNameWithPrefix = (test, delimiter = ">")=>getTaskNames(test).join(delimiter ? ` ${delimiter} ` : ' ');
18180
18180
  void 0 !== helper_process && helper_process.versions?.deno;
18181
18181
  const build_0 = __webpack_require__("../../node_modules/.pnpm/jest-diff@30.2.0/node_modules/jest-diff/build/index.js");
18182
18182
  build_0.DIFF_DELETE;
@@ -20842,7 +20842,8 @@ function hasOnlyTest(test) {
20842
20842
  }
20843
20843
  const shouldTestSkip = (test, runOnly, testNamePattern)=>{
20844
20844
  if (runOnly && 'only' !== test.runMode) return true;
20845
- if (testNamePattern && !getTaskNameWithPrefix(test, '').match(testNamePattern)) return true;
20845
+ const delimiter = testNamePattern?.toString().includes(">") ? ">" : '';
20846
+ if (testNamePattern && !getTaskNameWithPrefix(test, delimiter).match(testNamePattern)) return true;
20846
20847
  return false;
20847
20848
  };
20848
20849
  const traverseUpdateTestRunMode = (testSuite, parentRunMode, runOnly, testNamePattern)=>{
@@ -21092,13 +21093,16 @@ class TestRunner {
21092
21093
  result.errors ??= [];
21093
21094
  result.errors.push(...formatTestError(error));
21094
21095
  }
21095
- if ('fail' === result.status) for (const fn of [
21096
- ...test.onFailed
21097
- ].reverse())try {
21098
- await fn(test.context);
21099
- } catch (error) {
21100
- result.errors ??= [];
21101
- result.errors.push(...formatTestError(error));
21096
+ if ('fail' === result.status) {
21097
+ for (const fn of [
21098
+ ...test.onFailed
21099
+ ].reverse())try {
21100
+ await fn(test.context);
21101
+ } catch (error) {
21102
+ result.errors ??= [];
21103
+ result.errors.push(...formatTestError(error));
21104
+ }
21105
+ snapshotClient.skipTest(testPath, getTaskNameWithPrefix(test));
21102
21106
  }
21103
21107
  this.resetCurrentTest();
21104
21108
  return result;
@@ -22669,5 +22673,3 @@ const rs = wrapRstestUtilitiesAPI('rs');
22669
22673
  const onTestFinished = wrapRstestAPI('onTestFinished');
22670
22674
  const onTestFailed = wrapRstestAPI('onTestFailed');
22671
22675
  export { afterAll, afterEach, beforeAll, beforeEach, createRstestRuntime, globalApis, onTestFailed, onTestFinished, public_assert as assert, public_describe as describe, public_expect as expect, public_it as it, public_rstest as rstest, public_test as test, rs, setRealTimers };
22672
-
22673
- //# sourceMappingURL=389.js.map
@@ -336,11 +336,14 @@ declare type BrowserModeConfig = {
336
336
  */
337
337
  declare type BrowserName = 'chromium' | 'firefox' | 'webkit';
338
338
 
339
- declare type BuiltInReporterNames = keyof typeof reportersMap;
339
+ declare type BuiltInReporterNames = 'default' | 'verbose' | 'md' | 'github-actions' | 'junit';
340
340
 
341
341
  declare type BuiltinReporterOptions = {
342
342
  default: DefaultReporterOptions;
343
343
  verbose: VerboseReporterOptions;
344
+ md: MdReporterOptions;
345
+ 'github-actions': Record<string, unknown>;
346
+ junit: Record<string, unknown>;
344
347
  };
345
348
 
346
349
  declare type ChaiConfig = Partial<Omit<typeof config, 'useProxy' | 'proxyExcludedKeys' | 'deepEqual'>>;
@@ -423,7 +426,7 @@ declare interface Coverage {
423
426
  coverage: number;
424
427
  }
425
428
 
426
- declare interface CoverageMapData {
429
+ export declare interface CoverageMapData {
427
430
  [key: string]: FileCoverage | FileCoverageData;
428
431
  }
429
432
 
@@ -588,40 +591,6 @@ declare class DefaultMap<
588
591
  get(key: K): V;
589
592
  }
590
593
 
591
- declare class DefaultReporter implements Reporter {
592
- protected rootPath: string;
593
- protected config: NormalizedConfig;
594
- private options;
595
- protected statusRenderer: StatusRenderer | undefined;
596
- private testState;
597
- constructor({ rootPath, options, config, testState, }: {
598
- rootPath: string;
599
- config: NormalizedConfig;
600
- options: DefaultReporterOptions;
601
- testState: RstestTestState;
602
- });
603
- /**
604
- * Lazily create StatusRenderer on first test file start.
605
- * This avoids intercepting stdout/stderr before tests actually begin,
606
- * ensuring early errors (like missing Playwright browsers) remain visible.
607
- */
608
- private ensureStatusRenderer;
609
- onTestFileStart(): void;
610
- onTestFileResult(test: TestFileResult): void;
611
- onTestCaseResult(): void;
612
- onUserConsoleLog(log: UserConsoleLog): void;
613
- onExit(): Promise<void>;
614
- onTestRunEnd({ results, testResults, duration, getSourcemap, snapshotSummary, filterRerunTestPaths, unhandledErrors, }: {
615
- results: TestFileResult[];
616
- testResults: TestResult[];
617
- duration: Duration;
618
- snapshotSummary: SnapshotSummary;
619
- getSourcemap: GetSourcemap;
620
- unhandledErrors?: Error[];
621
- filterRerunTestPaths?: string[];
622
- }): Promise<void>;
623
- }
624
-
625
594
  declare type DefaultReporterOptions = {
626
595
  /**
627
596
  * prints out summary of all tests
@@ -896,26 +865,6 @@ declare function getMatcherUtils(): {
896
865
 
897
866
  declare type GetSourcemap = (sourcePath: string) => Promise<SourceMapInput | null>;
898
867
 
899
- declare class GithubActionsReporter {
900
- private onWritePath;
901
- private rootPath;
902
- constructor({ options, rootPath, }: {
903
- rootPath: string;
904
- options: {
905
- onWritePath: (path: string) => string;
906
- };
907
- });
908
- private log;
909
- onTestRunEnd({ results, testResults, getSourcemap, }: {
910
- results: TestFileResult[];
911
- testResults: TestResult[];
912
- duration: Duration;
913
- snapshotSummary: SnapshotSummary;
914
- getSourcemap: GetSourcemap;
915
- filterRerunTestPaths?: string[];
916
- }): Promise<void>;
917
- }
918
-
919
868
  export declare const globalApis: (keyof Rstest)[];
920
869
 
921
870
  declare interface HtmlOptions {
@@ -1343,28 +1292,6 @@ declare type JsonOptions = FileOptions;
1343
1292
 
1344
1293
  declare type JsonSummaryOptions = FileOptions;
1345
1294
 
1346
- declare class JUnitReporter implements Reporter {
1347
- private rootPath;
1348
- private outputPath?;
1349
- constructor({ rootPath, options: { outputPath }, }: {
1350
- rootPath: string;
1351
- options?: {
1352
- outputPath?: string;
1353
- };
1354
- });
1355
- private sanitizeXml;
1356
- private escapeXml;
1357
- private createJUnitTestCase;
1358
- private createJUnitTestSuite;
1359
- private generateJUnitXml;
1360
- onTestRunEnd({ results, testResults, duration, getSourcemap, }: {
1361
- getSourcemap: GetSourcemap;
1362
- results: TestFileResult[];
1363
- testResults: TestResult[];
1364
- duration: Duration;
1365
- }): Promise<void>;
1366
- }
1367
-
1368
1295
  declare interface LcovOnlyOptions extends FileOptions, ProjectOptions {}
1369
1296
 
1370
1297
  declare interface LcovOptions extends FileOptions, ProjectOptions {}
@@ -1447,6 +1374,91 @@ declare type MaybePartiallyMockedDeep<T> = T extends Constructor ? MockedClass<T
1447
1374
 
1448
1375
  declare type MaybePromise<T> = T | Promise<T>;
1449
1376
 
1377
+ declare type MdReporterOptions = {
1378
+ /**
1379
+ * Output detail level preset.
1380
+ * - `'normal'`: balanced output with code frames, repro commands, and candidate files
1381
+ * - `'compact'`: minimal output without code frames, candidate files, or full stack traces
1382
+ * - `'full'`: verbose output including console logs and environment info
1383
+ * @default 'normal'
1384
+ */
1385
+ preset?: 'normal' | 'compact' | 'full';
1386
+ /**
1387
+ * Header section controls.
1388
+ * - `false`: omit all header extras (runtime/env)
1389
+ * - `true`: include all default header extras
1390
+ * - object form: toggle individual parts
1391
+ * @default { env: true }
1392
+ */
1393
+ header?: boolean | {
1394
+ env?: boolean;
1395
+ };
1396
+ /**
1397
+ * Reproduction command controls.
1398
+ * - `false`: omit reproduction commands
1399
+ * - `'file'`: only include the test file path
1400
+ * - `'file+name'`: include both file path and `--testNamePattern`
1401
+ * - `true`: same as `'file+name'`
1402
+ * @default 'file+name'
1403
+ */
1404
+ reproduction?: boolean | 'file' | 'file+name';
1405
+ /**
1406
+ * Failure output controls.
1407
+ * @default { max: 50 }
1408
+ */
1409
+ failures?: {
1410
+ max?: number;
1411
+ };
1412
+ /**
1413
+ * Code frame controls.
1414
+ * - `false`: disable code frames
1415
+ * - `true`: enable with default line window
1416
+ * - object form: customize line window
1417
+ * @default { linesAbove: 2, linesBelow: 2 }
1418
+ */
1419
+ codeFrame?: boolean | {
1420
+ linesAbove?: number;
1421
+ linesBelow?: number;
1422
+ };
1423
+ /**
1424
+ * Stack output controls.
1425
+ * - `false`: omit stack info
1426
+ * - `'top'`: include only the top frame
1427
+ * - `number`: include up to N stack frames
1428
+ * - `'full'`: include a large default number of stack frames
1429
+ * @default 'top'
1430
+ */
1431
+ stack?: number | false | 'full' | 'top';
1432
+ /**
1433
+ * Candidate files controls (best-effort files extracted from stack traces).
1434
+ * - `false`: omit candidate files
1435
+ * - `true`: enable with defaults
1436
+ * - object form: customize max items
1437
+ * @default { max: 5 }
1438
+ */
1439
+ candidateFiles?: boolean | {
1440
+ max?: number;
1441
+ };
1442
+ /**
1443
+ * Console output controls.
1444
+ * - `false`: omit console logs
1445
+ * - `true`: include console logs with defaults
1446
+ * - object form: customize limits
1447
+ * @default { maxLogsPerTestPath: 10, maxCharsPerEntry: 500 }
1448
+ */
1449
+ console?: boolean | {
1450
+ maxLogsPerTestPath?: number;
1451
+ maxCharsPerEntry?: number;
1452
+ };
1453
+ /**
1454
+ * Error section controls.
1455
+ * @default { unhandled: true }
1456
+ */
1457
+ errors?: boolean | {
1458
+ unhandled?: boolean;
1459
+ };
1460
+ };
1461
+
1450
1462
  declare type Methods<T> = {
1451
1463
  [K in keyof T]: T[K] extends MockProcedure ? K : never;
1452
1464
  }[keyof T];
@@ -1712,7 +1724,7 @@ export declare const onTestFinished: Rstest['onTestFinished'];
1712
1724
 
1713
1725
  declare type OnTestFinishedHandler = (ctx: TestContext) => MaybePromise<void>;
1714
1726
 
1715
- declare type OptionalKeys = 'testNamePattern' | 'plugins' | 'source' | 'resolve' | 'output' | 'performance' | 'tools' | 'dev' | 'onConsoleLog' | 'chaiConfig' | 'hideSkippedTestFiles' | 'resolveSnapshotPath' | 'extends';
1727
+ declare type OptionalKeys = 'testNamePattern' | 'plugins' | 'source' | 'resolve' | 'output' | 'performance' | 'tools' | 'dev' | 'onConsoleLog' | 'chaiConfig' | 'hideSkippedTestFiles' | 'resolveSnapshotPath' | 'extends' | 'shard';
1716
1728
 
1717
1729
  declare interface Options {
1718
1730
  logger: {
@@ -1739,7 +1751,7 @@ declare function printWithType<T>(name: string, value: T, print: (value: T) => s
1739
1751
 
1740
1752
  declare type Procedure = (...args: any[]) => any;
1741
1753
 
1742
- declare type ProjectConfig = Omit<RstestConfig, 'projects' | 'reporters' | 'pool' | 'isolate' | 'coverage' | 'resolveSnapshotPath' | 'onConsoleLog' | 'hideSkippedTests' | 'hideSkippedTestFiles' | 'bail'>;
1754
+ declare type ProjectConfig = Omit<RstestConfig, 'projects' | 'reporters' | 'pool' | 'isolate' | 'coverage' | 'resolveSnapshotPath' | 'onConsoleLog' | 'hideSkippedTests' | 'hideSkippedTestFiles' | 'bail' | 'shard'>;
1743
1755
 
1744
1756
  declare type ProjectContext = {
1745
1757
  name: string;
@@ -1855,13 +1867,6 @@ declare interface Reporter {
1855
1867
  onExit?: () => void;
1856
1868
  }
1857
1869
 
1858
- declare const reportersMap: {
1859
- default: typeof DefaultReporter;
1860
- verbose: typeof VerboseReporter;
1861
- 'github-actions': typeof GithubActionsReporter;
1862
- junit: typeof JUnitReporter;
1863
- };
1864
-
1865
1870
  declare type ReporterWithOptions<Name extends BuiltInReporterNames = BuiltInReporterNames> = Name extends keyof BuiltinReporterOptions ? [Name, Partial<BuiltinReporterOptions[Name]>] : [Name, Record<string, unknown>];
1866
1871
 
1867
1872
  declare interface ReportOptions {
@@ -1999,6 +2004,14 @@ declare interface RstestConfig {
1999
2004
  * @default 0
2000
2005
  */
2001
2006
  bail?: number;
2007
+ /**
2008
+ * Split tests into several shards.
2009
+ * This is useful for running tests in parallel on multiple machines.
2010
+ */
2011
+ shard?: {
2012
+ count: number;
2013
+ index: number;
2014
+ };
2002
2015
  /**
2003
2016
  * print console traces when calling any console method.
2004
2017
  *
@@ -2631,19 +2644,6 @@ declare interface SourceMapV3 {
2631
2644
 
2632
2645
  declare type SourcesIndex = number;
2633
2646
 
2634
- declare class StatusRenderer {
2635
- private rootPath;
2636
- private renderer;
2637
- private startTime;
2638
- private testState;
2639
- constructor(rootPath: string, state: RstestTestState, logger?: Options['logger']);
2640
- getContent(): string[];
2641
- onTestFileStart(): void;
2642
- onTestCaseResult(): void;
2643
- onTestFileResult(): void;
2644
- clear(): void;
2645
- }
2646
-
2647
2647
  declare type SuiteContext = {
2648
2648
  filepath: TestPath;
2649
2649
  };
@@ -2918,17 +2918,6 @@ declare interface UserConsoleLog {
2918
2918
  type: 'stdout' | 'stderr';
2919
2919
  }
2920
2920
 
2921
- declare class VerboseReporter extends DefaultReporter {
2922
- private verboseOptions;
2923
- constructor({ rootPath, options, config, testState, }: {
2924
- rootPath: string;
2925
- config: NormalizedConfig;
2926
- options: VerboseReporterOptions;
2927
- testState: RstestTestState;
2928
- });
2929
- onTestFileResult(test: TestFileResult): void;
2930
- }
2931
-
2932
2921
  declare type VerboseReporterOptions = Omit<DefaultReporterOptions, 'summary'>;
2933
2922
 
2934
2923
  declare interface Visitor<N extends Node_2 = Node_2> {
@@ -46,5 +46,3 @@ __webpack_require__.m = __webpack_modules__;
46
46
  };
47
47
  })();
48
48
  export { __webpack_require__ };
49
-
50
- //# sourceMappingURL=rslib-runtime.js.map