@rstest/core 0.2.1 → 0.3.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/{359.js → 12.js} +156 -94
- package/dist/{72.js → 171.js} +2 -1
- package/dist/223.js +135 -0
- package/dist/{920.js → 33.js} +125 -81
- package/dist/{44.js → 350.js} +6 -5
- package/dist/{813.js → 607.js} +16 -15
- package/dist/{208.js → 655.js} +60 -59
- package/dist/{355.js → 704.js} +17 -16
- package/dist/{965.js → 711.js} +6 -5
- package/dist/{443.js → 755.js} +2 -1
- package/dist/{723.js → 829.js} +5 -4
- package/dist/{867.js → 85.js} +140 -67
- package/dist/{668.js → 928.js} +3 -2
- package/dist/{25.js → 967.js} +19 -14
- package/dist/{64.js → 969.js} +2 -1
- package/dist/{285.js → 971.js} +66 -33
- package/dist/{854.js → 985.js} +153 -81
- package/dist/index.js +93 -121
- package/dist/worker.js +45 -38
- package/dist-types/index.d.ts +55 -3
- package/dist-types/worker.d.ts +124 -4
- package/globals.d.ts +2 -0
- package/package.json +6 -6
- /package/dist/{208.js.LICENSE.txt → 655.js.LICENSE.txt} +0 -0
- /package/dist/{668.js.LICENSE.txt → 928.js.LICENSE.txt} +0 -0
package/dist/{867.js → 85.js}
RENAMED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import 'module';
|
|
2
2
|
/*#__PURE__*/ import.meta.url;
|
|
3
|
+
export const __webpack_id__ = "85";
|
|
3
4
|
export const __webpack_ids__ = [
|
|
4
|
-
"
|
|
5
|
+
"85"
|
|
5
6
|
];
|
|
6
7
|
export const __webpack_modules__ = {
|
|
7
8
|
"./src/runtime/api/index.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
@@ -55,10 +56,10 @@ export const __webpack_modules__ = {
|
|
|
55
56
|
clearTimeout(timeoutId);
|
|
56
57
|
} catch (err) {
|
|
57
58
|
lastError = err;
|
|
58
|
-
if (!external_chai_.util.flag(assertion, '_isLastPollAttempt')) intervalId = (0, runtime_util.
|
|
59
|
+
if (!external_chai_.util.flag(assertion, '_isLastPollAttempt')) intervalId = (0, runtime_util.rZ)().setTimeout(check, interval);
|
|
59
60
|
}
|
|
60
61
|
};
|
|
61
|
-
timeoutId = (0, runtime_util.
|
|
62
|
+
timeoutId = (0, runtime_util.rZ)().setTimeout(()=>{
|
|
62
63
|
clearTimeout(intervalId);
|
|
63
64
|
external_chai_.util.flag(assertion, '_isLastPollAttempt', true);
|
|
64
65
|
const rejectWithCause = (cause)=>{
|
|
@@ -111,10 +112,10 @@ export const __webpack_modules__ = {
|
|
|
111
112
|
var snapshot_dist = __webpack_require__("../../node_modules/.pnpm/@vitest+snapshot@3.2.4/node_modules/@vitest/snapshot/dist/index.js");
|
|
112
113
|
let _client;
|
|
113
114
|
function getSnapshotClient() {
|
|
114
|
-
if (!_client) _client = new snapshot_dist.
|
|
115
|
-
isEqual: (received, expected)=>(0, dist.
|
|
116
|
-
dist.
|
|
117
|
-
dist.
|
|
115
|
+
if (!_client) _client = new snapshot_dist.s({
|
|
116
|
+
isEqual: (received, expected)=>(0, dist.aI)(received, expected, [
|
|
117
|
+
dist.D,
|
|
118
|
+
dist.j2
|
|
118
119
|
])
|
|
119
120
|
});
|
|
120
121
|
return _client;
|
|
@@ -181,7 +182,7 @@ export const __webpack_modules__ = {
|
|
|
181
182
|
function getTestNames(test) {
|
|
182
183
|
return {
|
|
183
184
|
filepath: test.testPath,
|
|
184
|
-
name: (0, src_utils.
|
|
185
|
+
name: (0, src_utils.fN)(test)
|
|
185
186
|
};
|
|
186
187
|
}
|
|
187
188
|
const SnapshotPlugin = (chai, utils)=>{
|
|
@@ -247,7 +248,7 @@ export const __webpack_modules__ = {
|
|
|
247
248
|
inlineSnapshot = properties;
|
|
248
249
|
properties = void 0;
|
|
249
250
|
}
|
|
250
|
-
if (inlineSnapshot) inlineSnapshot = (0, snapshot_dist.
|
|
251
|
+
if (inlineSnapshot) inlineSnapshot = (0, snapshot_dist.cN)(inlineSnapshot);
|
|
251
252
|
const errorMessage = utils.flag(this, 'message');
|
|
252
253
|
getSnapshotClient().assert({
|
|
253
254
|
received: expected,
|
|
@@ -285,7 +286,7 @@ export const __webpack_modules__ = {
|
|
|
285
286
|
const error = utils.flag(this, 'error');
|
|
286
287
|
const promise = utils.flag(this, 'promise');
|
|
287
288
|
const errorMessage = utils.flag(this, 'message');
|
|
288
|
-
if (inlineSnapshot) inlineSnapshot = (0, snapshot_dist.
|
|
289
|
+
if (inlineSnapshot) inlineSnapshot = (0, snapshot_dist.cN)(inlineSnapshot);
|
|
289
290
|
getSnapshotClient().assert({
|
|
290
291
|
received: getError(expected, promise),
|
|
291
292
|
message,
|
|
@@ -296,16 +297,16 @@ export const __webpack_modules__ = {
|
|
|
296
297
|
...getTestNames(test)
|
|
297
298
|
});
|
|
298
299
|
});
|
|
299
|
-
utils.addMethod(chai.expect, 'addSnapshotSerializer', snapshot_dist.
|
|
300
|
+
utils.addMethod(chai.expect, 'addSnapshotSerializer', snapshot_dist.U$);
|
|
300
301
|
};
|
|
301
|
-
external_chai_.use(dist.
|
|
302
|
-
external_chai_.use(dist.
|
|
302
|
+
external_chai_.use(dist.Xs);
|
|
303
|
+
external_chai_.use(dist.dB);
|
|
303
304
|
external_chai_.use(SnapshotPlugin);
|
|
304
|
-
external_chai_.use(dist.
|
|
305
|
+
external_chai_.use(dist.Mc);
|
|
305
306
|
function createExpect({ getCurrentTest, workerState }) {
|
|
306
307
|
const expect = (value, message)=>{
|
|
307
|
-
const { assertionCalls } = (0, dist.
|
|
308
|
-
(0, dist.
|
|
308
|
+
const { assertionCalls } = (0, dist.Gu)(expect);
|
|
309
|
+
(0, dist.wb)({
|
|
309
310
|
assertionCalls: assertionCalls + 1
|
|
310
311
|
}, expect);
|
|
311
312
|
const assert = external_chai_.expect(value, message);
|
|
@@ -314,11 +315,11 @@ export const __webpack_modules__ = {
|
|
|
314
315
|
return assert;
|
|
315
316
|
};
|
|
316
317
|
Object.assign(expect, external_chai_.expect);
|
|
317
|
-
Object.assign(expect, globalThis[dist.
|
|
318
|
-
expect.getState = ()=>(0, dist.
|
|
319
|
-
expect.setState = (state)=>(0, dist.
|
|
320
|
-
const globalState = (0, dist.
|
|
321
|
-
(0, dist.
|
|
318
|
+
Object.assign(expect, globalThis[dist.fs]);
|
|
319
|
+
expect.getState = ()=>(0, dist.Gu)(expect);
|
|
320
|
+
expect.setState = (state)=>(0, dist.wb)(state, expect);
|
|
321
|
+
const globalState = (0, dist.Gu)(globalThis[dist.mZ]) || {};
|
|
322
|
+
(0, dist.wb)({
|
|
322
323
|
...globalState,
|
|
323
324
|
assertionCalls: 0,
|
|
324
325
|
isExpectingAssertions: false,
|
|
@@ -330,7 +331,7 @@ export const __webpack_modules__ = {
|
|
|
330
331
|
}
|
|
331
332
|
}, expect);
|
|
332
333
|
expect.extend = (matchers)=>external_chai_.expect.extend(expect, matchers);
|
|
333
|
-
expect.addEqualityTesters = (customTesters)=>(0, dist.
|
|
334
|
+
expect.addEqualityTesters = (customTesters)=>(0, dist.TB)(customTesters);
|
|
334
335
|
expect.soft = (...args)=>expect(...args).withContext({
|
|
335
336
|
soft: true
|
|
336
337
|
});
|
|
@@ -356,7 +357,7 @@ export const __webpack_modules__ = {
|
|
|
356
357
|
}
|
|
357
358
|
external_chai_.util.addMethod(expect, 'assertions', assertions);
|
|
358
359
|
external_chai_.util.addMethod(expect, 'hasAssertions', hasAssertions);
|
|
359
|
-
expect.extend(dist.
|
|
360
|
+
expect.extend(dist.Pf);
|
|
360
361
|
return expect;
|
|
361
362
|
}
|
|
362
363
|
const normalizeFixtures = (fixtures = {}, extendFixtures = {})=>{
|
|
@@ -374,7 +375,7 @@ export const __webpack_modules__ = {
|
|
|
374
375
|
};
|
|
375
376
|
continue;
|
|
376
377
|
}
|
|
377
|
-
if ((0, src_utils.
|
|
378
|
+
if ((0, src_utils.Gv)(value[1]) && Object.keys(value[1]).some((key)=>fixtureOptionKeys.includes(key))) {
|
|
378
379
|
result[key] = {
|
|
379
380
|
isFn: 'function' == typeof value[0],
|
|
380
381
|
value: value[0],
|
|
@@ -504,7 +505,7 @@ export const __webpack_modules__ = {
|
|
|
504
505
|
}
|
|
505
506
|
const shouldTestSkip = (test, runOnly, testNamePattern)=>{
|
|
506
507
|
if (runOnly && 'only' !== test.runMode) return true;
|
|
507
|
-
if (testNamePattern && !(0, src_utils.
|
|
508
|
+
if (testNamePattern && !(0, src_utils.fN)(test, '').match(testNamePattern)) return true;
|
|
508
509
|
return false;
|
|
509
510
|
};
|
|
510
511
|
const traverseUpdateTestRunMode = (testSuite, parentRunMode, runOnly, testNamePattern)=>{
|
|
@@ -543,7 +544,7 @@ export const __webpack_modules__ = {
|
|
|
543
544
|
};
|
|
544
545
|
const updateTestParents = (tests, parentNames = [])=>{
|
|
545
546
|
for (const test of tests)if ('suite' === test.type) {
|
|
546
|
-
const names = test.name === src_utils.
|
|
547
|
+
const names = test.name === src_utils.q_ ? parentNames : parentNames.concat(test.name);
|
|
547
548
|
updateTestParents(test.tests, names);
|
|
548
549
|
} else test.parentNames = parentNames;
|
|
549
550
|
};
|
|
@@ -572,7 +573,7 @@ export const __webpack_modules__ = {
|
|
|
572
573
|
return async (...args)=>{
|
|
573
574
|
let timeoutId;
|
|
574
575
|
const timeoutPromise = new Promise((_, reject)=>{
|
|
575
|
-
timeoutId = (0, runtime_util.
|
|
576
|
+
timeoutId = (0, runtime_util.rZ)().setTimeout(()=>reject(makeError(`${name} timed out in ${timeout}ms`, stackTraceError)), timeout);
|
|
576
577
|
});
|
|
577
578
|
try {
|
|
578
579
|
const result = await Promise.race([
|
|
@@ -616,7 +617,7 @@ export const __webpack_modules__ = {
|
|
|
616
617
|
workerState;
|
|
617
618
|
async runTests({ tests, testPath, state, hooks, api }) {
|
|
618
619
|
this.workerState = state;
|
|
619
|
-
const { runtimeConfig: { passWithNoTests, retry, maxConcurrency }, snapshotOptions } = state;
|
|
620
|
+
const { runtimeConfig: { passWithNoTests, retry, maxConcurrency }, project, snapshotOptions } = state;
|
|
620
621
|
const results = [];
|
|
621
622
|
const errors = [];
|
|
622
623
|
let defaultStatus = 'pass';
|
|
@@ -627,12 +628,13 @@ export const __webpack_modules__ = {
|
|
|
627
628
|
await snapshotClient.setup(testPath, snapshotOptions);
|
|
628
629
|
const runTestsCase = async (test, parentHooks)=>{
|
|
629
630
|
if ('skip' === test.runMode) {
|
|
630
|
-
snapshotClient.skipTest(testPath, (0, src_utils.
|
|
631
|
+
snapshotClient.skipTest(testPath, (0, src_utils.fN)(test));
|
|
631
632
|
const result = {
|
|
632
633
|
status: 'skip',
|
|
633
634
|
parentNames: test.parentNames,
|
|
634
635
|
name: test.name,
|
|
635
|
-
testPath
|
|
636
|
+
testPath,
|
|
637
|
+
project
|
|
636
638
|
};
|
|
637
639
|
return result;
|
|
638
640
|
}
|
|
@@ -641,7 +643,8 @@ export const __webpack_modules__ = {
|
|
|
641
643
|
status: 'todo',
|
|
642
644
|
parentNames: test.parentNames,
|
|
643
645
|
name: test.name,
|
|
644
|
-
testPath
|
|
646
|
+
testPath,
|
|
647
|
+
project
|
|
645
648
|
};
|
|
646
649
|
return result;
|
|
647
650
|
}
|
|
@@ -658,8 +661,9 @@ export const __webpack_modules__ = {
|
|
|
658
661
|
status: 'fail',
|
|
659
662
|
parentNames: test.parentNames,
|
|
660
663
|
name: test.name,
|
|
661
|
-
errors: (0, runtime_util.
|
|
662
|
-
testPath
|
|
664
|
+
errors: (0, runtime_util.o9)(error, test),
|
|
665
|
+
testPath,
|
|
666
|
+
project
|
|
663
667
|
};
|
|
664
668
|
}
|
|
665
669
|
if (result?.status !== 'fail') if (test.fails) try {
|
|
@@ -672,6 +676,7 @@ export const __webpack_modules__ = {
|
|
|
672
676
|
parentNames: test.parentNames,
|
|
673
677
|
name: test.name,
|
|
674
678
|
testPath,
|
|
679
|
+
project,
|
|
675
680
|
errors: [
|
|
676
681
|
{
|
|
677
682
|
message: 'Expect test to fail'
|
|
@@ -680,6 +685,7 @@ export const __webpack_modules__ = {
|
|
|
680
685
|
};
|
|
681
686
|
} catch (_err) {
|
|
682
687
|
result = {
|
|
688
|
+
project,
|
|
683
689
|
status: 'pass',
|
|
684
690
|
parentNames: test.parentNames,
|
|
685
691
|
name: test.name,
|
|
@@ -692,6 +698,7 @@ export const __webpack_modules__ = {
|
|
|
692
698
|
await test.fn?.(test.context);
|
|
693
699
|
this.afterRunTest(test);
|
|
694
700
|
result = {
|
|
701
|
+
project,
|
|
695
702
|
parentNames: test.parentNames,
|
|
696
703
|
name: test.name,
|
|
697
704
|
status: 'pass',
|
|
@@ -699,22 +706,39 @@ export const __webpack_modules__ = {
|
|
|
699
706
|
};
|
|
700
707
|
} catch (error) {
|
|
701
708
|
result = {
|
|
709
|
+
project,
|
|
702
710
|
status: 'fail',
|
|
703
711
|
parentNames: test.parentNames,
|
|
704
712
|
name: test.name,
|
|
705
|
-
errors: (0, runtime_util.
|
|
713
|
+
errors: (0, runtime_util.o9)(error, test),
|
|
706
714
|
testPath
|
|
707
715
|
};
|
|
708
716
|
}
|
|
709
717
|
const afterEachFns = [
|
|
710
718
|
...parentHooks.afterEachListeners || []
|
|
711
|
-
].reverse().concat(cleanups);
|
|
719
|
+
].reverse().concat(cleanups).concat(test.onFinished);
|
|
712
720
|
try {
|
|
713
|
-
for (const fn of afterEachFns)await fn(
|
|
721
|
+
for (const fn of afterEachFns)await fn({
|
|
722
|
+
task: {
|
|
723
|
+
result
|
|
724
|
+
}
|
|
725
|
+
});
|
|
714
726
|
} catch (error) {
|
|
715
727
|
result.status = 'fail';
|
|
716
728
|
result.errors ??= [];
|
|
717
|
-
result.errors.push(...(0, runtime_util.
|
|
729
|
+
result.errors.push(...(0, runtime_util.o9)(error));
|
|
730
|
+
}
|
|
731
|
+
if ('fail' === result.status) for (const fn of [
|
|
732
|
+
...test.onFailed
|
|
733
|
+
].reverse())try {
|
|
734
|
+
await fn({
|
|
735
|
+
task: {
|
|
736
|
+
result
|
|
737
|
+
}
|
|
738
|
+
});
|
|
739
|
+
} catch (error) {
|
|
740
|
+
result.errors ??= [];
|
|
741
|
+
result.errors.push(...(0, runtime_util.o9)(error));
|
|
718
742
|
}
|
|
719
743
|
this.resetCurrentTest();
|
|
720
744
|
return result;
|
|
@@ -763,7 +787,8 @@ export const __webpack_modules__ = {
|
|
|
763
787
|
testPath,
|
|
764
788
|
errors: [
|
|
765
789
|
noTestError
|
|
766
|
-
]
|
|
790
|
+
],
|
|
791
|
+
project
|
|
767
792
|
};
|
|
768
793
|
hooks.onTestCaseResult?.(result);
|
|
769
794
|
}
|
|
@@ -781,7 +806,7 @@ export const __webpack_modules__ = {
|
|
|
781
806
|
}
|
|
782
807
|
} catch (error) {
|
|
783
808
|
hasBeforeAllError = true;
|
|
784
|
-
errors.push(...(0, runtime_util.
|
|
809
|
+
errors.push(...(0, runtime_util.o9)(error));
|
|
785
810
|
}
|
|
786
811
|
if (hasBeforeAllError) markAllTestAsSkipped(test.tests);
|
|
787
812
|
await runTests(test.tests, {
|
|
@@ -799,7 +824,7 @@ export const __webpack_modules__ = {
|
|
|
799
824
|
filepath: testPath
|
|
800
825
|
});
|
|
801
826
|
} catch (error) {
|
|
802
|
-
errors.push(...(0, runtime_util.
|
|
827
|
+
errors.push(...(0, runtime_util.o9)(error));
|
|
803
828
|
}
|
|
804
829
|
} else {
|
|
805
830
|
const start = RealDate.now();
|
|
@@ -822,12 +847,14 @@ export const __webpack_modules__ = {
|
|
|
822
847
|
const start = RealDate.now();
|
|
823
848
|
if (0 === tests.length) {
|
|
824
849
|
if (passWithNoTests) return {
|
|
850
|
+
project,
|
|
825
851
|
testPath,
|
|
826
852
|
name: '',
|
|
827
853
|
status: 'pass',
|
|
828
854
|
results
|
|
829
855
|
};
|
|
830
856
|
return {
|
|
857
|
+
project,
|
|
831
858
|
testPath,
|
|
832
859
|
name: '',
|
|
833
860
|
status: 'fail',
|
|
@@ -846,6 +873,7 @@ export const __webpack_modules__ = {
|
|
|
846
873
|
});
|
|
847
874
|
const snapshotResult = await snapshotClient.finish(testPath);
|
|
848
875
|
return {
|
|
876
|
+
project,
|
|
849
877
|
testPath,
|
|
850
878
|
name: '',
|
|
851
879
|
status: errors.length ? 'fail' : getTestStatus(results, defaultStatus),
|
|
@@ -893,10 +921,38 @@ export const __webpack_modules__ = {
|
|
|
893
921
|
return null != _expect;
|
|
894
922
|
}
|
|
895
923
|
});
|
|
924
|
+
Object.defineProperty(context, 'onTestFinished', {
|
|
925
|
+
get: ()=>(fn, timeout)=>{
|
|
926
|
+
this.onTestFinished(current, fn, timeout);
|
|
927
|
+
}
|
|
928
|
+
});
|
|
929
|
+
Object.defineProperty(context, 'onTestFailed', {
|
|
930
|
+
get: ()=>(fn, timeout)=>{
|
|
931
|
+
this.onTestFailed(current, fn, timeout);
|
|
932
|
+
}
|
|
933
|
+
});
|
|
896
934
|
return context;
|
|
897
935
|
}
|
|
936
|
+
onTestFinished(test, fn, timeout) {
|
|
937
|
+
if (!test) throw new Error('onTestFinished() can only be called inside a test');
|
|
938
|
+
test.onFinished.push(wrapTimeout({
|
|
939
|
+
name: 'onTestFinished hook',
|
|
940
|
+
fn,
|
|
941
|
+
timeout: timeout || this.workerState.runtimeConfig.hookTimeout,
|
|
942
|
+
stackTraceError: new Error('STACK_TRACE_ERROR')
|
|
943
|
+
}));
|
|
944
|
+
}
|
|
945
|
+
onTestFailed(test, fn, timeout) {
|
|
946
|
+
if (!test) throw new Error('onTestFailed() can only be called inside a test');
|
|
947
|
+
test.onFailed.push(wrapTimeout({
|
|
948
|
+
name: 'onTestFailed hook',
|
|
949
|
+
fn,
|
|
950
|
+
timeout: timeout || this.workerState.runtimeConfig.hookTimeout,
|
|
951
|
+
stackTraceError: new Error('STACK_TRACE_ERROR')
|
|
952
|
+
}));
|
|
953
|
+
}
|
|
898
954
|
async beforeRunTest(test, snapshotState) {
|
|
899
|
-
(0, dist.
|
|
955
|
+
(0, dist.wb)({
|
|
900
956
|
assertionCalls: 0,
|
|
901
957
|
isExpectingAssertions: false,
|
|
902
958
|
isExpectingAssertionsError: null,
|
|
@@ -904,8 +960,8 @@ export const __webpack_modules__ = {
|
|
|
904
960
|
expectedAssertionsNumberErrorGen: null,
|
|
905
961
|
testPath: test.testPath,
|
|
906
962
|
snapshotState,
|
|
907
|
-
currentTestName: (0, src_utils.
|
|
908
|
-
}, globalThis[dist.
|
|
963
|
+
currentTestName: (0, src_utils.fN)(test)
|
|
964
|
+
}, globalThis[dist.mZ]);
|
|
909
965
|
const context = this.createTestContext();
|
|
910
966
|
const { cleanups } = await handleFixtures(test, context);
|
|
911
967
|
Object.defineProperty(test, 'context', {
|
|
@@ -915,8 +971,8 @@ export const __webpack_modules__ = {
|
|
|
915
971
|
return cleanups;
|
|
916
972
|
}
|
|
917
973
|
afterRunTest(test) {
|
|
918
|
-
const expect = test.context._useLocalExpect ? test.context.expect : globalThis[dist.
|
|
919
|
-
const { assertionCalls, expectedAssertionsNumber, expectedAssertionsNumberErrorGen, isExpectingAssertions, isExpectingAssertionsError } = (0, dist.
|
|
974
|
+
const expect = test.context._useLocalExpect ? test.context.expect : globalThis[dist.mZ];
|
|
975
|
+
const { assertionCalls, expectedAssertionsNumber, expectedAssertionsNumberErrorGen, isExpectingAssertions, isExpectingAssertionsError } = (0, dist.Gu)(expect);
|
|
920
976
|
if (test.result?.state === 'fail') throw test.result.errors;
|
|
921
977
|
if (null !== expectedAssertionsNumber && assertionCalls !== expectedAssertionsNumber) throw expectedAssertionsNumberErrorGen();
|
|
922
978
|
if (true === isExpectingAssertions && 0 === assertionCalls) throw isExpectingAssertionsError;
|
|
@@ -930,7 +986,9 @@ export const __webpack_modules__ = {
|
|
|
930
986
|
collectStatus = 'lazy';
|
|
931
987
|
currentCollectList = [];
|
|
932
988
|
runtimeConfig;
|
|
933
|
-
|
|
989
|
+
project;
|
|
990
|
+
constructor({ testPath, runtimeConfig, project }){
|
|
991
|
+
this.project = project;
|
|
934
992
|
this.testPath = testPath;
|
|
935
993
|
this.runtimeConfig = runtimeConfig;
|
|
936
994
|
}
|
|
@@ -939,7 +997,7 @@ export const __webpack_modules__ = {
|
|
|
939
997
|
}
|
|
940
998
|
checkStatus(name, type) {
|
|
941
999
|
if ('running' === this.status) {
|
|
942
|
-
const error = new runtime_util.
|
|
1000
|
+
const error = new runtime_util.si(`${'case' === type ? 'Test' : 'Describe'} '${name}' cannot run`);
|
|
943
1001
|
throw error;
|
|
944
1002
|
}
|
|
945
1003
|
}
|
|
@@ -981,9 +1039,10 @@ export const __webpack_modules__ = {
|
|
|
981
1039
|
}
|
|
982
1040
|
getDefaultRootSuite() {
|
|
983
1041
|
return {
|
|
1042
|
+
project: this.project,
|
|
984
1043
|
runMode: 'run',
|
|
985
1044
|
testPath: this.testPath,
|
|
986
|
-
name: src_utils.
|
|
1045
|
+
name: src_utils.q_,
|
|
987
1046
|
tests: [],
|
|
988
1047
|
type: 'suite'
|
|
989
1048
|
};
|
|
@@ -991,6 +1050,7 @@ export const __webpack_modules__ = {
|
|
|
991
1050
|
describe({ name, fn, runMode = 'run', each = false, concurrent, sequential }) {
|
|
992
1051
|
this.checkStatus(name, 'suite');
|
|
993
1052
|
const currentSuite = {
|
|
1053
|
+
project: this.project,
|
|
994
1054
|
name,
|
|
995
1055
|
runMode,
|
|
996
1056
|
tests: [],
|
|
@@ -1066,6 +1126,7 @@ export const __webpack_modules__ = {
|
|
|
1066
1126
|
it({ name, fn, originalFn = fn, fixtures, timeout = this.runtimeConfig.testTimeout, runMode = 'run', fails = false, each = false, concurrent, sequential }) {
|
|
1067
1127
|
this.checkStatus(name, 'case');
|
|
1068
1128
|
this.addTestCase({
|
|
1129
|
+
project: this.project,
|
|
1069
1130
|
name,
|
|
1070
1131
|
originalFn,
|
|
1071
1132
|
fn: fn ? wrapTimeout({
|
|
@@ -1081,16 +1142,18 @@ export const __webpack_modules__ = {
|
|
|
1081
1142
|
concurrent,
|
|
1082
1143
|
sequential,
|
|
1083
1144
|
each,
|
|
1084
|
-
fails
|
|
1145
|
+
fails,
|
|
1146
|
+
onFinished: [],
|
|
1147
|
+
onFailed: []
|
|
1085
1148
|
});
|
|
1086
1149
|
}
|
|
1087
1150
|
describeEach({ cases, ...options }) {
|
|
1088
1151
|
return (name, fn)=>{
|
|
1089
1152
|
for(let i = 0; i < cases.length; i++){
|
|
1090
1153
|
const param = cases[i];
|
|
1091
|
-
const params = (0, src_utils.
|
|
1154
|
+
const params = (0, src_utils.bg)(param);
|
|
1092
1155
|
this.describe({
|
|
1093
|
-
name: (0, runtime_util.
|
|
1156
|
+
name: (0, runtime_util.nD)(name, param, i),
|
|
1094
1157
|
fn: ()=>fn?.(...params),
|
|
1095
1158
|
...options,
|
|
1096
1159
|
each: true
|
|
@@ -1103,7 +1166,7 @@ export const __webpack_modules__ = {
|
|
|
1103
1166
|
for(let i = 0; i < cases.length; i++){
|
|
1104
1167
|
const param = cases[i];
|
|
1105
1168
|
this.describe({
|
|
1106
|
-
name: (0, runtime_util.
|
|
1169
|
+
name: (0, runtime_util.nD)(name, param, i),
|
|
1107
1170
|
fn: ()=>fn?.(param),
|
|
1108
1171
|
...options,
|
|
1109
1172
|
each: true
|
|
@@ -1115,9 +1178,9 @@ export const __webpack_modules__ = {
|
|
|
1115
1178
|
return (name, fn, timeout = this.runtimeConfig.testTimeout)=>{
|
|
1116
1179
|
for(let i = 0; i < cases.length; i++){
|
|
1117
1180
|
const param = cases[i];
|
|
1118
|
-
const params = (0, src_utils.
|
|
1181
|
+
const params = (0, src_utils.bg)(param);
|
|
1119
1182
|
this.it({
|
|
1120
|
-
name: (0, runtime_util.
|
|
1183
|
+
name: (0, runtime_util.nD)(name, param, i),
|
|
1121
1184
|
originalFn: fn,
|
|
1122
1185
|
fn: ()=>fn?.(...params),
|
|
1123
1186
|
timeout,
|
|
@@ -1132,7 +1195,7 @@ export const __webpack_modules__ = {
|
|
|
1132
1195
|
for(let i = 0; i < cases.length; i++){
|
|
1133
1196
|
const param = cases[i];
|
|
1134
1197
|
this.it({
|
|
1135
|
-
name: (0, runtime_util.
|
|
1198
|
+
name: (0, runtime_util.nD)(name, param, i),
|
|
1136
1199
|
originalFn: fn,
|
|
1137
1200
|
fn: (context)=>fn?.(param, context),
|
|
1138
1201
|
timeout,
|
|
@@ -1151,8 +1214,9 @@ export const __webpack_modules__ = {
|
|
|
1151
1214
|
throw new Error('Expect to find a suite, but got undefined');
|
|
1152
1215
|
}
|
|
1153
1216
|
}
|
|
1154
|
-
const createRuntimeAPI = ({ testPath, runtimeConfig })=>{
|
|
1217
|
+
const createRuntimeAPI = ({ testPath, runtimeConfig, project })=>{
|
|
1155
1218
|
const runtimeInstance = new RunnerRuntime({
|
|
1219
|
+
project,
|
|
1156
1220
|
testPath,
|
|
1157
1221
|
runtimeConfig
|
|
1158
1222
|
});
|
|
@@ -1302,14 +1366,23 @@ export const __webpack_modules__ = {
|
|
|
1302
1366
|
};
|
|
1303
1367
|
};
|
|
1304
1368
|
function createRunner({ workerState }) {
|
|
1305
|
-
const { testPath, runtimeConfig: { testNamePattern } } = workerState;
|
|
1369
|
+
const { testPath, project, runtimeConfig: { testNamePattern } } = workerState;
|
|
1306
1370
|
const runtime = createRuntimeAPI({
|
|
1371
|
+
project,
|
|
1307
1372
|
testPath,
|
|
1308
1373
|
runtimeConfig: workerState.runtimeConfig
|
|
1309
1374
|
});
|
|
1310
1375
|
const testRunner = new TestRunner();
|
|
1311
1376
|
return {
|
|
1312
|
-
api:
|
|
1377
|
+
api: {
|
|
1378
|
+
...runtime.api,
|
|
1379
|
+
onTestFinished: (fn, timeout)=>{
|
|
1380
|
+
testRunner.onTestFinished(testRunner.getCurrentTest(), fn, timeout);
|
|
1381
|
+
},
|
|
1382
|
+
onTestFailed: (fn, timeout)=>{
|
|
1383
|
+
testRunner.onTestFailed(testRunner.getCurrentTest(), fn, timeout);
|
|
1384
|
+
}
|
|
1385
|
+
},
|
|
1313
1386
|
runner: {
|
|
1314
1387
|
runTests: async (testPath, hooks, api)=>{
|
|
1315
1388
|
const tests = await runtime.instance.getTests();
|
|
@@ -1446,7 +1519,7 @@ export const __webpack_modules__ = {
|
|
|
1446
1519
|
let callOrder = 0;
|
|
1447
1520
|
const mocks = new Set();
|
|
1448
1521
|
const wrapSpy = (obj, methodName, mockFn)=>{
|
|
1449
|
-
const spyImpl = (0, tinyspy_dist.
|
|
1522
|
+
const spyImpl = (0, tinyspy_dist.jo)(obj, methodName, mockFn);
|
|
1450
1523
|
const spyFn = spyImpl;
|
|
1451
1524
|
let mockImplementationOnce = [];
|
|
1452
1525
|
let implementation = mockFn;
|
|
@@ -1457,7 +1530,7 @@ export const __webpack_modules__ = {
|
|
|
1457
1530
|
invocationCallOrder: []
|
|
1458
1531
|
});
|
|
1459
1532
|
let mockState = initMockState();
|
|
1460
|
-
const spyState = (0, tinyspy_dist.
|
|
1533
|
+
const spyState = (0, tinyspy_dist.lf)(spyImpl);
|
|
1461
1534
|
spyFn.getMockName = ()=>mockName || methodName;
|
|
1462
1535
|
spyFn.mockName = (name)=>{
|
|
1463
1536
|
mockName = name;
|
|
@@ -1727,7 +1800,7 @@ export const __webpack_modules__ = {
|
|
|
1727
1800
|
workerState,
|
|
1728
1801
|
getCurrentTest: ()=>runner.getCurrentTest()
|
|
1729
1802
|
});
|
|
1730
|
-
Object.defineProperty(globalThis, dist.
|
|
1803
|
+
Object.defineProperty(globalThis, dist.mZ, {
|
|
1731
1804
|
value: expect,
|
|
1732
1805
|
writable: true,
|
|
1733
1806
|
configurable: true
|
|
@@ -1747,12 +1820,12 @@ export const __webpack_modules__ = {
|
|
|
1747
1820
|
},
|
|
1748
1821
|
"./src/utils/index.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
1749
1822
|
__webpack_require__.d(__webpack_exports__, {
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1823
|
+
fN: ()=>helper.fN,
|
|
1824
|
+
Gv: ()=>helper.Gv,
|
|
1825
|
+
kV: ()=>helper.kV,
|
|
1826
|
+
q_: ()=>constants.q_,
|
|
1827
|
+
bg: ()=>helper.bg,
|
|
1828
|
+
yW: ()=>helper.yW
|
|
1756
1829
|
});
|
|
1757
1830
|
var constants = __webpack_require__("./src/utils/constants.ts");
|
|
1758
1831
|
var helper = __webpack_require__("./src/utils/helper.ts");
|
package/dist/{668.js → 928.js}
RENAMED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
/*! For license information please see
|
|
1
|
+
/*! For license information please see 928.js.LICENSE.txt */
|
|
2
2
|
import 'module';
|
|
3
3
|
/*#__PURE__*/ import.meta.url;
|
|
4
|
+
export const __webpack_id__ = "928";
|
|
4
5
|
export const __webpack_ids__ = [
|
|
5
|
-
"
|
|
6
|
+
"928"
|
|
6
7
|
];
|
|
7
8
|
export const __webpack_modules__ = {
|
|
8
9
|
"../../node_modules/.pnpm/chokidar@4.0.3/node_modules/chokidar/esm/index.js": function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
package/dist/{25.js → 967.js}
RENAMED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import 'module';
|
|
2
2
|
/*#__PURE__*/ import.meta.url;
|
|
3
|
+
export const __webpack_id__ = "967";
|
|
3
4
|
export const __webpack_ids__ = [
|
|
4
|
-
"
|
|
5
|
+
"967"
|
|
5
6
|
];
|
|
6
7
|
export const __webpack_modules__ = {
|
|
7
8
|
"./src/core/restart.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
@@ -15,7 +16,7 @@ export const __webpack_modules__ = {
|
|
|
15
16
|
const GLOB_REGEX = /[*?{}[\]()!@+|]/;
|
|
16
17
|
const isGlob = (str)=>GLOB_REGEX.test(str);
|
|
17
18
|
async function createChokidar(pathOrGlobs, root, options) {
|
|
18
|
-
const chokidar = await __webpack_require__.e("
|
|
19
|
+
const chokidar = await __webpack_require__.e("928").then(__webpack_require__.bind(__webpack_require__, "../../node_modules/.pnpm/chokidar@4.0.3/node_modules/chokidar/esm/index.js"));
|
|
19
20
|
const watchFiles = new Set();
|
|
20
21
|
const globPatterns = pathOrGlobs.filter((pathOrGlob)=>{
|
|
21
22
|
if (isGlob(pathOrGlob)) return true;
|
|
@@ -37,23 +38,24 @@ export const __webpack_modules__ = {
|
|
|
37
38
|
cleaners.push(cleaner);
|
|
38
39
|
};
|
|
39
40
|
const clearConsole = ()=>{
|
|
40
|
-
if ((0, utils.
|
|
41
|
+
if ((0, utils.Un)() && !process.env.DEBUG) process.stdout.write('\x1B[H\x1B[2J');
|
|
41
42
|
};
|
|
42
|
-
const beforeRestart = async ({ filePath, clear = true })=>{
|
|
43
|
+
const beforeRestart = async ({ filePath, root, clear = true })=>{
|
|
43
44
|
if (clear) clearConsole();
|
|
44
45
|
if (filePath) {
|
|
45
|
-
const filename = external_node_path_["default"].
|
|
46
|
-
utils.
|
|
47
|
-
} else utils.
|
|
46
|
+
const filename = external_node_path_["default"].relative(root, filePath);
|
|
47
|
+
utils.vF.info(`restarting Rstest as ${utils.yW.yellow(filename)} changed\n`);
|
|
48
|
+
} else utils.vF.info('restarting Rstest...\n');
|
|
48
49
|
for (const cleaner of cleaners)await cleaner();
|
|
49
50
|
cleaners = [];
|
|
50
51
|
};
|
|
51
|
-
const restart = async ({ filePath, clear = true, options, filters })=>{
|
|
52
|
+
const restart = async ({ filePath, clear = true, options, filters, root })=>{
|
|
52
53
|
await beforeRestart({
|
|
53
54
|
filePath,
|
|
55
|
+
root,
|
|
54
56
|
clear
|
|
55
57
|
});
|
|
56
|
-
await (0, commands.
|
|
58
|
+
await (0, commands.a)({
|
|
57
59
|
options,
|
|
58
60
|
filters,
|
|
59
61
|
command: 'watch'
|
|
@@ -61,11 +63,13 @@ export const __webpack_modules__ = {
|
|
|
61
63
|
return true;
|
|
62
64
|
};
|
|
63
65
|
async function watchFilesForRestart({ rstest, watchOptions, options, filters }) {
|
|
64
|
-
|
|
66
|
+
const configFilePaths = [
|
|
67
|
+
rstest.context.configFilePath,
|
|
68
|
+
...rstest.context.projects.map((project)=>project.configFilePath)
|
|
69
|
+
].filter(Boolean);
|
|
70
|
+
if (0 === configFilePaths.length) return;
|
|
65
71
|
const root = rstest.context.rootPath;
|
|
66
|
-
const watcher = await createChokidar(
|
|
67
|
-
rstest.context.configFilePath
|
|
68
|
-
], root, {
|
|
72
|
+
const watcher = await createChokidar(configFilePaths, root, {
|
|
69
73
|
ignoreInitial: true,
|
|
70
74
|
ignorePermissionErrors: true,
|
|
71
75
|
...watchOptions
|
|
@@ -76,11 +80,12 @@ export const __webpack_modules__ = {
|
|
|
76
80
|
restarting = true;
|
|
77
81
|
const restarted = await restart({
|
|
78
82
|
options,
|
|
83
|
+
root,
|
|
79
84
|
filters,
|
|
80
85
|
filePath
|
|
81
86
|
});
|
|
82
87
|
if (restarted) await watcher.close();
|
|
83
|
-
else utils.
|
|
88
|
+
else utils.vF.error('Restart failed');
|
|
84
89
|
restarting = false;
|
|
85
90
|
};
|
|
86
91
|
watcher.on('add', onChange);
|
package/dist/{64.js → 969.js}
RENAMED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import 'module';
|
|
2
2
|
/*#__PURE__*/ import.meta.url;
|
|
3
|
+
export const __webpack_id__ = "969";
|
|
3
4
|
export const __webpack_ids__ = [
|
|
4
|
-
"
|
|
5
|
+
"969"
|
|
5
6
|
];
|
|
6
7
|
export const __webpack_modules__ = {
|
|
7
8
|
"../../node_modules/.pnpm/buffer-from@1.1.2/node_modules/buffer-from/index.js": function(module) {
|