@rstest/core 0.6.5 → 0.6.6

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.
@@ -596,6 +596,7 @@ declare class DefaultReporter implements Reporter {
596
596
  onTestFileStart(test: TestFileInfo): void;
597
597
  onTestFileResult(test: TestFileResult): void;
598
598
  onTestCaseResult(result: TestResult): void;
599
+ onTestCaseStart(test: TestCaseInfo): void;
599
600
  onUserConsoleLog(log: UserConsoleLog): void;
600
601
  onExit(): Promise<void>;
601
602
  onTestRunEnd({ results, testResults, duration, getSourcemap, snapshotSummary, filterRerunTestPaths, }: {
@@ -655,6 +656,7 @@ export declare const describe: Rstest['describe'];
655
656
  declare interface DescribeEachFn {
656
657
  <T extends Record<string, unknown>>(cases: readonly T[]): (description: string, fn?: (param: T) => MaybePromise<void>) => void;
657
658
  <T extends readonly [unknown, ...unknown[]]>(cases: readonly T[]): (description: string, fn: (...args: [...T]) => MaybePromise<void>) => void;
659
+ <T>(cases: readonly T[]): (description: string, fn: (param: T) => MaybePromise<void>) => void;
658
660
  }
659
661
 
660
662
  declare type DescribeFn = (description: string, fn?: () => void) => void;
@@ -2075,6 +2077,10 @@ export declare interface Reporter {
2075
2077
  * Called when the test has finished running or was just skipped.
2076
2078
  */
2077
2079
  onTestCaseResult?: (result: TestResult) => void;
2080
+ /**
2081
+ * Called before running the test case.
2082
+ */
2083
+ onTestCaseStart?: (test: TestCaseInfo) => void;
2078
2084
  /**
2079
2085
  * Called after all tests have finished running.
2080
2086
  */
@@ -2490,6 +2496,10 @@ export declare interface RstestUtilities {
2490
2496
  * Update runtime config for the current test.
2491
2497
  */
2492
2498
  setConfig: (config: RuntimeOptions) => void;
2499
+ /**
2500
+ * get runtime config for the current test.
2501
+ */
2502
+ getConfig: () => RuntimeOptions;
2493
2503
  /**
2494
2504
  * Reset runtime config that were changed with `rstest.setConfig`.
2495
2505
  */
@@ -2723,6 +2733,7 @@ declare class StatusRenderer {
2723
2733
  getContent(): string[];
2724
2734
  onTestFileStart(testPath: string): void;
2725
2735
  onTestCaseResult(result: TestResult): void;
2736
+ onTestCaseStart(test: TestCaseInfo): void;
2726
2737
  onTestFileResult(test: TestFileResult): void;
2727
2738
  clear(): void;
2728
2739
  }
@@ -2773,6 +2784,16 @@ declare type TestAPIs<ExtraContext = object> = TestAPI<ExtraContext> & {
2773
2784
 
2774
2785
  declare type TestCallbackFn<ExtraContext = object> = (context: TestContext & ExtraContext) => MaybePromise<void>;
2775
2786
 
2787
+ export declare type TestCaseInfo = {
2788
+ testId: string;
2789
+ testPath: TestPath;
2790
+ name: string;
2791
+ timeout?: number;
2792
+ parentNames?: string[];
2793
+ project: string;
2794
+ startTime?: number;
2795
+ };
2796
+
2776
2797
  declare type TestContext = {
2777
2798
  expect: Expect;
2778
2799
  onTestFinished: RunnerAPI['onTestFinished'];
@@ -2816,6 +2837,7 @@ declare type TestPath = string;
2816
2837
  declare type TestProject = string | ProjectConfig;
2817
2838
 
2818
2839
  export declare type TestResult = {
2840
+ testId: string;
2819
2841
  status: TestResultStatus;
2820
2842
  name: string;
2821
2843
  testPath: TestPath;
@@ -502,6 +502,7 @@ declare class DefaultReporter implements Reporter {
502
502
  onTestFileStart(test: TestFileInfo): void;
503
503
  onTestFileResult(test: TestFileResult): void;
504
504
  onTestCaseResult(result: TestResult): void;
505
+ onTestCaseStart(test: TestCaseInfo): void;
505
506
  onUserConsoleLog(log: UserConsoleLog): void;
506
507
  onExit(): Promise<void>;
507
508
  onTestRunEnd({ results, testResults, duration, getSourcemap, snapshotSummary, filterRerunTestPaths, }: {
@@ -537,6 +538,7 @@ declare type DescribeAPI = DescribeFn & {
537
538
  declare interface DescribeEachFn {
538
539
  <T extends Record<string, unknown>>(cases: readonly T[]): (description: string, fn?: (param: T) => MaybePromise<void>) => void;
539
540
  <T extends readonly [unknown, ...unknown[]]>(cases: readonly T[]): (description: string, fn: (...args: [...T]) => MaybePromise<void>) => void;
541
+ <T>(cases: readonly T[]): (description: string, fn: (param: T) => MaybePromise<void>) => void;
540
542
  }
541
543
 
542
544
  declare type DescribeFn = (description: string, fn?: () => void) => void;
@@ -1725,6 +1727,10 @@ declare interface Reporter {
1725
1727
  * Called when the test has finished running or was just skipped.
1726
1728
  */
1727
1729
  onTestCaseResult?: (result: TestResult) => void;
1730
+ /**
1731
+ * Called before running the test case.
1732
+ */
1733
+ onTestCaseStart?: (test: TestCaseInfo) => void;
1728
1734
  /**
1729
1735
  * Called after all tests have finished running.
1730
1736
  */
@@ -2055,6 +2061,7 @@ declare type RuntimeRPC = {
2055
2061
  assetFiles: Record<string, string>;
2056
2062
  sourceMaps: Record<string, string>;
2057
2063
  }>;
2064
+ onTestCaseStart: (test: TestCaseInfo) => Promise<void>;
2058
2065
  onTestCaseResult: (result: TestResult) => Promise<void>;
2059
2066
  getCountOfFailedTests: () => Promise<number>;
2060
2067
  onConsoleLog: (log: UserConsoleLog) => void;
@@ -2257,6 +2264,7 @@ declare class StatusRenderer {
2257
2264
  getContent(): string[];
2258
2265
  onTestFileStart(testPath: string): void;
2259
2266
  onTestCaseResult(result: TestResult): void;
2267
+ onTestCaseStart(test: TestCaseInfo): void;
2260
2268
  onTestFileResult(test: TestFileResult): void;
2261
2269
  clear(): void;
2262
2270
  }
@@ -2324,13 +2332,10 @@ declare type TestAPIs<ExtraContext = object> = TestAPI<ExtraContext> & {
2324
2332
 
2325
2333
  declare type TestCallbackFn<ExtraContext = object> = (context: TestContext & ExtraContext) => MaybePromise<void>;
2326
2334
 
2327
- declare type TestCase = {
2328
- testPath: TestPath;
2329
- name: string;
2335
+ declare type TestCase = TestCaseInfo & {
2330
2336
  originalFn?: (context: TestContext) => void | Promise<void>;
2331
2337
  fn?: (context: TestContext) => void | Promise<void>;
2332
2338
  runMode: TestRunMode;
2333
- timeout?: number;
2334
2339
  fails?: boolean;
2335
2340
  each?: boolean;
2336
2341
  fixtures?: NormalizedFixtures;
@@ -2342,7 +2347,6 @@ declare type TestCase = {
2342
2347
  onFinished: OnTestFinishedHandler[];
2343
2348
  onFailed: OnTestFailedHandler[];
2344
2349
  type: 'case';
2345
- parentNames?: string[];
2346
2350
  /**
2347
2351
  * Store promises (from async expects) to wait for them before finishing the test
2348
2352
  */
@@ -2351,7 +2355,16 @@ declare type TestCase = {
2351
2355
  * Result of the task. if `expect.soft()` failed multiple times or `retry` was triggered.
2352
2356
  */
2353
2357
  result?: TaskResult;
2358
+ };
2359
+
2360
+ declare type TestCaseInfo = {
2361
+ testId: string;
2362
+ testPath: TestPath;
2363
+ name: string;
2364
+ timeout?: number;
2365
+ parentNames?: string[];
2354
2366
  project: string;
2367
+ startTime?: number;
2355
2368
  };
2356
2369
 
2357
2370
  declare type TestContext = {
@@ -2397,6 +2410,7 @@ declare type TestPath = string;
2397
2410
  declare type TestProject = string | ProjectConfig;
2398
2411
 
2399
2412
  declare type TestResult = {
2413
+ testId: string;
2400
2414
  status: TestResultStatus;
2401
2415
  name: string;
2402
2416
  testPath: TestPath;
@@ -2423,6 +2437,7 @@ declare class TestStateManager {
2423
2437
  }
2424
2438
 
2425
2439
  declare type TestSuite = {
2440
+ testId: string;
2426
2441
  name: string;
2427
2442
  parentNames?: string[];
2428
2443
  runMode: TestRunMode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rstest/core",
3
- "version": "0.6.5",
3
+ "version": "0.6.6",
4
4
  "description": "The Rsbuild-based test tool.",
5
5
  "bugs": {
6
6
  "url": "https://github.com/web-infra-dev/rstest/issues"
File without changes
File without changes
File without changes