@rstest/core 0.0.10 → 0.1.1
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/{LICENSE → LICENSE.md} +481 -141
- package/dist/208.js +8342 -0
- package/dist/208.js.LICENSE.txt +47 -0
- package/dist/285.js +2 -0
- package/dist/355.js +5 -0
- package/dist/{353.js → 359.js} +146 -19
- package/dist/44.js +2 -0
- package/dist/443.js +1210 -0
- package/dist/562.js +2 -0
- package/dist/629.js +3 -0
- package/dist/64.js +2 -0
- package/dist/72.js +2 -0
- package/dist/723.js +2 -0
- package/dist/813.js +2 -0
- package/dist/867.js +57 -43
- package/dist/965.js +2 -0
- package/dist/cli.js +14 -12
- package/dist/node.js +2 -0
- package/dist/public.js +2 -0
- package/dist/worker.js +88 -38
- package/dist-types/node.d.ts +71 -5
- package/dist-types/public.d.ts +1397 -33
- package/dist-types/worker.d.ts +1389 -26
- package/package.json +7 -8
- package/dist/81.js +0 -1467
package/dist/562.js
CHANGED
package/dist/629.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import 'module';
|
|
2
|
+
/*#__PURE__*/ import.meta.url;
|
|
1
3
|
export const __webpack_ids__ = [
|
|
2
4
|
"629"
|
|
3
5
|
];
|
|
@@ -71,6 +73,7 @@ export const __webpack_modules__ = {
|
|
|
71
73
|
};
|
|
72
74
|
if ('watch' === command) rsbuildInstance.onDevCompileDone(async ()=>{
|
|
73
75
|
await run();
|
|
76
|
+
_utils__WEBPACK_IMPORTED_MODULE_1__.kg.log(_utils__WEBPACK_IMPORTED_MODULE_1__.$_.green(' Waiting for file changes...'));
|
|
74
77
|
});
|
|
75
78
|
else {
|
|
76
79
|
const close = await run();
|
package/dist/64.js
CHANGED
package/dist/72.js
CHANGED
package/dist/723.js
CHANGED
package/dist/813.js
CHANGED
package/dist/867.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import 'module';
|
|
2
|
+
/*#__PURE__*/ import.meta.url;
|
|
1
3
|
export const __webpack_ids__ = [
|
|
2
4
|
"867"
|
|
3
5
|
];
|
|
@@ -6,10 +8,10 @@ export const __webpack_modules__ = {
|
|
|
6
8
|
__webpack_require__.d(__webpack_exports__, {
|
|
7
9
|
createRstestRuntime: ()=>createRstestRuntime
|
|
8
10
|
});
|
|
9
|
-
var
|
|
11
|
+
var dist = __webpack_require__("../../node_modules/.pnpm/@vitest+expect@3.2.4/node_modules/@vitest/expect/dist/index.js");
|
|
10
12
|
var src_utils = __webpack_require__("./src/utils/index.ts");
|
|
11
13
|
var external_chai_ = __webpack_require__("chai");
|
|
12
|
-
var
|
|
14
|
+
var runtime_util = __webpack_require__("./src/runtime/util.ts");
|
|
13
15
|
const unsupported = [
|
|
14
16
|
'matchSnapshot',
|
|
15
17
|
'toMatchSnapshot',
|
|
@@ -53,10 +55,10 @@ export const __webpack_modules__ = {
|
|
|
53
55
|
clearTimeout(timeoutId);
|
|
54
56
|
} catch (err) {
|
|
55
57
|
lastError = err;
|
|
56
|
-
if (!external_chai_.util.flag(assertion, '_isLastPollAttempt')) intervalId = (0,
|
|
58
|
+
if (!external_chai_.util.flag(assertion, '_isLastPollAttempt')) intervalId = (0, runtime_util.BH)().setTimeout(check, interval);
|
|
57
59
|
}
|
|
58
60
|
};
|
|
59
|
-
timeoutId = (0,
|
|
61
|
+
timeoutId = (0, runtime_util.BH)().setTimeout(()=>{
|
|
60
62
|
clearTimeout(intervalId);
|
|
61
63
|
external_chai_.util.flag(assertion, '_isLastPollAttempt', true);
|
|
62
64
|
const rejectWithCause = (cause)=>{
|
|
@@ -106,13 +108,13 @@ export const __webpack_modules__ = {
|
|
|
106
108
|
if (void 0 !== source.stack) target.stack = source.stack.replace(source.message, target.message);
|
|
107
109
|
return target;
|
|
108
110
|
}
|
|
109
|
-
var
|
|
111
|
+
var snapshot_dist = __webpack_require__("../../node_modules/.pnpm/@vitest+snapshot@3.2.4/node_modules/@vitest/snapshot/dist/index.js");
|
|
110
112
|
let _client;
|
|
111
113
|
function getSnapshotClient() {
|
|
112
|
-
if (!_client) _client = new
|
|
113
|
-
isEqual: (received, expected)=>(0,
|
|
114
|
-
|
|
115
|
-
|
|
114
|
+
if (!_client) _client = new snapshot_dist.xh({
|
|
115
|
+
isEqual: (received, expected)=>(0, dist.fS)(received, expected, [
|
|
116
|
+
dist.CC,
|
|
117
|
+
dist.gs
|
|
116
118
|
])
|
|
117
119
|
});
|
|
118
120
|
return _client;
|
|
@@ -245,7 +247,7 @@ export const __webpack_modules__ = {
|
|
|
245
247
|
inlineSnapshot = properties;
|
|
246
248
|
properties = void 0;
|
|
247
249
|
}
|
|
248
|
-
if (inlineSnapshot) inlineSnapshot = (0,
|
|
250
|
+
if (inlineSnapshot) inlineSnapshot = (0, snapshot_dist.hY)(inlineSnapshot);
|
|
249
251
|
const errorMessage = utils.flag(this, 'message');
|
|
250
252
|
getSnapshotClient().assert({
|
|
251
253
|
received: expected,
|
|
@@ -283,7 +285,7 @@ export const __webpack_modules__ = {
|
|
|
283
285
|
const error = utils.flag(this, 'error');
|
|
284
286
|
const promise = utils.flag(this, 'promise');
|
|
285
287
|
const errorMessage = utils.flag(this, 'message');
|
|
286
|
-
if (inlineSnapshot) inlineSnapshot = (0,
|
|
288
|
+
if (inlineSnapshot) inlineSnapshot = (0, snapshot_dist.hY)(inlineSnapshot);
|
|
287
289
|
getSnapshotClient().assert({
|
|
288
290
|
received: getError(expected, promise),
|
|
289
291
|
message,
|
|
@@ -294,16 +296,16 @@ export const __webpack_modules__ = {
|
|
|
294
296
|
...getTestNames(test)
|
|
295
297
|
});
|
|
296
298
|
});
|
|
297
|
-
utils.addMethod(chai.expect, 'addSnapshotSerializer',
|
|
299
|
+
utils.addMethod(chai.expect, 'addSnapshotSerializer', snapshot_dist.zT);
|
|
298
300
|
};
|
|
299
|
-
external_chai_.use(
|
|
300
|
-
external_chai_.use(
|
|
301
|
+
external_chai_.use(dist.Dd);
|
|
302
|
+
external_chai_.use(dist.pT);
|
|
301
303
|
external_chai_.use(SnapshotPlugin);
|
|
302
|
-
external_chai_.use(
|
|
304
|
+
external_chai_.use(dist.kc);
|
|
303
305
|
function createExpect({ getCurrentTest, workerState }) {
|
|
304
306
|
const expect = (value, message)=>{
|
|
305
|
-
const { assertionCalls } = (0,
|
|
306
|
-
(0,
|
|
307
|
+
const { assertionCalls } = (0, dist.y0)(expect);
|
|
308
|
+
(0, dist.IW)({
|
|
307
309
|
assertionCalls: assertionCalls + 1
|
|
308
310
|
}, expect);
|
|
309
311
|
const assert = external_chai_.expect(value, message);
|
|
@@ -312,11 +314,11 @@ export const __webpack_modules__ = {
|
|
|
312
314
|
return assert;
|
|
313
315
|
};
|
|
314
316
|
Object.assign(expect, external_chai_.expect);
|
|
315
|
-
Object.assign(expect, globalThis[
|
|
316
|
-
expect.getState = ()=>(0,
|
|
317
|
-
expect.setState = (state)=>(0,
|
|
318
|
-
const globalState = (0,
|
|
319
|
-
(0,
|
|
317
|
+
Object.assign(expect, globalThis[dist.Z0]);
|
|
318
|
+
expect.getState = ()=>(0, dist.y0)(expect);
|
|
319
|
+
expect.setState = (state)=>(0, dist.IW)(state, expect);
|
|
320
|
+
const globalState = (0, dist.y0)(globalThis[dist.p2]) || {};
|
|
321
|
+
(0, dist.IW)({
|
|
320
322
|
...globalState,
|
|
321
323
|
assertionCalls: 0,
|
|
322
324
|
isExpectingAssertions: false,
|
|
@@ -328,7 +330,7 @@ export const __webpack_modules__ = {
|
|
|
328
330
|
}
|
|
329
331
|
}, expect);
|
|
330
332
|
expect.extend = (matchers)=>external_chai_.expect.extend(expect, matchers);
|
|
331
|
-
expect.addEqualityTesters = (customTesters)=>(0,
|
|
333
|
+
expect.addEqualityTesters = (customTesters)=>(0, dist.uF)(customTesters);
|
|
332
334
|
expect.soft = (...args)=>expect(...args).withContext({
|
|
333
335
|
soft: true
|
|
334
336
|
});
|
|
@@ -354,10 +356,9 @@ export const __webpack_modules__ = {
|
|
|
354
356
|
}
|
|
355
357
|
external_chai_.util.addMethod(expect, 'assertions', assertions);
|
|
356
358
|
external_chai_.util.addMethod(expect, 'hasAssertions', hasAssertions);
|
|
357
|
-
expect.extend(
|
|
359
|
+
expect.extend(dist.Nu);
|
|
358
360
|
return expect;
|
|
359
361
|
}
|
|
360
|
-
var runtime_util = __webpack_require__("./src/runtime/util.ts");
|
|
361
362
|
const normalizeFixtures = (fixtures = {}, extendFixtures = {})=>{
|
|
362
363
|
const result = {};
|
|
363
364
|
for(const key in fixtures){
|
|
@@ -571,7 +572,7 @@ export const __webpack_modules__ = {
|
|
|
571
572
|
return async (...args)=>{
|
|
572
573
|
let timeoutId;
|
|
573
574
|
const timeoutPromise = new Promise((_, reject)=>{
|
|
574
|
-
timeoutId = (0,
|
|
575
|
+
timeoutId = (0, runtime_util.BH)().setTimeout(()=>reject(makeError(`${name} timed out in ${timeout}ms`, stackTraceError)), timeout);
|
|
575
576
|
});
|
|
576
577
|
try {
|
|
577
578
|
const result = await Promise.race([
|
|
@@ -657,7 +658,7 @@ export const __webpack_modules__ = {
|
|
|
657
658
|
status: 'fail',
|
|
658
659
|
parentNames: test.parentNames,
|
|
659
660
|
name: test.name,
|
|
660
|
-
errors: (0, runtime_util.
|
|
661
|
+
errors: (0, runtime_util.ov)(error, test),
|
|
661
662
|
testPath
|
|
662
663
|
};
|
|
663
664
|
}
|
|
@@ -701,7 +702,7 @@ export const __webpack_modules__ = {
|
|
|
701
702
|
status: 'fail',
|
|
702
703
|
parentNames: test.parentNames,
|
|
703
704
|
name: test.name,
|
|
704
|
-
errors: (0, runtime_util.
|
|
705
|
+
errors: (0, runtime_util.ov)(error, test),
|
|
705
706
|
testPath
|
|
706
707
|
};
|
|
707
708
|
}
|
|
@@ -713,7 +714,7 @@ export const __webpack_modules__ = {
|
|
|
713
714
|
} catch (error) {
|
|
714
715
|
result.status = 'fail';
|
|
715
716
|
result.errors ??= [];
|
|
716
|
-
result.errors.push(...(0, runtime_util.
|
|
717
|
+
result.errors.push(...(0, runtime_util.ov)(error));
|
|
717
718
|
}
|
|
718
719
|
this.resetCurrentTest();
|
|
719
720
|
return result;
|
|
@@ -780,7 +781,7 @@ export const __webpack_modules__ = {
|
|
|
780
781
|
}
|
|
781
782
|
} catch (error) {
|
|
782
783
|
hasBeforeAllError = true;
|
|
783
|
-
errors.push(...(0, runtime_util.
|
|
784
|
+
errors.push(...(0, runtime_util.ov)(error));
|
|
784
785
|
}
|
|
785
786
|
if (hasBeforeAllError) markAllTestAsSkipped(test.tests);
|
|
786
787
|
await runTests(test.tests, {
|
|
@@ -798,7 +799,7 @@ export const __webpack_modules__ = {
|
|
|
798
799
|
filepath: testPath
|
|
799
800
|
});
|
|
800
801
|
} catch (error) {
|
|
801
|
-
errors.push(...(0, runtime_util.
|
|
802
|
+
errors.push(...(0, runtime_util.ov)(error));
|
|
802
803
|
}
|
|
803
804
|
} else {
|
|
804
805
|
const start = RealDate.now();
|
|
@@ -895,7 +896,7 @@ export const __webpack_modules__ = {
|
|
|
895
896
|
return context;
|
|
896
897
|
}
|
|
897
898
|
async beforeRunTest(test, snapshotState) {
|
|
898
|
-
(0,
|
|
899
|
+
(0, dist.IW)({
|
|
899
900
|
assertionCalls: 0,
|
|
900
901
|
isExpectingAssertions: false,
|
|
901
902
|
isExpectingAssertionsError: null,
|
|
@@ -904,7 +905,7 @@ export const __webpack_modules__ = {
|
|
|
904
905
|
testPath: test.testPath,
|
|
905
906
|
snapshotState,
|
|
906
907
|
currentTestName: (0, src_utils.Yz)(test)
|
|
907
|
-
}, globalThis[
|
|
908
|
+
}, globalThis[dist.p2]);
|
|
908
909
|
const context = this.createTestContext();
|
|
909
910
|
const { cleanups } = await handleFixtures(test, context);
|
|
910
911
|
Object.defineProperty(test, 'context', {
|
|
@@ -914,8 +915,8 @@ export const __webpack_modules__ = {
|
|
|
914
915
|
return cleanups;
|
|
915
916
|
}
|
|
916
917
|
afterRunTest(test) {
|
|
917
|
-
const expect = test.context._useLocalExpect ? test.context.expect : globalThis[
|
|
918
|
-
const { assertionCalls, expectedAssertionsNumber, expectedAssertionsNumberErrorGen, isExpectingAssertions, isExpectingAssertionsError } = (0,
|
|
918
|
+
const expect = test.context._useLocalExpect ? test.context.expect : globalThis[dist.p2];
|
|
919
|
+
const { assertionCalls, expectedAssertionsNumber, expectedAssertionsNumberErrorGen, isExpectingAssertions, isExpectingAssertionsError } = (0, dist.y0)(expect);
|
|
919
920
|
if (test.result?.state === 'fail') throw test.result.errors;
|
|
920
921
|
if (null !== expectedAssertionsNumber && assertionCalls !== expectedAssertionsNumber) throw expectedAssertionsNumberErrorGen();
|
|
921
922
|
if (true === isExpectingAssertions && 0 === assertionCalls) throw isExpectingAssertionsError;
|
|
@@ -925,6 +926,7 @@ export const __webpack_modules__ = {
|
|
|
925
926
|
tests = [];
|
|
926
927
|
_currentTest = [];
|
|
927
928
|
testPath;
|
|
929
|
+
status = 'collect';
|
|
928
930
|
collectStatus = 'lazy';
|
|
929
931
|
currentCollectList = [];
|
|
930
932
|
runtimeConfig;
|
|
@@ -932,6 +934,15 @@ export const __webpack_modules__ = {
|
|
|
932
934
|
this.testPath = testPath;
|
|
933
935
|
this.runtimeConfig = runtimeConfig;
|
|
934
936
|
}
|
|
937
|
+
updateStatus(status) {
|
|
938
|
+
this.status = status;
|
|
939
|
+
}
|
|
940
|
+
checkStatus(name, type) {
|
|
941
|
+
if ('running' === this.status) {
|
|
942
|
+
const error = new runtime_util.Ni(`${'case' === type ? 'Test' : 'Describe'} '${name}' cannot run`);
|
|
943
|
+
throw error;
|
|
944
|
+
}
|
|
945
|
+
}
|
|
935
946
|
afterAll(fn, timeout = this.runtimeConfig.hookTimeout) {
|
|
936
947
|
const currentSuite = this.getCurrentSuite();
|
|
937
948
|
registerTestSuiteListener(currentSuite, 'afterAll', wrapTimeout({
|
|
@@ -978,6 +989,7 @@ export const __webpack_modules__ = {
|
|
|
978
989
|
};
|
|
979
990
|
}
|
|
980
991
|
describe({ name, fn, runMode = 'run', each = false, concurrent, sequential }) {
|
|
992
|
+
this.checkStatus(name, 'suite');
|
|
981
993
|
const currentSuite = {
|
|
982
994
|
name,
|
|
983
995
|
runMode,
|
|
@@ -1052,6 +1064,7 @@ export const __webpack_modules__ = {
|
|
|
1052
1064
|
if (0 === this._currentTest.length) this.addTest(this.getDefaultRootSuite());
|
|
1053
1065
|
}
|
|
1054
1066
|
it({ name, fn, originalFn = fn, fixtures, timeout = this.runtimeConfig.testTimeout, runMode = 'run', fails = false, each = false, concurrent, sequential }) {
|
|
1067
|
+
this.checkStatus(name, 'case');
|
|
1055
1068
|
this.addTestCase({
|
|
1056
1069
|
name,
|
|
1057
1070
|
originalFn,
|
|
@@ -1077,7 +1090,7 @@ export const __webpack_modules__ = {
|
|
|
1077
1090
|
const param = cases[i];
|
|
1078
1091
|
const params = (0, src_utils.XQ)(param);
|
|
1079
1092
|
this.describe({
|
|
1080
|
-
name: (0, runtime_util.
|
|
1093
|
+
name: (0, runtime_util.KY)(name, param, i),
|
|
1081
1094
|
fn: ()=>fn?.(...params),
|
|
1082
1095
|
...options,
|
|
1083
1096
|
each: true
|
|
@@ -1090,7 +1103,7 @@ export const __webpack_modules__ = {
|
|
|
1090
1103
|
for(let i = 0; i < cases.length; i++){
|
|
1091
1104
|
const param = cases[i];
|
|
1092
1105
|
this.describe({
|
|
1093
|
-
name: (0, runtime_util.
|
|
1106
|
+
name: (0, runtime_util.KY)(name, param, i),
|
|
1094
1107
|
fn: ()=>fn?.(param),
|
|
1095
1108
|
...options,
|
|
1096
1109
|
each: true
|
|
@@ -1104,7 +1117,7 @@ export const __webpack_modules__ = {
|
|
|
1104
1117
|
const param = cases[i];
|
|
1105
1118
|
const params = (0, src_utils.XQ)(param);
|
|
1106
1119
|
this.it({
|
|
1107
|
-
name: (0, runtime_util.
|
|
1120
|
+
name: (0, runtime_util.KY)(name, param, i),
|
|
1108
1121
|
originalFn: fn,
|
|
1109
1122
|
fn: ()=>fn?.(...params),
|
|
1110
1123
|
timeout,
|
|
@@ -1119,7 +1132,7 @@ export const __webpack_modules__ = {
|
|
|
1119
1132
|
for(let i = 0; i < cases.length; i++){
|
|
1120
1133
|
const param = cases[i];
|
|
1121
1134
|
this.it({
|
|
1122
|
-
name: (0, runtime_util.
|
|
1135
|
+
name: (0, runtime_util.KY)(name, param, i),
|
|
1123
1136
|
originalFn: fn,
|
|
1124
1137
|
fn: (context)=>fn?.(param, context),
|
|
1125
1138
|
timeout,
|
|
@@ -1301,6 +1314,7 @@ export const __webpack_modules__ = {
|
|
|
1301
1314
|
runTests: async (testPath, hooks, api)=>{
|
|
1302
1315
|
const tests = await runtime.instance.getTests();
|
|
1303
1316
|
traverseUpdateTest(tests, testNamePattern);
|
|
1317
|
+
runtime.instance.updateStatus('running');
|
|
1304
1318
|
const results = await testRunner.runTests({
|
|
1305
1319
|
tests,
|
|
1306
1320
|
testPath,
|
|
@@ -1428,11 +1442,11 @@ export const __webpack_modules__ = {
|
|
|
1428
1442
|
return this._fakingTime;
|
|
1429
1443
|
}
|
|
1430
1444
|
}
|
|
1431
|
-
var
|
|
1445
|
+
var tinyspy_dist = __webpack_require__("../../node_modules/.pnpm/tinyspy@4.0.3/node_modules/tinyspy/dist/index.js");
|
|
1432
1446
|
let callOrder = 0;
|
|
1433
1447
|
const mocks = new Set();
|
|
1434
1448
|
const wrapSpy = (obj, methodName, mockFn)=>{
|
|
1435
|
-
const spyImpl = (0,
|
|
1449
|
+
const spyImpl = (0, tinyspy_dist.XD)(obj, methodName, mockFn);
|
|
1436
1450
|
const spyFn = spyImpl;
|
|
1437
1451
|
let mockImplementationOnce = [];
|
|
1438
1452
|
let implementation = mockFn;
|
|
@@ -1443,7 +1457,7 @@ export const __webpack_modules__ = {
|
|
|
1443
1457
|
invocationCallOrder: []
|
|
1444
1458
|
});
|
|
1445
1459
|
let mockState = initMockState();
|
|
1446
|
-
const spyState = (0,
|
|
1460
|
+
const spyState = (0, tinyspy_dist.eN)(spyImpl);
|
|
1447
1461
|
spyFn.getMockName = ()=>mockName || methodName;
|
|
1448
1462
|
spyFn.mockName = (name)=>{
|
|
1449
1463
|
mockName = name;
|
|
@@ -1713,7 +1727,7 @@ export const __webpack_modules__ = {
|
|
|
1713
1727
|
workerState,
|
|
1714
1728
|
getCurrentTest: ()=>runner.getCurrentTest()
|
|
1715
1729
|
});
|
|
1716
|
-
Object.defineProperty(globalThis,
|
|
1730
|
+
Object.defineProperty(globalThis, dist.p2, {
|
|
1717
1731
|
value: expect,
|
|
1718
1732
|
writable: true,
|
|
1719
1733
|
configurable: true
|
package/dist/965.js
CHANGED
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import __rslib_shim_module__ from 'module';
|
|
2
|
+
const require = /*#__PURE__*/ __rslib_shim_module__.createRequire(import.meta.url);
|
|
1
3
|
import node_process from "node:process";
|
|
2
4
|
import * as __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__ from "@rsbuild/core";
|
|
3
|
-
import * as __WEBPACK_EXTERNAL_MODULE__vitest_snapshot_manager_ed2bcef6__ from "@vitest/snapshot/manager";
|
|
4
5
|
import * as __WEBPACK_EXTERNAL_MODULE_birpc__ from "birpc";
|
|
5
6
|
import * as __WEBPACK_EXTERNAL_MODULE_node_events_0a6aefe7__ from "node:events";
|
|
6
7
|
import * as __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__ from "node:fs";
|
|
@@ -2239,7 +2240,10 @@ var __webpack_modules__ = {
|
|
|
2239
2240
|
hookTimeout: 10000,
|
|
2240
2241
|
testEnvironment: 'node',
|
|
2241
2242
|
retry: 0,
|
|
2242
|
-
reporters: [
|
|
2243
|
+
reporters: 'true' === process.env.GITHUB_ACTIONS ? [
|
|
2244
|
+
'default',
|
|
2245
|
+
'github-actions'
|
|
2246
|
+
] : [
|
|
2243
2247
|
'default'
|
|
2244
2248
|
],
|
|
2245
2249
|
clearMocks: false,
|
|
@@ -2517,8 +2521,8 @@ var __webpack_modules__ = {
|
|
|
2517
2521
|
};
|
|
2518
2522
|
const tryResolve = (request, rootPath)=>{
|
|
2519
2523
|
try {
|
|
2520
|
-
const
|
|
2521
|
-
return
|
|
2524
|
+
const require = (0, external_node_module_.createRequire)(rootPath);
|
|
2525
|
+
return require.resolve(request, {
|
|
2522
2526
|
paths: [
|
|
2523
2527
|
rootPath
|
|
2524
2528
|
]
|
|
@@ -2839,9 +2843,6 @@ var __webpack_modules__ = {
|
|
|
2839
2843
|
"@rsbuild/core": function(module) {
|
|
2840
2844
|
module.exports = __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__;
|
|
2841
2845
|
},
|
|
2842
|
-
"@vitest/snapshot/manager": function(module) {
|
|
2843
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE__vitest_snapshot_manager_ed2bcef6__;
|
|
2844
|
-
},
|
|
2845
2846
|
birpc: function(module) {
|
|
2846
2847
|
module.exports = __WEBPACK_EXTERNAL_MODULE_birpc__;
|
|
2847
2848
|
},
|
|
@@ -3690,13 +3691,13 @@ function prepareCli() {
|
|
|
3690
3691
|
if (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) console.log();
|
|
3691
3692
|
}
|
|
3692
3693
|
function showRstest() {
|
|
3693
|
-
logger.k.greet(" Rstest v0.
|
|
3694
|
+
logger.k.greet(" Rstest v0.1.1");
|
|
3694
3695
|
logger.k.log('');
|
|
3695
3696
|
}
|
|
3696
3697
|
const applyCommonOptions = (cli)=>{
|
|
3697
3698
|
cli.option('-c, --config <config>', 'Specify the configuration file, can be a relative or absolute path').option('--config-loader <loader>', 'Specify the loader to load the config file, can be `jiti` or `native`', {
|
|
3698
3699
|
default: 'jiti'
|
|
3699
|
-
}).option('-r, --root <root>', 'Specify the project root directory, can be an absolute path or a path relative to cwd').option('--globals', 'Provide global APIs').option('--isolate', 'Run tests in an isolated environment').option('--include <include>', 'Match test files').option('--exclude <exclude>', 'Exclude files from test').option('-u, --update', 'Update snapshot files').option('--passWithNoTests', 'Allows the test suite to pass when no files are found').option('--printConsoleTrace', 'Print console traces when calling any console method').option('--disableConsoleIntercept', 'Disable console intercept').option('--slowTestThreshold <value>', 'The number of milliseconds after which a test or suite is considered slow').option('-t, --testNamePattern <value>', 'Run only tests with a name that matches the regex').option('--testEnvironment <name>', 'The environment that will be used for testing').option('--testTimeout <value>', 'Timeout of a test in milliseconds').option('--hookTimeout <value>', 'Timeout of hook in milliseconds').option('--retry <retry>', 'Number of times to retry a test if it fails').option('--maxConcurrency <value>', 'Maximum number of concurrent tests').option('--clearMocks', 'Automatically clear mock calls, instances, contexts and results before every test').option('--resetMocks', 'Automatically reset mock state before every test').option('--restoreMocks', 'Automatically restore mock state and implementation before every test').option('--unstubGlobals', 'Restores all global variables that were changed with `rstest.stubGlobal` before every test').option('--unstubEnvs', 'Restores all `process.env` values that were changed with `rstest.stubEnv` before every test');
|
|
3700
|
+
}).option('-r, --root <root>', 'Specify the project root directory, can be an absolute path or a path relative to cwd').option('--globals', 'Provide global APIs').option('--isolate', 'Run tests in an isolated environment').option('--include <include>', 'Match test files').option('--exclude <exclude>', 'Exclude files from test').option('-u, --update', 'Update snapshot files').option('--passWithNoTests', 'Allows the test suite to pass when no files are found').option('--printConsoleTrace', 'Print console traces when calling any console method').option('--disableConsoleIntercept', 'Disable console intercept').option('--slowTestThreshold <value>', 'The number of milliseconds after which a test or suite is considered slow').option('--reporter <reporter>', 'Specify the reporter to use').option('-t, --testNamePattern <value>', 'Run only tests with a name that matches the regex').option('--testEnvironment <name>', 'The environment that will be used for testing').option('--testTimeout <value>', 'Timeout of a test in milliseconds').option('--hookTimeout <value>', 'Timeout of hook in milliseconds').option('--retry <retry>', 'Number of times to retry a test if it fails').option('--maxConcurrency <value>', 'Maximum number of concurrent tests').option('--clearMocks', 'Automatically clear mock calls, instances, contexts and results before every test').option('--resetMocks', 'Automatically reset mock state before every test').option('--restoreMocks', 'Automatically restore mock state and implementation before every test').option('--unstubGlobals', 'Restores all global variables that were changed with `rstest.stubGlobal` before every test').option('--unstubEnvs', 'Restores all `process.env` values that were changed with `rstest.stubEnv` before every test');
|
|
3700
3701
|
};
|
|
3701
3702
|
async function initCli(options) {
|
|
3702
3703
|
const cwd = process.cwd();
|
|
@@ -3729,6 +3730,7 @@ async function initCli(options) {
|
|
|
3729
3730
|
];
|
|
3730
3731
|
for (const key of keys)if (void 0 !== options[key]) config[key] = options[key];
|
|
3731
3732
|
if (options.exclude) config.exclude = (0, helper.XQ)(options.exclude);
|
|
3733
|
+
if (options.reporter) config.reporters = (0, helper.XQ)(options.reporter);
|
|
3732
3734
|
if (options.include) config.include = (0, helper.XQ)(options.include);
|
|
3733
3735
|
return {
|
|
3734
3736
|
config,
|
|
@@ -3738,7 +3740,7 @@ async function initCli(options) {
|
|
|
3738
3740
|
function setupCommands() {
|
|
3739
3741
|
const cli = dist('rstest');
|
|
3740
3742
|
cli.help();
|
|
3741
|
-
cli.version("0.
|
|
3743
|
+
cli.version("0.1.1");
|
|
3742
3744
|
applyCommonOptions(cli);
|
|
3743
3745
|
cli.command('[...filters]', 'run tests').action(async (filters, options)=>{
|
|
3744
3746
|
showRstest();
|
|
@@ -3749,7 +3751,7 @@ function setupCommands() {
|
|
|
3749
3751
|
let rstest;
|
|
3750
3752
|
try {
|
|
3751
3753
|
const { config } = await initCli(options);
|
|
3752
|
-
const { createRstest } = await __webpack_require__.e("
|
|
3754
|
+
const { createRstest } = await __webpack_require__.e("359").then(__webpack_require__.bind(__webpack_require__, "./src/core/index.ts"));
|
|
3753
3755
|
rstest = createRstest(config, command, filters.map(external_pathe_.normalize));
|
|
3754
3756
|
await rstest.runTests();
|
|
3755
3757
|
} catch (err) {
|
|
@@ -3770,7 +3772,7 @@ function setupCommands() {
|
|
|
3770
3772
|
cli.command('list [...filters]', 'lists all test files that Rstest will run').option('--filesOnly', 'only list the test files').option('--json [boolean/path]', 'print tests as JSON or write to a file').action(async (filters, options)=>{
|
|
3771
3773
|
try {
|
|
3772
3774
|
const { config } = await initCli(options);
|
|
3773
|
-
const { createRstest } = await __webpack_require__.e("
|
|
3775
|
+
const { createRstest } = await __webpack_require__.e("359").then(__webpack_require__.bind(__webpack_require__, "./src/core/index.ts"));
|
|
3774
3776
|
const rstest = createRstest(config, 'list', filters.map(external_pathe_.normalize));
|
|
3775
3777
|
await rstest.listTests({
|
|
3776
3778
|
filesOnly: options.filesOnly,
|
package/dist/node.js
CHANGED