@rstest/core 0.8.4 → 0.9.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/dist/{0~9348.js → 0~1240.js} +41 -41
- package/dist/0~1472.js +2 -2
- package/dist/0~2173.js +84 -71
- package/dist/{0~3919.js → 0~262.js} +31 -30
- package/dist/0~3062.js +1 -1
- package/dist/0~3346.js +1 -1
- package/dist/0~6923.js +1 -1
- package/dist/0~7882.js +23 -22
- package/dist/0~89.js +32 -29
- package/dist/0~9634.js +5 -5
- package/dist/1294.js +2 -1
- package/dist/3160.js +3 -48
- package/dist/{9869.js → 4597.js} +33 -44
- package/dist/6151.js +108 -31
- package/dist/9131.js +30 -15
- package/dist/browser-runtime/389.js +144 -92
- package/dist/browser-runtime/index.d.ts +40 -10
- package/dist/browser.d.ts +53 -10
- package/dist/index.d.ts +41 -79
- package/dist/mockRuntimeCode.js +15 -4
- package/dist/worker.d.ts +13 -1521
- package/dist/worker.js +14 -34
- package/package.json +14 -13
package/dist/browser.d.ts
CHANGED
|
@@ -338,6 +338,11 @@ declare type BrowserModeConfig = {
|
|
|
338
338
|
*/
|
|
339
339
|
declare type BrowserName = 'chromium' | 'firefox' | 'webkit';
|
|
340
340
|
|
|
341
|
+
declare interface BrowserSourcemapResolutionResult {
|
|
342
|
+
handled: boolean;
|
|
343
|
+
sourcemap: SourceMapInput | null;
|
|
344
|
+
}
|
|
345
|
+
|
|
341
346
|
/**
|
|
342
347
|
* Options for running browser tests.
|
|
343
348
|
*/
|
|
@@ -375,6 +380,12 @@ export declare interface BrowserTestRunResult {
|
|
|
375
380
|
hasFailure: boolean;
|
|
376
381
|
/** Errors that occurred before/outside test execution (e.g., browser launch failure) */
|
|
377
382
|
unhandledErrors?: Error[];
|
|
383
|
+
/** Source map resolver used when reporter output is unified in core */
|
|
384
|
+
getSourcemap?: GetSourcemap;
|
|
385
|
+
/** Route-aware source map resolver used by core unified reporter flow */
|
|
386
|
+
resolveSourcemap?: ResolveBrowserSourcemap;
|
|
387
|
+
/** Deferred cleanup hook for unified reporter mode */
|
|
388
|
+
close?: () => Promise<void>;
|
|
378
389
|
}
|
|
379
390
|
|
|
380
391
|
declare type BrowserViewport = {
|
|
@@ -681,7 +692,7 @@ declare type CoverageThresholds = CoverageThreshold | (CoverageThreshold & Thres
|
|
|
681
692
|
export declare const createRstestRuntime: (workerState: WorkerState) => Promise<{
|
|
682
693
|
runner: {
|
|
683
694
|
runTests: (testPath: string, hooks: RunnerHooks, api: Rstest_2) => Promise<TestFileResult>;
|
|
684
|
-
collectTests: () => Promise<
|
|
695
|
+
collectTests: () => Promise<TestInfo[]>;
|
|
685
696
|
getCurrentTest: () => TestCase | undefined;
|
|
686
697
|
};
|
|
687
698
|
api: Rstest_2;
|
|
@@ -1527,7 +1538,7 @@ declare interface LinkMapper {
|
|
|
1527
1538
|
}
|
|
1528
1539
|
|
|
1529
1540
|
export declare type ListCommandResult = {
|
|
1530
|
-
tests:
|
|
1541
|
+
tests: TestInfo[];
|
|
1531
1542
|
testPath: string;
|
|
1532
1543
|
project: string;
|
|
1533
1544
|
errors?: FormattedError[];
|
|
@@ -1642,6 +1653,13 @@ declare type MdReporterOptions = {
|
|
|
1642
1653
|
* @default 'file+name'
|
|
1643
1654
|
*/
|
|
1644
1655
|
reproduction?: boolean | 'file' | 'file+name';
|
|
1656
|
+
/**
|
|
1657
|
+
* Test lists (Passed / Skipped / Todo) display mode.
|
|
1658
|
+
* - `'auto'`: show only when all tests pass and the run is focused
|
|
1659
|
+
* - `'always'`: always show regardless of test status or focus
|
|
1660
|
+
* @default 'auto'
|
|
1661
|
+
*/
|
|
1662
|
+
testLists?: 'auto' | 'always';
|
|
1645
1663
|
/**
|
|
1646
1664
|
* Failure output controls.
|
|
1647
1665
|
* @default { max: 50 }
|
|
@@ -2274,7 +2292,7 @@ export declare const onTestFinished: Rstest_2['onTestFinished'];
|
|
|
2274
2292
|
|
|
2275
2293
|
declare type OnTestFinishedHandler = (ctx: TestContext) => MaybePromise<void>;
|
|
2276
2294
|
|
|
2277
|
-
declare type OptionalKeys = 'testNamePattern' | 'plugins' | 'source' | 'resolve' | 'output' | '
|
|
2295
|
+
declare type OptionalKeys = 'testNamePattern' | 'plugins' | 'source' | 'resolve' | 'output' | 'tools' | 'dev' | 'onConsoleLog' | 'chaiConfig' | 'hideSkippedTestFiles' | 'resolveSnapshotPath' | 'extends' | 'shard';
|
|
2278
2296
|
|
|
2279
2297
|
declare interface Options {
|
|
2280
2298
|
logger: {
|
|
@@ -2487,6 +2505,8 @@ declare interface ReportOptions {
|
|
|
2487
2505
|
|
|
2488
2506
|
declare type ReportWithOptions<Name extends keyof ReportOptions = keyof ReportOptions> = Name extends keyof ReportOptions ? [Name, Partial<ReportOptions[Name]>] : [Name, Record<string, unknown>];
|
|
2489
2507
|
|
|
2508
|
+
declare type ResolveBrowserSourcemap = (sourcePath: string) => Promise<BrowserSourcemapResolutionResult>;
|
|
2509
|
+
|
|
2490
2510
|
declare type Ro<T> = T extends Array<infer V> ? V[] | Readonly<V[]> | RoArray<V> | Readonly<RoArray<V>> : T extends object ? T | Readonly<T> | RoObject<T> | Readonly<RoObject<T>> : T;
|
|
2491
2511
|
|
|
2492
2512
|
declare type RoArray<T> = Ro<T>[];
|
|
@@ -2711,7 +2731,7 @@ declare interface RstestConfig {
|
|
|
2711
2731
|
*/
|
|
2712
2732
|
unstubGlobals?: boolean;
|
|
2713
2733
|
/**
|
|
2714
|
-
* Restores all
|
|
2734
|
+
* Restores all runtime env values that were changed with `rstest.stubEnv` before every test.
|
|
2715
2735
|
* @default false
|
|
2716
2736
|
*/
|
|
2717
2737
|
unstubEnvs?: boolean;
|
|
@@ -2757,7 +2777,6 @@ declare interface RstestConfig {
|
|
|
2757
2777
|
includeTaskLocation?: boolean;
|
|
2758
2778
|
plugins?: RsbuildConfig['plugins'];
|
|
2759
2779
|
source?: Pick<NonNullable<RsbuildConfig['source']>, 'define' | 'tsconfigPath' | 'decorators' | 'include' | 'exclude'>;
|
|
2760
|
-
performance?: Pick<NonNullable<RsbuildConfig['performance']>, 'bundleAnalyze'>;
|
|
2761
2780
|
dev?: Pick<NonNullable<RsbuildConfig['dev']>, 'writeToDisk'>;
|
|
2762
2781
|
output?: Pick<NonNullable<RsbuildConfig['output']>, 'cssModules' | 'externals' | 'cleanDistPath' | 'module'>;
|
|
2763
2782
|
resolve?: RsbuildConfig['resolve'];
|
|
@@ -2978,11 +2997,12 @@ declare interface RstestUtilities {
|
|
|
2978
2997
|
*/
|
|
2979
2998
|
resetModules: () => RstestUtilities;
|
|
2980
2999
|
/**
|
|
2981
|
-
* Changes the value of
|
|
3000
|
+
* Changes the value of an environment variable in the current runtime env store.
|
|
3001
|
+
* Uses `process.env` in Node.js and runtime env store in browser mode.
|
|
2982
3002
|
*/
|
|
2983
3003
|
stubEnv: (name: string, value: string | undefined) => RstestUtilities;
|
|
2984
3004
|
/**
|
|
2985
|
-
* Restores all
|
|
3005
|
+
* Restores all env values that were changed with `rstest.stubEnv`.
|
|
2986
3006
|
*/
|
|
2987
3007
|
unstubAllEnvs: () => RstestUtilities;
|
|
2988
3008
|
/**
|
|
@@ -3034,6 +3054,17 @@ declare interface RstestUtilities {
|
|
|
3034
3054
|
* Removes all timers that are scheduled to run.
|
|
3035
3055
|
*/
|
|
3036
3056
|
clearAllTimers: () => RstestUtilities;
|
|
3057
|
+
/**
|
|
3058
|
+
* Retry callback until it succeeds (doesn't throw) or timeout is reached.
|
|
3059
|
+
* If timeout is reached, throws the last error from the callback.
|
|
3060
|
+
*/
|
|
3061
|
+
waitFor: <T>(callback: WaitForCallback<T>, options?: number | WaitForOptions) => Promise<T>;
|
|
3062
|
+
/**
|
|
3063
|
+
* Retry callback until it returns a truthy value or timeout is reached.
|
|
3064
|
+
* If callback throws, it interrupts immediately and throws that error.
|
|
3065
|
+
* If timeout is reached, throws an error.
|
|
3066
|
+
*/
|
|
3067
|
+
waitUntil: <T>(callback: () => MaybePromise<T>, options?: number | WaitUntilOptions) => Promise<T>;
|
|
3037
3068
|
}
|
|
3038
3069
|
|
|
3039
3070
|
declare type RunnerAPI = {
|
|
@@ -3349,7 +3380,6 @@ declare type TestCallbackFn<ExtraContext = object> = (context: TestContext & Ext
|
|
|
3349
3380
|
declare type TestCase = TestCaseInfo & {
|
|
3350
3381
|
originalFn?: (context: TestContext) => void | Promise<void>;
|
|
3351
3382
|
fn?: (context: TestContext) => void | Promise<void>;
|
|
3352
|
-
runMode: TestRunMode;
|
|
3353
3383
|
fails?: boolean;
|
|
3354
3384
|
each?: boolean;
|
|
3355
3385
|
fixtures?: NormalizedFixtures;
|
|
@@ -3385,6 +3415,7 @@ declare type TestCaseInfo = {
|
|
|
3385
3415
|
/** Only included when `includeTaskLocation` config is enabled */
|
|
3386
3416
|
location?: Location_2;
|
|
3387
3417
|
type: 'case';
|
|
3418
|
+
runMode: TestRunMode;
|
|
3388
3419
|
};
|
|
3389
3420
|
|
|
3390
3421
|
declare type TestContext = {
|
|
@@ -3422,7 +3453,7 @@ declare type TestFileInfo = {
|
|
|
3422
3453
|
export declare type TestFileResult = TestResult & {
|
|
3423
3454
|
results: TestResult[];
|
|
3424
3455
|
snapshotResult?: SnapshotResult;
|
|
3425
|
-
coverage?:
|
|
3456
|
+
coverage?: Record<string, FileCoverageData>;
|
|
3426
3457
|
};
|
|
3427
3458
|
|
|
3428
3459
|
declare type TestFn<ExtraContext = object> = (description: string, fn?: TestCallbackFn<ExtraContext>, timeout?: number) => void;
|
|
@@ -3471,7 +3502,6 @@ declare class TestStateManager {
|
|
|
3471
3502
|
}
|
|
3472
3503
|
|
|
3473
3504
|
declare type TestSuite = TestSuiteInfo & {
|
|
3474
|
-
runMode: TestRunMode;
|
|
3475
3505
|
each?: boolean;
|
|
3476
3506
|
inTestEach?: boolean;
|
|
3477
3507
|
concurrent?: boolean;
|
|
@@ -3493,6 +3523,7 @@ declare type TestSuiteInfo = {
|
|
|
3493
3523
|
type: 'suite';
|
|
3494
3524
|
/** Only included when `includeTaskLocation` config is enabled */
|
|
3495
3525
|
location?: Location_2;
|
|
3526
|
+
runMode: TestRunMode;
|
|
3496
3527
|
};
|
|
3497
3528
|
|
|
3498
3529
|
declare type TextLcovOptions = ProjectOptions;
|
|
@@ -3573,6 +3604,18 @@ declare type VitestAssertion<
|
|
|
3573
3604
|
T
|
|
3574
3605
|
> = { [K in keyof A] : A[K] extends Chai.Assertion ? Assertion_2<T> : A[K] extends (...args: any[]) => any ? A[K] : VitestAssertion<A[K], T> } & ((type: string, message?: string) => Assertion_2);
|
|
3575
3606
|
|
|
3607
|
+
declare type WaitForCallback<T> = () => MaybePromise<T>;
|
|
3608
|
+
|
|
3609
|
+
declare interface WaitForOptions {
|
|
3610
|
+
timeout?: number;
|
|
3611
|
+
interval?: number;
|
|
3612
|
+
}
|
|
3613
|
+
|
|
3614
|
+
declare interface WaitUntilOptions {
|
|
3615
|
+
timeout?: number;
|
|
3616
|
+
interval?: number;
|
|
3617
|
+
}
|
|
3618
|
+
|
|
3576
3619
|
declare type Watermark = [number, number];
|
|
3577
3620
|
|
|
3578
3621
|
declare interface Watermarks {
|
package/dist/index.d.ts
CHANGED
|
@@ -885,7 +885,7 @@ declare interface ExpectPollOptions {
|
|
|
885
885
|
message?: string;
|
|
886
886
|
}
|
|
887
887
|
|
|
888
|
-
declare interface ExpectStatic extends ExpectStatic_2 {
|
|
888
|
+
export declare interface ExpectStatic extends ExpectStatic_2 {
|
|
889
889
|
<T>(actual: T, message?: string): Assertion<T>;
|
|
890
890
|
unreachable: (message?: string) => never;
|
|
891
891
|
soft: <T>(actual: T, message?: string) => Assertion<T>;
|
|
@@ -1536,7 +1536,7 @@ declare type ListCommandOptions = {
|
|
|
1536
1536
|
};
|
|
1537
1537
|
|
|
1538
1538
|
declare type ListCommandResult = {
|
|
1539
|
-
tests:
|
|
1539
|
+
tests: TestInfo[];
|
|
1540
1540
|
testPath: string;
|
|
1541
1541
|
project: string;
|
|
1542
1542
|
errors?: FormattedError[];
|
|
@@ -1652,6 +1652,13 @@ declare type MdReporterOptions = {
|
|
|
1652
1652
|
* @default 'file+name'
|
|
1653
1653
|
*/
|
|
1654
1654
|
reproduction?: boolean | 'file' | 'file+name';
|
|
1655
|
+
/**
|
|
1656
|
+
* Test lists (Passed / Skipped / Todo) display mode.
|
|
1657
|
+
* - `'auto'`: show only when all tests pass and the run is focused
|
|
1658
|
+
* - `'always'`: always show regardless of test status or focus
|
|
1659
|
+
* @default 'auto'
|
|
1660
|
+
*/
|
|
1661
|
+
testLists?: 'auto' | 'always';
|
|
1655
1662
|
/**
|
|
1656
1663
|
* Failure output controls.
|
|
1657
1664
|
* @default { max: 50 }
|
|
@@ -2261,15 +2268,6 @@ export declare type NormalizedCoverageOptions = Required<Omit<CoverageOptions, '
|
|
|
2261
2268
|
include?: string[];
|
|
2262
2269
|
};
|
|
2263
2270
|
|
|
2264
|
-
declare type NormalizedFixture = {
|
|
2265
|
-
isFn: boolean;
|
|
2266
|
-
deps?: string[];
|
|
2267
|
-
value: FixtureFn<any, any, any> | any;
|
|
2268
|
-
options?: FixtureOptions;
|
|
2269
|
-
};
|
|
2270
|
-
|
|
2271
|
-
declare type NormalizedFixtures = Record<string, NormalizedFixture>;
|
|
2272
|
-
|
|
2273
2271
|
declare type NormalizedProcedure<T extends Procedure> = (...args: Parameters<T>) => ReturnType<T>;
|
|
2274
2272
|
|
|
2275
2273
|
declare type NormalizedProcedure_2<T extends Procedure_2> = (...args: Parameters<T>) => ReturnType<T>;
|
|
@@ -2292,7 +2290,7 @@ export declare const onTestFinished: Rstest['onTestFinished'];
|
|
|
2292
2290
|
|
|
2293
2291
|
declare type OnTestFinishedHandler = (ctx: TestContext) => MaybePromise<void>;
|
|
2294
2292
|
|
|
2295
|
-
declare type OptionalKeys = 'testNamePattern' | 'plugins' | 'source' | 'resolve' | 'output' | '
|
|
2293
|
+
declare type OptionalKeys = 'testNamePattern' | 'plugins' | 'source' | 'resolve' | 'output' | 'tools' | 'dev' | 'onConsoleLog' | 'chaiConfig' | 'hideSkippedTestFiles' | 'resolveSnapshotPath' | 'extends' | 'shard';
|
|
2296
2294
|
|
|
2297
2295
|
declare interface Options {
|
|
2298
2296
|
logger: {
|
|
@@ -2703,7 +2701,7 @@ export declare interface RstestConfig {
|
|
|
2703
2701
|
*/
|
|
2704
2702
|
unstubGlobals?: boolean;
|
|
2705
2703
|
/**
|
|
2706
|
-
* Restores all
|
|
2704
|
+
* Restores all runtime env values that were changed with `rstest.stubEnv` before every test.
|
|
2707
2705
|
* @default false
|
|
2708
2706
|
*/
|
|
2709
2707
|
unstubEnvs?: boolean;
|
|
@@ -2749,7 +2747,6 @@ export declare interface RstestConfig {
|
|
|
2749
2747
|
includeTaskLocation?: boolean;
|
|
2750
2748
|
plugins?: RsbuildConfig['plugins'];
|
|
2751
2749
|
source?: Pick<NonNullable<RsbuildConfig['source']>, 'define' | 'tsconfigPath' | 'decorators' | 'include' | 'exclude'>;
|
|
2752
|
-
performance?: Pick<NonNullable<RsbuildConfig['performance']>, 'bundleAnalyze'>;
|
|
2753
2750
|
dev?: Pick<NonNullable<RsbuildConfig['dev']>, 'writeToDisk'>;
|
|
2754
2751
|
output?: Pick<NonNullable<RsbuildConfig['output']>, 'cssModules' | 'externals' | 'cleanDistPath' | 'module'>;
|
|
2755
2752
|
resolve?: RsbuildConfig['resolve'];
|
|
@@ -2980,11 +2977,12 @@ export declare interface RstestUtilities {
|
|
|
2980
2977
|
*/
|
|
2981
2978
|
resetModules: () => RstestUtilities;
|
|
2982
2979
|
/**
|
|
2983
|
-
* Changes the value of
|
|
2980
|
+
* Changes the value of an environment variable in the current runtime env store.
|
|
2981
|
+
* Uses `process.env` in Node.js and runtime env store in browser mode.
|
|
2984
2982
|
*/
|
|
2985
2983
|
stubEnv: (name: string, value: string | undefined) => RstestUtilities;
|
|
2986
2984
|
/**
|
|
2987
|
-
* Restores all
|
|
2985
|
+
* Restores all env values that were changed with `rstest.stubEnv`.
|
|
2988
2986
|
*/
|
|
2989
2987
|
unstubAllEnvs: () => RstestUtilities;
|
|
2990
2988
|
/**
|
|
@@ -3036,9 +3034,20 @@ export declare interface RstestUtilities {
|
|
|
3036
3034
|
* Removes all timers that are scheduled to run.
|
|
3037
3035
|
*/
|
|
3038
3036
|
clearAllTimers: () => RstestUtilities;
|
|
3037
|
+
/**
|
|
3038
|
+
* Retry callback until it succeeds (doesn't throw) or timeout is reached.
|
|
3039
|
+
* If timeout is reached, throws the last error from the callback.
|
|
3040
|
+
*/
|
|
3041
|
+
waitFor: <T>(callback: WaitForCallback<T>, options?: number | WaitForOptions) => Promise<T>;
|
|
3042
|
+
/**
|
|
3043
|
+
* Retry callback until it returns a truthy value or timeout is reached.
|
|
3044
|
+
* If callback throws, it interrupts immediately and throws that error.
|
|
3045
|
+
* If timeout is reached, throws an error.
|
|
3046
|
+
*/
|
|
3047
|
+
waitUntil: <T>(callback: () => MaybePromise<T>, options?: number | WaitUntilOptions) => Promise<T>;
|
|
3039
3048
|
}
|
|
3040
3049
|
|
|
3041
|
-
export declare function runCLI():
|
|
3050
|
+
export declare function runCLI(): void;
|
|
3042
3051
|
|
|
3043
3052
|
declare type RunnerAPI = {
|
|
3044
3053
|
describe: Describe;
|
|
@@ -3253,23 +3262,6 @@ declare interface SyncExpectationResult {
|
|
|
3253
3262
|
expected?: any;
|
|
3254
3263
|
}
|
|
3255
3264
|
|
|
3256
|
-
declare interface TaskResult {
|
|
3257
|
-
/**
|
|
3258
|
-
* State of the task. Inherits the `task.mode` during collection.
|
|
3259
|
-
* When the task has finished, it will be changed to `pass` or `fail`.
|
|
3260
|
-
* - **pass**: task ran successfully
|
|
3261
|
-
* - **fail**: task failed
|
|
3262
|
-
*/
|
|
3263
|
-
state: TaskState;
|
|
3264
|
-
/**
|
|
3265
|
-
* Errors that occurred during the task execution. It is possible to have several errors
|
|
3266
|
-
* if `expect.soft()` failed multiple times or `retry` was triggered.
|
|
3267
|
-
*/
|
|
3268
|
-
errors?: FormattedError[];
|
|
3269
|
-
}
|
|
3270
|
-
|
|
3271
|
-
declare type TaskState = 'pass' | 'fail';
|
|
3272
|
-
|
|
3273
3265
|
declare interface TeamcityOptions extends FileOptions {
|
|
3274
3266
|
blockName: string;
|
|
3275
3267
|
}
|
|
@@ -3278,8 +3270,6 @@ declare type Test = (arg0: any) => boolean;
|
|
|
3278
3270
|
|
|
3279
3271
|
export declare const test: Rstest['test'];
|
|
3280
3272
|
|
|
3281
|
-
declare type Test_2 = TestSuite | TestCase;
|
|
3282
|
-
|
|
3283
3273
|
declare type TestAPI<ExtraContext = object> = TestFn<ExtraContext> & {
|
|
3284
3274
|
each: TestEachFn;
|
|
3285
3275
|
for: TestForFn<ExtraContext>;
|
|
@@ -3301,34 +3291,6 @@ declare type TestAPIs<ExtraContext = object> = TestAPI<ExtraContext> & {
|
|
|
3301
3291
|
|
|
3302
3292
|
declare type TestCallbackFn<ExtraContext = object> = (context: TestContext & ExtraContext) => MaybePromise<void>;
|
|
3303
3293
|
|
|
3304
|
-
declare type TestCase = TestCaseInfo & {
|
|
3305
|
-
originalFn?: (context: TestContext) => void | Promise<void>;
|
|
3306
|
-
fn?: (context: TestContext) => void | Promise<void>;
|
|
3307
|
-
runMode: TestRunMode;
|
|
3308
|
-
fails?: boolean;
|
|
3309
|
-
each?: boolean;
|
|
3310
|
-
fixtures?: NormalizedFixtures;
|
|
3311
|
-
concurrent?: boolean;
|
|
3312
|
-
sequential?: boolean;
|
|
3313
|
-
inTestEach?: boolean;
|
|
3314
|
-
context: TestContext;
|
|
3315
|
-
only?: boolean;
|
|
3316
|
-
onFinished: OnTestFinishedHandler[];
|
|
3317
|
-
onFailed: OnTestFailedHandler[];
|
|
3318
|
-
/**
|
|
3319
|
-
* Store promises (from async expects) to wait for them before finishing the test
|
|
3320
|
-
*/
|
|
3321
|
-
promises?: Promise<any>[];
|
|
3322
|
-
/**
|
|
3323
|
-
* Store stack trace error created when test is registered, used for trace original position
|
|
3324
|
-
*/
|
|
3325
|
-
stackTraceError: Error;
|
|
3326
|
-
/**
|
|
3327
|
-
* Result of the task. if `expect.soft()` failed multiple times or `retry` was triggered.
|
|
3328
|
-
*/
|
|
3329
|
-
result?: TaskResult;
|
|
3330
|
-
};
|
|
3331
|
-
|
|
3332
3294
|
export declare type TestCaseInfo = {
|
|
3333
3295
|
testId: string;
|
|
3334
3296
|
testPath: TestPath;
|
|
@@ -3340,6 +3302,7 @@ export declare type TestCaseInfo = {
|
|
|
3340
3302
|
/** Only included when `includeTaskLocation` config is enabled */
|
|
3341
3303
|
location?: Location_2;
|
|
3342
3304
|
type: 'case';
|
|
3305
|
+
runMode: TestRunMode;
|
|
3343
3306
|
};
|
|
3344
3307
|
|
|
3345
3308
|
declare type TestContext = {
|
|
@@ -3377,7 +3340,7 @@ export declare type TestFileInfo = {
|
|
|
3377
3340
|
export declare type TestFileResult = TestResult & {
|
|
3378
3341
|
results: TestResult[];
|
|
3379
3342
|
snapshotResult?: SnapshotResult;
|
|
3380
|
-
coverage?:
|
|
3343
|
+
coverage?: Record<string, FileCoverageData>;
|
|
3381
3344
|
};
|
|
3382
3345
|
|
|
3383
3346
|
declare type TestFn<ExtraContext = object> = (description: string, fn?: TestCallbackFn<ExtraContext>, timeout?: number) => void;
|
|
@@ -3425,20 +3388,6 @@ declare class TestStateManager {
|
|
|
3425
3388
|
reset(): void;
|
|
3426
3389
|
}
|
|
3427
3390
|
|
|
3428
|
-
declare type TestSuite = TestSuiteInfo & {
|
|
3429
|
-
runMode: TestRunMode;
|
|
3430
|
-
each?: boolean;
|
|
3431
|
-
inTestEach?: boolean;
|
|
3432
|
-
concurrent?: boolean;
|
|
3433
|
-
sequential?: boolean;
|
|
3434
|
-
/** nested cases and suite could in a suite */
|
|
3435
|
-
tests: Test_2[];
|
|
3436
|
-
afterAllListeners?: AfterAllListener[];
|
|
3437
|
-
beforeAllListeners?: BeforeAllListener[];
|
|
3438
|
-
afterEachListeners?: AfterEachListener[];
|
|
3439
|
-
beforeEachListeners?: BeforeEachListener[];
|
|
3440
|
-
};
|
|
3441
|
-
|
|
3442
3391
|
export declare type TestSuiteInfo = {
|
|
3443
3392
|
testId: string;
|
|
3444
3393
|
name: string;
|
|
@@ -3448,6 +3397,7 @@ export declare type TestSuiteInfo = {
|
|
|
3448
3397
|
type: 'suite';
|
|
3449
3398
|
/** Only included when `includeTaskLocation` config is enabled */
|
|
3450
3399
|
location?: Location_2;
|
|
3400
|
+
runMode: TestRunMode;
|
|
3451
3401
|
};
|
|
3452
3402
|
|
|
3453
3403
|
declare type TextLcovOptions = ProjectOptions;
|
|
@@ -3528,6 +3478,18 @@ declare type VitestAssertion<
|
|
|
3528
3478
|
T
|
|
3529
3479
|
> = { [K in keyof A] : A[K] extends Chai.Assertion ? Assertion_2<T> : A[K] extends (...args: any[]) => any ? A[K] : VitestAssertion<A[K], T> } & ((type: string, message?: string) => Assertion_2);
|
|
3530
3480
|
|
|
3481
|
+
declare type WaitForCallback<T> = () => MaybePromise<T>;
|
|
3482
|
+
|
|
3483
|
+
declare interface WaitForOptions {
|
|
3484
|
+
timeout?: number;
|
|
3485
|
+
interval?: number;
|
|
3486
|
+
}
|
|
3487
|
+
|
|
3488
|
+
declare interface WaitUntilOptions {
|
|
3489
|
+
timeout?: number;
|
|
3490
|
+
interval?: number;
|
|
3491
|
+
}
|
|
3492
|
+
|
|
3531
3493
|
declare type Watermark = [number, number];
|
|
3532
3494
|
|
|
3533
3495
|
declare interface Watermarks {
|
package/dist/mockRuntimeCode.js
CHANGED
|
@@ -40,7 +40,9 @@ __webpack_require__.rstest_require_actual = __webpack_require__.rstest_import_ac
|
|
|
40
40
|
}
|
|
41
41
|
return __webpack_require__(id);
|
|
42
42
|
};
|
|
43
|
-
const getMockImplementation = (mockType = 'mock')=>
|
|
43
|
+
const getMockImplementation = (mockType = 'mock')=>{
|
|
44
|
+
const isMockRequire = 'mockRequire' === mockType || 'doMockRequire' === mockType;
|
|
45
|
+
return (id, modFactory)=>{
|
|
44
46
|
let requiredModule = __webpack_module_cache__[id]?.exports;
|
|
45
47
|
const wasAlreadyLoaded = !!requiredModule;
|
|
46
48
|
if (requiredModule) {
|
|
@@ -66,7 +68,11 @@ const getMockImplementation = (mockType = 'mock')=>(id, modFactory)=>{
|
|
|
66
68
|
const mockedModule = globalThis.RSTEST_API?.rstest?.mockObject(originalModule, {
|
|
67
69
|
spy: isSpy
|
|
68
70
|
}) || originalModule;
|
|
69
|
-
const finalModFactory = function(
|
|
71
|
+
const finalModFactory = function(__webpack_module__, __webpack_exports__, __webpack_require__1) {
|
|
72
|
+
if (isMockRequire) {
|
|
73
|
+
__webpack_module__.exports = mockedModule;
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
70
76
|
__webpack_require__1.r(__webpack_exports__);
|
|
71
77
|
for(const key in mockedModule)__webpack_require__1.d(__webpack_exports__, {
|
|
72
78
|
[key]: ()=>mockedModule[key]
|
|
@@ -83,9 +89,13 @@ const getMockImplementation = (mockType = 'mock')=>(id, modFactory)=>{
|
|
|
83
89
|
exports: __webpack_require__(modFactory)
|
|
84
90
|
};
|
|
85
91
|
else if ('function' == typeof modFactory) {
|
|
86
|
-
const finalModFactory = function(
|
|
87
|
-
__webpack_require__1.r(__webpack_exports__);
|
|
92
|
+
const finalModFactory = function(__webpack_module__, __webpack_exports__, __webpack_require__1) {
|
|
88
93
|
const res = modFactory();
|
|
94
|
+
if (isMockRequire) {
|
|
95
|
+
__webpack_module__.exports = res;
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
__webpack_require__1.r(__webpack_exports__);
|
|
89
99
|
for(const key in res)__webpack_require__1.d(__webpack_exports__, {
|
|
90
100
|
[key]: ()=>res[key]
|
|
91
101
|
});
|
|
@@ -94,6 +104,7 @@ const getMockImplementation = (mockType = 'mock')=>(id, modFactory)=>{
|
|
|
94
104
|
delete __webpack_module_cache__[id];
|
|
95
105
|
}
|
|
96
106
|
};
|
|
107
|
+
};
|
|
97
108
|
__webpack_require__.rstest_mock = getMockImplementation('mock');
|
|
98
109
|
__webpack_require__.rstest_mock_require = getMockImplementation('mockRequire');
|
|
99
110
|
__webpack_require__.rstest_do_mock = getMockImplementation('doMock');
|