@rstest/core 0.1.0 → 0.1.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.
- package/{LICENSE → LICENSE.md} +481 -141
- package/dist/208.js +8342 -0
- package/dist/208.js.LICENSE.txt +47 -0
- package/dist/285.js +3 -1
- package/dist/355.js +3 -1
- package/dist/{950.js → 359.js} +65 -7
- package/dist/44.js +2 -0
- package/dist/443.js +1210 -0
- package/dist/629.js +2 -0
- package/dist/64.js +3 -1
- package/dist/72.js +2 -0
- package/dist/723.js +2 -0
- package/dist/813.js +3 -1
- package/dist/{562.js → 854.js} +44 -4
- package/dist/867.js +58 -44
- package/dist/965.js +2 -0
- package/dist/cli.js +20 -19
- package/dist/node.js +2 -0
- package/dist/public.js +2 -0
- package/dist/worker.js +83 -36
- package/dist-types/node.d.ts +33 -2
- package/dist-types/public.d.ts +1359 -30
- package/dist-types/worker.d.ts +1351 -23
- package/package.json +7 -8
- package/dist/81.js +0 -1467
package/dist/629.js
CHANGED
package/dist/64.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import 'module';
|
|
2
|
+
/*#__PURE__*/ import.meta.url;
|
|
1
3
|
export const __webpack_ids__ = [
|
|
2
4
|
"64"
|
|
3
5
|
];
|
|
@@ -38,7 +40,7 @@ export const __webpack_modules__ = {
|
|
|
38
40
|
var path = __webpack_require__("node:path");
|
|
39
41
|
var fs;
|
|
40
42
|
try {
|
|
41
|
-
fs = __webpack_require__("
|
|
43
|
+
fs = __webpack_require__("fs");
|
|
42
44
|
if (!fs.existsSync || !fs.readFileSync) fs = null;
|
|
43
45
|
} catch (err) {}
|
|
44
46
|
var bufferFrom = __webpack_require__("../../node_modules/.pnpm/buffer-from@1.1.2/node_modules/buffer-from/index.js");
|
package/dist/72.js
CHANGED
package/dist/723.js
CHANGED
package/dist/813.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import 'module';
|
|
2
|
+
/*#__PURE__*/ import.meta.url;
|
|
1
3
|
export const __webpack_ids__ = [
|
|
2
4
|
"813"
|
|
3
5
|
];
|
|
@@ -132,7 +134,7 @@ export const __webpack_modules__ = {
|
|
|
132
134
|
var constants = __webpack_require__("./src/utils/constants.ts");
|
|
133
135
|
var helper = __webpack_require__("./src/utils/helper.ts");
|
|
134
136
|
__webpack_require__("./src/utils/logger.ts");
|
|
135
|
-
__webpack_require__("
|
|
137
|
+
__webpack_require__("fs");
|
|
136
138
|
__webpack_require__("node:fs/promises");
|
|
137
139
|
__webpack_require__("node:module");
|
|
138
140
|
__webpack_require__("pathe");
|
package/dist/{562.js → 854.js}
RENAMED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import 'module';
|
|
2
|
+
/*#__PURE__*/ import.meta.url;
|
|
1
3
|
export const __webpack_ids__ = [
|
|
2
|
-
"
|
|
4
|
+
"854"
|
|
3
5
|
];
|
|
4
6
|
export const __webpack_modules__ = {
|
|
5
7
|
"./src/core/rsbuild.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
@@ -7,7 +9,7 @@ export const __webpack_modules__ = {
|
|
|
7
9
|
r: ()=>createRsbuildServer,
|
|
8
10
|
z: ()=>prepareRsbuild
|
|
9
11
|
});
|
|
10
|
-
var external_node_fs_ = __webpack_require__("
|
|
12
|
+
var external_node_fs_ = __webpack_require__("fs");
|
|
11
13
|
var core_ = __webpack_require__("@rsbuild/core");
|
|
12
14
|
var external_pathe_ = __webpack_require__("pathe");
|
|
13
15
|
var utils = __webpack_require__("./src/utils/index.ts");
|
|
@@ -235,6 +237,22 @@ export const __webpack_modules__ = {
|
|
|
235
237
|
});
|
|
236
238
|
}
|
|
237
239
|
};
|
|
240
|
+
var external_node_inspector_ = __webpack_require__("node:inspector");
|
|
241
|
+
const enable = void 0 !== external_node_inspector_["default"].url();
|
|
242
|
+
const pluginInspect = ()=>enable ? {
|
|
243
|
+
name: 'rstest:inspect',
|
|
244
|
+
setup: (api)=>{
|
|
245
|
+
api.modifyRspackConfig(async (config)=>{
|
|
246
|
+
config.devtool = 'inline-source-map';
|
|
247
|
+
config.optimization ??= {};
|
|
248
|
+
config.optimization.splitChunks = {
|
|
249
|
+
...config.optimization.splitChunks || {},
|
|
250
|
+
maxSize: 1048576,
|
|
251
|
+
chunks: 'all'
|
|
252
|
+
};
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
} : null;
|
|
238
256
|
class MockRuntimeRspackPlugin {
|
|
239
257
|
apply(compiler) {
|
|
240
258
|
const { RuntimeModule } = compiler.webpack;
|
|
@@ -410,6 +428,19 @@ global.__rstest_clean_core_cache__ = __rstest_clean_core_cache__;
|
|
|
410
428
|
});
|
|
411
429
|
}
|
|
412
430
|
});
|
|
431
|
+
function parseInlineSourceMap(code) {
|
|
432
|
+
const inlineSourceMapRegex = /\/\/# sourceMappingURL=data:application\/json(?:;charset=utf-8)?;base64,(.+)\s*$/m;
|
|
433
|
+
const match = code.match(inlineSourceMapRegex);
|
|
434
|
+
if (!match || !match[1]) return null;
|
|
435
|
+
try {
|
|
436
|
+
const base64Data = match[1];
|
|
437
|
+
const decodedStr = Buffer.from(base64Data, 'base64').toString('utf-8');
|
|
438
|
+
const sourceMap = JSON.parse(decodedStr);
|
|
439
|
+
return sourceMap;
|
|
440
|
+
} catch (_error) {
|
|
441
|
+
return null;
|
|
442
|
+
}
|
|
443
|
+
}
|
|
413
444
|
const isMultiCompiler = (compiler)=>'compilers' in compiler && Array.isArray(compiler.compilers);
|
|
414
445
|
const prepareRsbuild = async (context, globTestSourceEntries, setupFiles)=>{
|
|
415
446
|
const { command, normalizedConfig: { isolate, plugins, resolve, source, output, tools, testEnvironment, performance, dev = {} } } = context;
|
|
@@ -448,7 +479,8 @@ global.__rstest_clean_core_cache__ = __rstest_clean_core_cache__;
|
|
|
448
479
|
isWatch: 'watch' === command
|
|
449
480
|
}),
|
|
450
481
|
pluginExternal(testEnvironment),
|
|
451
|
-
!isolate ? pluginCacheControl(Object.values(setupFiles)) : null
|
|
482
|
+
!isolate ? pluginCacheControl(Object.values(setupFiles)) : null,
|
|
483
|
+
pluginInspect()
|
|
452
484
|
].filter(Boolean)
|
|
453
485
|
}
|
|
454
486
|
});
|
|
@@ -522,9 +554,17 @@ global.__rstest_clean_core_cache__ = __rstest_clean_core_cache__;
|
|
|
522
554
|
files: entryFiles[entry]
|
|
523
555
|
});
|
|
524
556
|
}
|
|
557
|
+
const inlineSourceMap = 'inline-source-map' === stats.compilation.options.devtool;
|
|
525
558
|
const sourceMaps = Object.fromEntries((await Promise.all(assets.map(async (asset)=>{
|
|
526
|
-
const sourceMapPath = asset?.info.related?.sourceMap?.[0];
|
|
527
559
|
const assetFilePath = external_pathe_["default"].join(outputPath, asset.name);
|
|
560
|
+
if (inlineSourceMap) {
|
|
561
|
+
const content = await readFile(assetFilePath);
|
|
562
|
+
return [
|
|
563
|
+
assetFilePath,
|
|
564
|
+
parseInlineSourceMap(content)
|
|
565
|
+
];
|
|
566
|
+
}
|
|
567
|
+
const sourceMapPath = asset?.info.related?.sourceMap?.[0];
|
|
528
568
|
if (sourceMapPath) {
|
|
529
569
|
const filePath = external_pathe_["default"].join(outputPath, sourceMapPath);
|
|
530
570
|
const sourceMap = await readFile(filePath);
|
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
|
|
@@ -1743,7 +1757,7 @@ export const __webpack_modules__ = {
|
|
|
1743
1757
|
var constants = __webpack_require__("./src/utils/constants.ts");
|
|
1744
1758
|
var helper = __webpack_require__("./src/utils/helper.ts");
|
|
1745
1759
|
__webpack_require__("./src/utils/logger.ts");
|
|
1746
|
-
__webpack_require__("
|
|
1760
|
+
__webpack_require__("fs");
|
|
1747
1761
|
__webpack_require__("node:fs/promises");
|
|
1748
1762
|
__webpack_require__("node:module");
|
|
1749
1763
|
__webpack_require__("pathe");
|
package/dist/965.js
CHANGED
package/dist/cli.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
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";
|
|
7
8
|
import * as __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__ from "node:fs/promises";
|
|
9
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_inspector_dd9822d6__ from "node:inspector";
|
|
8
10
|
import * as __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__ from "node:module";
|
|
9
11
|
import * as __WEBPACK_EXTERNAL_MODULE_node_os_74b4b876__ from "node:os";
|
|
10
12
|
import * as __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__ from "node:path";
|
|
@@ -233,7 +235,7 @@ var __webpack_modules__ = {
|
|
|
233
235
|
value: true
|
|
234
236
|
});
|
|
235
237
|
exports.build = void 0;
|
|
236
|
-
const fs_1 = __importDefault(__webpack_require__("
|
|
238
|
+
const fs_1 = __importDefault(__webpack_require__("fs"));
|
|
237
239
|
const path_1 = __webpack_require__("node:path");
|
|
238
240
|
const resolveSymlinksAsync = function(path, state, callback) {
|
|
239
241
|
const { queue, options: { suppressErrors } } = state;
|
|
@@ -292,7 +294,7 @@ var __webpack_modules__ = {
|
|
|
292
294
|
value: true
|
|
293
295
|
});
|
|
294
296
|
exports.build = void 0;
|
|
295
|
-
const fs_1 = __importDefault(__webpack_require__("
|
|
297
|
+
const fs_1 = __importDefault(__webpack_require__("fs"));
|
|
296
298
|
const readdirOpts = {
|
|
297
299
|
withFileTypes: true
|
|
298
300
|
};
|
|
@@ -2180,7 +2182,7 @@ var __webpack_modules__ = {
|
|
|
2180
2182
|
ME: ()=>loadConfig,
|
|
2181
2183
|
hY: ()=>withDefaultConfig
|
|
2182
2184
|
});
|
|
2183
|
-
var node_fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("
|
|
2185
|
+
var node_fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("fs");
|
|
2184
2186
|
var _rsbuild_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("@rsbuild/core");
|
|
2185
2187
|
var pathe__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("pathe");
|
|
2186
2188
|
var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("./src/utils/index.ts");
|
|
@@ -2466,7 +2468,7 @@ var __webpack_modules__ = {
|
|
|
2466
2468
|
var constants = __webpack_require__("./src/utils/constants.ts");
|
|
2467
2469
|
var helper = __webpack_require__("./src/utils/helper.ts");
|
|
2468
2470
|
var logger = __webpack_require__("./src/utils/logger.ts");
|
|
2469
|
-
var external_node_fs_ = __webpack_require__("
|
|
2471
|
+
var external_node_fs_ = __webpack_require__("fs");
|
|
2470
2472
|
var promises_ = __webpack_require__("node:fs/promises");
|
|
2471
2473
|
var external_node_module_ = __webpack_require__("node:module");
|
|
2472
2474
|
var external_pathe_ = __webpack_require__("pathe");
|
|
@@ -2520,8 +2522,8 @@ var __webpack_modules__ = {
|
|
|
2520
2522
|
};
|
|
2521
2523
|
const tryResolve = (request, rootPath)=>{
|
|
2522
2524
|
try {
|
|
2523
|
-
const
|
|
2524
|
-
return
|
|
2525
|
+
const require = (0, external_node_module_.createRequire)(rootPath);
|
|
2526
|
+
return require.resolve(request, {
|
|
2525
2527
|
paths: [
|
|
2526
2528
|
rootPath
|
|
2527
2529
|
]
|
|
@@ -2842,21 +2844,21 @@ var __webpack_modules__ = {
|
|
|
2842
2844
|
"@rsbuild/core": function(module) {
|
|
2843
2845
|
module.exports = __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__;
|
|
2844
2846
|
},
|
|
2845
|
-
"@vitest/snapshot/manager": function(module) {
|
|
2846
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE__vitest_snapshot_manager_ed2bcef6__;
|
|
2847
|
-
},
|
|
2848
2847
|
birpc: function(module) {
|
|
2849
2848
|
module.exports = __WEBPACK_EXTERNAL_MODULE_birpc__;
|
|
2850
2849
|
},
|
|
2851
2850
|
"node:events": function(module) {
|
|
2852
2851
|
module.exports = __WEBPACK_EXTERNAL_MODULE_node_events_0a6aefe7__;
|
|
2853
2852
|
},
|
|
2854
|
-
|
|
2853
|
+
fs: function(module) {
|
|
2855
2854
|
module.exports = __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__;
|
|
2856
2855
|
},
|
|
2857
2856
|
"node:fs/promises": function(module) {
|
|
2858
2857
|
module.exports = __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__;
|
|
2859
2858
|
},
|
|
2859
|
+
"node:inspector": function(module) {
|
|
2860
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_node_inspector_dd9822d6__;
|
|
2861
|
+
},
|
|
2860
2862
|
"node:module": function(module) {
|
|
2861
2863
|
module.exports = __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__;
|
|
2862
2864
|
},
|
|
@@ -3680,7 +3682,6 @@ class CAC extends EventEmitter {
|
|
|
3680
3682
|
const cac = (name = "")=>new CAC(name);
|
|
3681
3683
|
const dist = cac;
|
|
3682
3684
|
var external_pathe_ = __webpack_require__("pathe");
|
|
3683
|
-
var external_std_env_ = __webpack_require__("std-env");
|
|
3684
3685
|
var src_config = __webpack_require__("./src/config.ts");
|
|
3685
3686
|
var helper = __webpack_require__("./src/utils/helper.ts");
|
|
3686
3687
|
function initNodeEnv() {
|
|
@@ -3693,7 +3694,7 @@ function prepareCli() {
|
|
|
3693
3694
|
if (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) console.log();
|
|
3694
3695
|
}
|
|
3695
3696
|
function showRstest() {
|
|
3696
|
-
logger.k.greet(" Rstest v0.1.
|
|
3697
|
+
logger.k.greet(" Rstest v0.1.2");
|
|
3697
3698
|
logger.k.log('');
|
|
3698
3699
|
}
|
|
3699
3700
|
const applyCommonOptions = (cli)=>{
|
|
@@ -3742,18 +3743,18 @@ async function initCli(options) {
|
|
|
3742
3743
|
function setupCommands() {
|
|
3743
3744
|
const cli = dist('rstest');
|
|
3744
3745
|
cli.help();
|
|
3745
|
-
cli.version("0.1.
|
|
3746
|
+
cli.version("0.1.2");
|
|
3746
3747
|
applyCommonOptions(cli);
|
|
3747
|
-
cli.command('[...filters]', 'run tests').action(async (filters, options)=>{
|
|
3748
|
+
cli.command('[...filters]', 'run tests').option('--watch', 'Run tests in watch mode').action(async (filters, options)=>{
|
|
3748
3749
|
showRstest();
|
|
3749
|
-
if (
|
|
3750
|
-
else await runRest(options, filters, '
|
|
3750
|
+
if (options.watch) await runRest(options, filters, 'watch');
|
|
3751
|
+
else await runRest(options, filters, 'run');
|
|
3751
3752
|
});
|
|
3752
3753
|
const runRest = async (options, filters, command)=>{
|
|
3753
3754
|
let rstest;
|
|
3754
3755
|
try {
|
|
3755
3756
|
const { config } = await initCli(options);
|
|
3756
|
-
const { createRstest } = await __webpack_require__.e("
|
|
3757
|
+
const { createRstest } = await __webpack_require__.e("359").then(__webpack_require__.bind(__webpack_require__, "./src/core/index.ts"));
|
|
3757
3758
|
rstest = createRstest(config, command, filters.map(external_pathe_.normalize));
|
|
3758
3759
|
await rstest.runTests();
|
|
3759
3760
|
} catch (err) {
|
|
@@ -3774,7 +3775,7 @@ function setupCommands() {
|
|
|
3774
3775
|
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)=>{
|
|
3775
3776
|
try {
|
|
3776
3777
|
const { config } = await initCli(options);
|
|
3777
|
-
const { createRstest } = await __webpack_require__.e("
|
|
3778
|
+
const { createRstest } = await __webpack_require__.e("359").then(__webpack_require__.bind(__webpack_require__, "./src/core/index.ts"));
|
|
3778
3779
|
const rstest = createRstest(config, 'list', filters.map(external_pathe_.normalize));
|
|
3779
3780
|
await rstest.listTests({
|
|
3780
3781
|
filesOnly: options.filesOnly,
|
package/dist/node.js
CHANGED