@rstest/core 0.0.6 → 0.0.8
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/285.js +1 -1
- package/dist/353.js +1 -1
- package/dist/355.js +4 -3
- package/dist/612.js +32 -4
- package/dist/64.js +1 -1
- package/dist/81.js +1 -1
- package/dist/813.js +2 -1
- package/dist/867.js +29 -22
- package/dist/cli.js +54 -34
- package/dist/worker.js +45 -40
- package/dist-types/node.d.ts +1 -0
- package/dist-types/public.d.ts +37 -1
- package/dist-types/worker.d.ts +1 -0
- package/package.json +5 -5
package/dist/285.js
CHANGED
|
@@ -6,7 +6,7 @@ export const __webpack_modules__ = {
|
|
|
6
6
|
__webpack_require__.d(__webpack_exports__, {
|
|
7
7
|
listTests: ()=>listTests
|
|
8
8
|
});
|
|
9
|
-
var node_fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("
|
|
9
|
+
var node_fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("fs");
|
|
10
10
|
var node_path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("node:path");
|
|
11
11
|
var _pool__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("./src/pool/index.ts");
|
|
12
12
|
var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("./src/utils/index.ts");
|
package/dist/353.js
CHANGED
package/dist/355.js
CHANGED
|
@@ -6,7 +6,7 @@ export const __webpack_modules__ = {
|
|
|
6
6
|
__webpack_require__.d(__webpack_exports__, {
|
|
7
7
|
printError: ()=>printError
|
|
8
8
|
});
|
|
9
|
-
var node_fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("
|
|
9
|
+
var node_fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("fs");
|
|
10
10
|
var _jridgewell_trace_mapping__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/@jridgewell+trace-mapping@0.3.29/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs");
|
|
11
11
|
var stacktrace_parser__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../../node_modules/.pnpm/stacktrace-parser@0.1.11/node_modules/stacktrace-parser/dist/stack-trace-parser.esm.js");
|
|
12
12
|
var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("./src/utils/index.ts");
|
|
@@ -30,6 +30,7 @@ export const __webpack_modules__ = {
|
|
|
30
30
|
if (error.stack) {
|
|
31
31
|
const stackFrames = await parseErrorStacktrace({
|
|
32
32
|
stack: error.stack,
|
|
33
|
+
fullStack: error.fullStack,
|
|
33
34
|
getSourcemap
|
|
34
35
|
});
|
|
35
36
|
if (stackFrames[0]) await printCodeFrame(stackFrames[0]);
|
|
@@ -71,8 +72,8 @@ export const __webpack_modules__ = {
|
|
|
71
72
|
/node:\w+/,
|
|
72
73
|
'<anonymous>'
|
|
73
74
|
];
|
|
74
|
-
async function parseErrorStacktrace({ stack, getSourcemap }) {
|
|
75
|
-
return Promise.all((0, stacktrace_parser__WEBPACK_IMPORTED_MODULE_2__.Q)(stack).filter((frame)=>frame.file && !stackIgnores.some((entry)=>frame.file?.match(entry))).map(async (frame)=>{
|
|
75
|
+
async function parseErrorStacktrace({ stack, getSourcemap, fullStack }) {
|
|
76
|
+
return Promise.all((0, stacktrace_parser__WEBPACK_IMPORTED_MODULE_2__.Q)(stack).filter((frame)=>fullStack ? true : frame.file && !stackIgnores.some((entry)=>frame.file?.match(entry))).map(async (frame)=>{
|
|
76
77
|
const sourcemap = getSourcemap(frame.file);
|
|
77
78
|
if (sourcemap) {
|
|
78
79
|
const traceMap = new _jridgewell_trace_mapping__WEBPACK_IMPORTED_MODULE_1__.s7(sourcemap);
|
package/dist/612.js
CHANGED
|
@@ -7,7 +7,7 @@ export const __webpack_modules__ = {
|
|
|
7
7
|
r: ()=>createRsbuildServer,
|
|
8
8
|
z: ()=>prepareRsbuild
|
|
9
9
|
});
|
|
10
|
-
var external_node_fs_ = __webpack_require__("
|
|
10
|
+
var external_node_fs_ = __webpack_require__("fs");
|
|
11
11
|
var core_ = __webpack_require__("@rsbuild/core");
|
|
12
12
|
var external_pathe_ = __webpack_require__("pathe");
|
|
13
13
|
var utils = __webpack_require__("./src/utils/index.ts");
|
|
@@ -317,7 +317,8 @@ global.__rstest_clean_core_cache__ = __rstest_clean_core_cache__;
|
|
|
317
317
|
target: 'node'
|
|
318
318
|
},
|
|
319
319
|
tools: {
|
|
320
|
-
rspack: (config)=>{
|
|
320
|
+
rspack: (config, { isProd })=>{
|
|
321
|
+
config.mode = isProd ? 'production' : 'development';
|
|
321
322
|
config.output ??= {};
|
|
322
323
|
config.output.iife = false;
|
|
323
324
|
config.output.importFunctionName = '__rstest_dynamic_import__';
|
|
@@ -346,12 +347,19 @@ global.__rstest_clean_core_cache__ = __rstest_clean_core_cache__;
|
|
|
346
347
|
config.resolve ??= {};
|
|
347
348
|
config.resolve.extensions ??= [];
|
|
348
349
|
config.resolve.extensions.push('.cjs');
|
|
349
|
-
if ('node' === testEnvironment
|
|
350
|
+
if ('node' === testEnvironment) config.resolve.mainFields = config.resolve.mainFields?.filter((filed)=>'module' !== filed) || [
|
|
350
351
|
'main'
|
|
351
352
|
];
|
|
353
|
+
config.resolve.byDependency ??= {};
|
|
354
|
+
config.resolve.byDependency.commonjs ??= {};
|
|
355
|
+
config.resolve.byDependency.commonjs.mainFields = [
|
|
356
|
+
'main',
|
|
357
|
+
'...'
|
|
358
|
+
];
|
|
352
359
|
config.optimization = {
|
|
353
360
|
moduleIds: 'named',
|
|
354
361
|
chunkIds: 'named',
|
|
362
|
+
nodeEnv: false,
|
|
355
363
|
...config.optimization || {},
|
|
356
364
|
runtimeChunk: {
|
|
357
365
|
name: 'runtime'
|
|
@@ -397,7 +405,7 @@ global.__rstest_clean_core_cache__ = __rstest_clean_core_cache__;
|
|
|
397
405
|
if ((0, utils.L1)()) await rsbuildInstance.inspectConfig({
|
|
398
406
|
writeToDisk: true,
|
|
399
407
|
extraConfigs: {
|
|
400
|
-
|
|
408
|
+
rstest: normalizedConfig
|
|
401
409
|
}
|
|
402
410
|
});
|
|
403
411
|
const outputFileSystem = (isMultiCompiler(rspackCompiler) ? rspackCompiler.compilers[0].outputFileSystem : rspackCompiler.outputFileSystem) || external_node_fs_["default"];
|
|
@@ -662,6 +670,17 @@ global.__rstest_clean_core_cache__ = __rstest_clean_core_cache__;
|
|
|
662
670
|
updateSnapshot
|
|
663
671
|
},
|
|
664
672
|
rpcMethods
|
|
673
|
+
}).catch((err)=>{
|
|
674
|
+
err.fullStack = true;
|
|
675
|
+
return {
|
|
676
|
+
testPath: entryInfo.testPath,
|
|
677
|
+
status: 'fail',
|
|
678
|
+
name: '',
|
|
679
|
+
results: [],
|
|
680
|
+
errors: [
|
|
681
|
+
err
|
|
682
|
+
]
|
|
683
|
+
};
|
|
665
684
|
});
|
|
666
685
|
}));
|
|
667
686
|
for (const result of results)if (result.snapshotResult) context.snapshotManager.add(result.snapshotResult);
|
|
@@ -687,6 +706,15 @@ global.__rstest_clean_core_cache__ = __rstest_clean_core_cache__;
|
|
|
687
706
|
updateSnapshot
|
|
688
707
|
},
|
|
689
708
|
rpcMethods
|
|
709
|
+
}).catch((err)=>{
|
|
710
|
+
err.fullStack = true;
|
|
711
|
+
return {
|
|
712
|
+
testPath: entryInfo.testPath,
|
|
713
|
+
tests: [],
|
|
714
|
+
errors: [
|
|
715
|
+
err
|
|
716
|
+
]
|
|
717
|
+
};
|
|
690
718
|
});
|
|
691
719
|
})),
|
|
692
720
|
close: ()=>pool.close()
|
package/dist/64.js
CHANGED
|
@@ -35,7 +35,7 @@ export const __webpack_modules__ = {
|
|
|
35
35
|
"../../node_modules/.pnpm/source-map-support@0.5.21/node_modules/source-map-support/source-map-support.js": function(module, exports, __webpack_require__) {
|
|
36
36
|
module = __webpack_require__.nmd(module);
|
|
37
37
|
var SourceMapConsumer = __webpack_require__("../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/source-map.js").SourceMapConsumer;
|
|
38
|
-
var path = __webpack_require__("path");
|
|
38
|
+
var path = __webpack_require__("node:path");
|
|
39
39
|
var fs;
|
|
40
40
|
try {
|
|
41
41
|
fs = __webpack_require__("fs");
|
package/dist/81.js
CHANGED
|
@@ -212,7 +212,7 @@ export const __webpack_modules__ = {
|
|
|
212
212
|
isPresent.hrtime = _global.process && "function" == typeof _global.process.hrtime;
|
|
213
213
|
isPresent.hrtimeBigint = isPresent.hrtime && "function" == typeof _global.process.hrtime.bigint;
|
|
214
214
|
isPresent.nextTick = _global.process && "function" == typeof _global.process.nextTick;
|
|
215
|
-
const utilPromisify = _global.process && __webpack_require__("util").promisify;
|
|
215
|
+
const utilPromisify = _global.process && __webpack_require__("node:util").promisify;
|
|
216
216
|
isPresent.performance = _global.performance && "function" == typeof _global.performance.now;
|
|
217
217
|
const hasPerformancePrototype = _global.Performance && (typeof _global.Performance).match(/^(function|object)$/);
|
|
218
218
|
const hasPerformanceConstructorPrototype = _global.performance && _global.performance.constructor && _global.performance.constructor.prototype;
|
package/dist/813.js
CHANGED
|
@@ -132,8 +132,9 @@ export const __webpack_modules__ = {
|
|
|
132
132
|
var constants = __webpack_require__("./src/utils/constants.ts");
|
|
133
133
|
var helper = __webpack_require__("./src/utils/helper.ts");
|
|
134
134
|
__webpack_require__("./src/utils/logger.ts");
|
|
135
|
-
__webpack_require__("
|
|
135
|
+
__webpack_require__("fs");
|
|
136
136
|
__webpack_require__("node:fs/promises");
|
|
137
|
+
__webpack_require__("node:module");
|
|
137
138
|
__webpack_require__("pathe");
|
|
138
139
|
}
|
|
139
140
|
};
|
package/dist/867.js
CHANGED
|
@@ -586,7 +586,7 @@ export const __webpack_modules__ = {
|
|
|
586
586
|
}
|
|
587
587
|
};
|
|
588
588
|
}
|
|
589
|
-
function limitConcurrency(concurrency =
|
|
589
|
+
function limitConcurrency(concurrency = 1 / 0) {
|
|
590
590
|
let running = 0;
|
|
591
591
|
const queue = [];
|
|
592
592
|
const runNext = ()=>{
|
|
@@ -927,14 +927,12 @@ export const __webpack_modules__ = {
|
|
|
927
927
|
testPath;
|
|
928
928
|
collectStatus = 'lazy';
|
|
929
929
|
currentCollectList = [];
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
constructor({ testPath, testTimeout, hookTimeout }){
|
|
930
|
+
runtimeConfig;
|
|
931
|
+
constructor({ testPath, runtimeConfig }){
|
|
933
932
|
this.testPath = testPath;
|
|
934
|
-
this.
|
|
935
|
-
this.defaultHookTimeout = hookTimeout;
|
|
933
|
+
this.runtimeConfig = runtimeConfig;
|
|
936
934
|
}
|
|
937
|
-
afterAll(fn, timeout = this.
|
|
935
|
+
afterAll(fn, timeout = this.runtimeConfig.hookTimeout) {
|
|
938
936
|
const currentSuite = this.getCurrentSuite();
|
|
939
937
|
registerTestSuiteListener(currentSuite, 'afterAll', wrapTimeout({
|
|
940
938
|
name: 'afterAll hook',
|
|
@@ -943,7 +941,7 @@ export const __webpack_modules__ = {
|
|
|
943
941
|
stackTraceError: new Error('STACK_TRACE_ERROR')
|
|
944
942
|
}));
|
|
945
943
|
}
|
|
946
|
-
beforeAll(fn, timeout = this.
|
|
944
|
+
beforeAll(fn, timeout = this.runtimeConfig.hookTimeout) {
|
|
947
945
|
const currentSuite = this.getCurrentSuite();
|
|
948
946
|
registerTestSuiteListener(currentSuite, 'beforeAll', wrapTimeout({
|
|
949
947
|
name: 'beforeAll hook',
|
|
@@ -952,7 +950,7 @@ export const __webpack_modules__ = {
|
|
|
952
950
|
stackTraceError: new Error('STACK_TRACE_ERROR')
|
|
953
951
|
}));
|
|
954
952
|
}
|
|
955
|
-
afterEach(fn, timeout = this.
|
|
953
|
+
afterEach(fn, timeout = this.runtimeConfig.hookTimeout) {
|
|
956
954
|
const currentSuite = this.getCurrentSuite();
|
|
957
955
|
registerTestSuiteListener(currentSuite, 'afterEach', wrapTimeout({
|
|
958
956
|
name: 'afterEach hook',
|
|
@@ -961,7 +959,7 @@ export const __webpack_modules__ = {
|
|
|
961
959
|
stackTraceError: new Error('STACK_TRACE_ERROR')
|
|
962
960
|
}));
|
|
963
961
|
}
|
|
964
|
-
beforeEach(fn, timeout = this.
|
|
962
|
+
beforeEach(fn, timeout = this.runtimeConfig.hookTimeout) {
|
|
965
963
|
const currentSuite = this.getCurrentSuite();
|
|
966
964
|
registerTestSuiteListener(currentSuite, 'beforeEach', wrapTimeout({
|
|
967
965
|
name: 'beforeEach hook',
|
|
@@ -1053,7 +1051,7 @@ export const __webpack_modules__ = {
|
|
|
1053
1051
|
ensureRootSuite() {
|
|
1054
1052
|
if (0 === this._currentTest.length) this.addTest(this.getDefaultRootSuite());
|
|
1055
1053
|
}
|
|
1056
|
-
it({ name, fn, originalFn = fn, fixtures, timeout = this.
|
|
1054
|
+
it({ name, fn, originalFn = fn, fixtures, timeout = this.runtimeConfig.testTimeout, runMode = 'run', fails = false, each = false, concurrent, sequential }) {
|
|
1057
1055
|
this.addTestCase({
|
|
1058
1056
|
name,
|
|
1059
1057
|
originalFn,
|
|
@@ -1101,7 +1099,7 @@ export const __webpack_modules__ = {
|
|
|
1101
1099
|
};
|
|
1102
1100
|
}
|
|
1103
1101
|
each({ cases, ...options }) {
|
|
1104
|
-
return (name, fn, timeout = this.
|
|
1102
|
+
return (name, fn, timeout = this.runtimeConfig.testTimeout)=>{
|
|
1105
1103
|
for(let i = 0; i < cases.length; i++){
|
|
1106
1104
|
const param = cases[i];
|
|
1107
1105
|
const params = (0, src_utils.XQ)(param);
|
|
@@ -1117,7 +1115,7 @@ export const __webpack_modules__ = {
|
|
|
1117
1115
|
};
|
|
1118
1116
|
}
|
|
1119
1117
|
for({ cases, ...options }) {
|
|
1120
|
-
return (name, fn, timeout = this.
|
|
1118
|
+
return (name, fn, timeout = this.runtimeConfig.testTimeout)=>{
|
|
1121
1119
|
for(let i = 0; i < cases.length; i++){
|
|
1122
1120
|
const param = cases[i];
|
|
1123
1121
|
this.it({
|
|
@@ -1140,11 +1138,10 @@ export const __webpack_modules__ = {
|
|
|
1140
1138
|
throw new Error('Expect to find a suite, but got undefined');
|
|
1141
1139
|
}
|
|
1142
1140
|
}
|
|
1143
|
-
const createRuntimeAPI = ({ testPath,
|
|
1141
|
+
const createRuntimeAPI = ({ testPath, runtimeConfig })=>{
|
|
1144
1142
|
const runtimeInstance = new RunnerRuntime({
|
|
1145
1143
|
testPath,
|
|
1146
|
-
|
|
1147
|
-
hookTimeout
|
|
1144
|
+
runtimeConfig
|
|
1148
1145
|
});
|
|
1149
1146
|
const createTestAPI = (options = {})=>{
|
|
1150
1147
|
const testFn = (name, fn, timeout)=>runtimeInstance.it({
|
|
@@ -1292,11 +1289,10 @@ export const __webpack_modules__ = {
|
|
|
1292
1289
|
};
|
|
1293
1290
|
};
|
|
1294
1291
|
function createRunner({ workerState }) {
|
|
1295
|
-
const { testPath, runtimeConfig: {
|
|
1292
|
+
const { testPath, runtimeConfig: { testNamePattern } } = workerState;
|
|
1296
1293
|
const runtime = createRuntimeAPI({
|
|
1297
1294
|
testPath,
|
|
1298
|
-
|
|
1299
|
-
hookTimeout
|
|
1295
|
+
runtimeConfig: workerState.runtimeConfig
|
|
1300
1296
|
});
|
|
1301
1297
|
const testRunner = new TestRunner();
|
|
1302
1298
|
return {
|
|
@@ -1570,10 +1566,11 @@ export const __webpack_modules__ = {
|
|
|
1570
1566
|
return wrapSpy(obj, method);
|
|
1571
1567
|
};
|
|
1572
1568
|
const isMockFunction = (fn)=>'function' == typeof fn && '_isMockFunction' in fn && fn._isMockFunction;
|
|
1573
|
-
const createRstestUtilities = ()=>{
|
|
1569
|
+
const createRstestUtilities = (workerState)=>{
|
|
1574
1570
|
const originalEnvValues = new Map();
|
|
1575
1571
|
const originalGlobalValues = new Map();
|
|
1576
1572
|
let _timers;
|
|
1573
|
+
let originalConfig;
|
|
1577
1574
|
const timers = ()=>{
|
|
1578
1575
|
if (!_timers) _timers = new FakeTimers({
|
|
1579
1576
|
global: globalThis
|
|
@@ -1607,6 +1604,15 @@ export const __webpack_modules__ = {
|
|
|
1607
1604
|
importActual: async ()=>({}),
|
|
1608
1605
|
requireActual: ()=>({}),
|
|
1609
1606
|
resetModules: ()=>rstest,
|
|
1607
|
+
setConfig: (config)=>{
|
|
1608
|
+
if (!originalConfig) originalConfig = {
|
|
1609
|
+
...workerState.runtimeConfig
|
|
1610
|
+
};
|
|
1611
|
+
Object.assign(workerState.runtimeConfig, config);
|
|
1612
|
+
},
|
|
1613
|
+
resetConfig: ()=>{
|
|
1614
|
+
if (originalConfig) Object.assign(workerState.runtimeConfig, originalConfig);
|
|
1615
|
+
},
|
|
1610
1616
|
stubEnv: (name, value)=>{
|
|
1611
1617
|
if (!originalEnvValues.has(name)) originalEnvValues.set(name, process.env[name]);
|
|
1612
1618
|
if (void 0 === value) delete process.env[name];
|
|
@@ -1712,7 +1718,7 @@ export const __webpack_modules__ = {
|
|
|
1712
1718
|
writable: true,
|
|
1713
1719
|
configurable: true
|
|
1714
1720
|
});
|
|
1715
|
-
const rstest = createRstestUtilities();
|
|
1721
|
+
const rstest = createRstestUtilities(workerState);
|
|
1716
1722
|
return {
|
|
1717
1723
|
runner,
|
|
1718
1724
|
api: {
|
|
@@ -1737,8 +1743,9 @@ export const __webpack_modules__ = {
|
|
|
1737
1743
|
var constants = __webpack_require__("./src/utils/constants.ts");
|
|
1738
1744
|
var helper = __webpack_require__("./src/utils/helper.ts");
|
|
1739
1745
|
__webpack_require__("./src/utils/logger.ts");
|
|
1740
|
-
__webpack_require__("
|
|
1746
|
+
__webpack_require__("fs");
|
|
1741
1747
|
__webpack_require__("node:fs/promises");
|
|
1748
|
+
__webpack_require__("node:module");
|
|
1742
1749
|
__webpack_require__("pathe");
|
|
1743
1750
|
}
|
|
1744
1751
|
};
|
package/dist/cli.js
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import node_process from "node:process";
|
|
2
|
-
import node_tty from "node:tty";
|
|
3
2
|
import * as __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__ from "@rsbuild/core";
|
|
4
3
|
import * as __WEBPACK_EXTERNAL_MODULE__vitest_snapshot_manager_ed2bcef6__ from "@vitest/snapshot/manager";
|
|
5
4
|
import * as __WEBPACK_EXTERNAL_MODULE_birpc__ from "birpc";
|
|
6
|
-
import * as __WEBPACK_EXTERNAL_MODULE_fs__ from "fs";
|
|
7
5
|
import * as __WEBPACK_EXTERNAL_MODULE_node_events_0a6aefe7__ from "node:events";
|
|
8
6
|
import * as __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__ from "node:fs";
|
|
9
7
|
import * as __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__ from "node:fs/promises";
|
|
8
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__ from "node:module";
|
|
10
9
|
import * as __WEBPACK_EXTERNAL_MODULE_node_os_74b4b876__ from "node:os";
|
|
11
10
|
import * as __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__ from "node:path";
|
|
11
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_tty_c64aab7e__ from "node:tty";
|
|
12
12
|
import * as __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__ from "node:url";
|
|
13
13
|
import * as __WEBPACK_EXTERNAL_MODULE_node_util_1b29d436__ from "node:util";
|
|
14
14
|
import * as __WEBPACK_EXTERNAL_MODULE_node_v8_d0df5498__ from "node:v8";
|
|
15
|
-
import * as __WEBPACK_EXTERNAL_MODULE_path__ from "path";
|
|
16
15
|
import * as __WEBPACK_EXTERNAL_MODULE_pathe__ from "pathe";
|
|
17
16
|
import * as __WEBPACK_EXTERNAL_MODULE_std_env_1c7b8267__ from "std-env";
|
|
18
17
|
import * as __WEBPACK_EXTERNAL_MODULE_tinypool__ from "tinypool";
|
|
@@ -139,7 +138,7 @@ var __webpack_modules__ = {
|
|
|
139
138
|
value: true
|
|
140
139
|
});
|
|
141
140
|
exports.build = exports.joinDirectoryPath = exports.joinPathWithBasePath = void 0;
|
|
142
|
-
const path_1 = __webpack_require__("path");
|
|
141
|
+
const path_1 = __webpack_require__("node:path");
|
|
143
142
|
const utils_1 = __webpack_require__("../../node_modules/.pnpm/fdir@6.4.4_picomatch@4.0.2/node_modules/fdir/dist/utils.js");
|
|
144
143
|
function joinPathWithBasePath(filename, directoryPath) {
|
|
145
144
|
return directoryPath + filename;
|
|
@@ -235,7 +234,7 @@ var __webpack_modules__ = {
|
|
|
235
234
|
});
|
|
236
235
|
exports.build = void 0;
|
|
237
236
|
const fs_1 = __importDefault(__webpack_require__("fs"));
|
|
238
|
-
const path_1 = __webpack_require__("path");
|
|
237
|
+
const path_1 = __webpack_require__("node:path");
|
|
239
238
|
const resolveSymlinksAsync = function(path, state, callback) {
|
|
240
239
|
const { queue, options: { suppressErrors } } = state;
|
|
241
240
|
queue.enqueue();
|
|
@@ -392,7 +391,7 @@ var __webpack_modules__ = {
|
|
|
392
391
|
value: true
|
|
393
392
|
});
|
|
394
393
|
exports.Walker = void 0;
|
|
395
|
-
const path_1 = __webpack_require__("path");
|
|
394
|
+
const path_1 = __webpack_require__("node:path");
|
|
396
395
|
const utils_1 = __webpack_require__("../../node_modules/.pnpm/fdir@6.4.4_picomatch@4.0.2/node_modules/fdir/dist/utils.js");
|
|
397
396
|
const joinPath = __importStar(__webpack_require__("../../node_modules/.pnpm/fdir@6.4.4_picomatch@4.0.2/node_modules/fdir/dist/api/functions/join-path.js"));
|
|
398
397
|
const pushDirectory = __importStar(__webpack_require__("../../node_modules/.pnpm/fdir@6.4.4_picomatch@4.0.2/node_modules/fdir/dist/api/functions/push-directory.js"));
|
|
@@ -513,7 +512,7 @@ var __webpack_modules__ = {
|
|
|
513
512
|
value: true
|
|
514
513
|
});
|
|
515
514
|
exports.Builder = void 0;
|
|
516
|
-
const path_1 = __webpack_require__("path");
|
|
515
|
+
const path_1 = __webpack_require__("node:path");
|
|
517
516
|
const api_builder_1 = __webpack_require__("../../node_modules/.pnpm/fdir@6.4.4_picomatch@4.0.2/node_modules/fdir/dist/builder/api-builder.js");
|
|
518
517
|
var pm = null;
|
|
519
518
|
try {
|
|
@@ -678,7 +677,7 @@ var __webpack_modules__ = {
|
|
|
678
677
|
value: true
|
|
679
678
|
});
|
|
680
679
|
exports.normalizePath = exports.isRootDirectory = exports.convertSlashes = exports.cleanPath = void 0;
|
|
681
|
-
const path_1 = __webpack_require__("path");
|
|
680
|
+
const path_1 = __webpack_require__("node:path");
|
|
682
681
|
function cleanPath(path) {
|
|
683
682
|
let normalized = (0, path_1.normalize)(path);
|
|
684
683
|
if (normalized.length > 1 && normalized[normalized.length - 1] === path_1.sep) normalized = normalized.substring(0, normalized.length - 1);
|
|
@@ -2181,7 +2180,7 @@ var __webpack_modules__ = {
|
|
|
2181
2180
|
ME: ()=>loadConfig,
|
|
2182
2181
|
hY: ()=>withDefaultConfig
|
|
2183
2182
|
});
|
|
2184
|
-
var node_fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("
|
|
2183
|
+
var node_fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("fs");
|
|
2185
2184
|
var _rsbuild_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("@rsbuild/core");
|
|
2186
2185
|
var pathe__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("pathe");
|
|
2187
2186
|
var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("./src/utils/index.ts");
|
|
@@ -2299,7 +2298,6 @@ var __webpack_modules__ = {
|
|
|
2299
2298
|
Yz: ()=>getTaskNameWithPrefix,
|
|
2300
2299
|
Z: ()=>formatError,
|
|
2301
2300
|
ZY: ()=>getAbsolutePath,
|
|
2302
|
-
mP: ()=>getNodeVersion,
|
|
2303
2301
|
v8: ()=>serializableConfig
|
|
2304
2302
|
});
|
|
2305
2303
|
var pathe__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("pathe");
|
|
@@ -2450,7 +2448,6 @@ var __webpack_modules__ = {
|
|
|
2450
2448
|
aA: ()=>getSetupFiles,
|
|
2451
2449
|
kg: ()=>logger.k,
|
|
2452
2450
|
Io: ()=>constants.Io,
|
|
2453
|
-
mP: ()=>helper.mP,
|
|
2454
2451
|
Ps: ()=>formatTestPath,
|
|
2455
2452
|
XQ: ()=>helper.XQ,
|
|
2456
2453
|
Nk: ()=>constants.Nk,
|
|
@@ -2467,8 +2464,9 @@ var __webpack_modules__ = {
|
|
|
2467
2464
|
var constants = __webpack_require__("./src/utils/constants.ts");
|
|
2468
2465
|
var helper = __webpack_require__("./src/utils/helper.ts");
|
|
2469
2466
|
var logger = __webpack_require__("./src/utils/logger.ts");
|
|
2470
|
-
var external_node_fs_ = __webpack_require__("
|
|
2467
|
+
var external_node_fs_ = __webpack_require__("fs");
|
|
2471
2468
|
var promises_ = __webpack_require__("node:fs/promises");
|
|
2469
|
+
var external_node_module_ = __webpack_require__("node:module");
|
|
2472
2470
|
var external_pathe_ = __webpack_require__("pathe");
|
|
2473
2471
|
var dist = __webpack_require__("../../node_modules/.pnpm/tinyglobby@0.2.14/node_modules/tinyglobby/dist/index.mjs");
|
|
2474
2472
|
const filterFiles = (testFiles, filters, dir)=>{
|
|
@@ -2518,18 +2516,38 @@ var __webpack_modules__ = {
|
|
|
2518
2516
|
];
|
|
2519
2517
|
}));
|
|
2520
2518
|
};
|
|
2519
|
+
const tryResolve = (request, rootPath)=>{
|
|
2520
|
+
try {
|
|
2521
|
+
const require1 = (0, external_node_module_.createRequire)(rootPath);
|
|
2522
|
+
return require1.resolve(request, {
|
|
2523
|
+
paths: [
|
|
2524
|
+
rootPath
|
|
2525
|
+
]
|
|
2526
|
+
});
|
|
2527
|
+
} catch (_err) {
|
|
2528
|
+
return;
|
|
2529
|
+
}
|
|
2530
|
+
};
|
|
2521
2531
|
const getSetupFiles = (setups, rootPath)=>Object.fromEntries((0, helper.XQ)(setups).map((setupFile)=>{
|
|
2522
2532
|
const setupFilePath = (0, helper.ZY)(rootPath, setupFile);
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2533
|
+
try {
|
|
2534
|
+
if (!(0, external_node_fs_.existsSync)(setupFilePath)) {
|
|
2535
|
+
let errorMessage = `Setup file ${helper.$_.red(setupFile)} not found`;
|
|
2536
|
+
if (setupFilePath !== setupFile) errorMessage += helper.$_.gray(` (resolved path: ${setupFilePath})`);
|
|
2537
|
+
throw errorMessage;
|
|
2538
|
+
}
|
|
2539
|
+
const relativePath = external_pathe_["default"].relative(rootPath, setupFilePath);
|
|
2540
|
+
return [
|
|
2541
|
+
formatTestEntryName(relativePath),
|
|
2542
|
+
setupFilePath
|
|
2543
|
+
];
|
|
2544
|
+
} catch (err) {
|
|
2545
|
+
if (tryResolve(setupFile, rootPath)) return [
|
|
2546
|
+
formatTestEntryName(setupFile),
|
|
2547
|
+
setupFile
|
|
2548
|
+
];
|
|
2549
|
+
throw err;
|
|
2527
2550
|
}
|
|
2528
|
-
const relativePath = external_pathe_["default"].relative(rootPath, setupFilePath);
|
|
2529
|
-
return [
|
|
2530
|
-
formatTestEntryName(relativePath),
|
|
2531
|
-
setupFilePath
|
|
2532
|
-
];
|
|
2533
2551
|
}));
|
|
2534
2552
|
const prettyTestPath = (testPath)=>{
|
|
2535
2553
|
const { dir, base } = (0, helper.H)(testPath);
|
|
@@ -2547,6 +2565,7 @@ var __webpack_modules__ = {
|
|
|
2547
2565
|
k: ()=>src_logger
|
|
2548
2566
|
});
|
|
2549
2567
|
var external_node_os_ = __webpack_require__("node:os");
|
|
2568
|
+
var external_node_tty_ = __webpack_require__("node:tty");
|
|
2550
2569
|
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : node_process.argv) {
|
|
2551
2570
|
const prefix = flag.startsWith('-') ? '' : 1 === flag.length ? '-' : '--';
|
|
2552
2571
|
const position = argv.indexOf(prefix + flag);
|
|
@@ -2639,10 +2658,10 @@ var __webpack_modules__ = {
|
|
|
2639
2658
|
}
|
|
2640
2659
|
const supportsColor = {
|
|
2641
2660
|
stdout: createSupportsColor({
|
|
2642
|
-
isTTY:
|
|
2661
|
+
isTTY: external_node_tty_["default"].isatty(1)
|
|
2643
2662
|
}),
|
|
2644
2663
|
stderr: createSupportsColor({
|
|
2645
|
-
isTTY:
|
|
2664
|
+
isTTY: external_node_tty_["default"].isatty(2)
|
|
2646
2665
|
})
|
|
2647
2666
|
};
|
|
2648
2667
|
const supports_color = supportsColor;
|
|
@@ -2827,24 +2846,27 @@ var __webpack_modules__ = {
|
|
|
2827
2846
|
birpc: function(module) {
|
|
2828
2847
|
module.exports = __WEBPACK_EXTERNAL_MODULE_birpc__;
|
|
2829
2848
|
},
|
|
2830
|
-
fs: function(module) {
|
|
2831
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE_fs__;
|
|
2832
|
-
},
|
|
2833
2849
|
"node:events": function(module) {
|
|
2834
2850
|
module.exports = __WEBPACK_EXTERNAL_MODULE_node_events_0a6aefe7__;
|
|
2835
2851
|
},
|
|
2836
|
-
|
|
2852
|
+
fs: function(module) {
|
|
2837
2853
|
module.exports = __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__;
|
|
2838
2854
|
},
|
|
2839
2855
|
"node:fs/promises": function(module) {
|
|
2840
2856
|
module.exports = __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__;
|
|
2841
2857
|
},
|
|
2858
|
+
"node:module": function(module) {
|
|
2859
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__;
|
|
2860
|
+
},
|
|
2842
2861
|
"node:os": function(module) {
|
|
2843
2862
|
module.exports = __WEBPACK_EXTERNAL_MODULE_node_os_74b4b876__;
|
|
2844
2863
|
},
|
|
2845
2864
|
"node:path": function(module) {
|
|
2846
2865
|
module.exports = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__;
|
|
2847
2866
|
},
|
|
2867
|
+
"node:tty": function(module) {
|
|
2868
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_node_tty_c64aab7e__;
|
|
2869
|
+
},
|
|
2848
2870
|
"node:url": function(module) {
|
|
2849
2871
|
module.exports = __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__;
|
|
2850
2872
|
},
|
|
@@ -2854,9 +2876,6 @@ var __webpack_modules__ = {
|
|
|
2854
2876
|
"node:v8": function(module) {
|
|
2855
2877
|
module.exports = __WEBPACK_EXTERNAL_MODULE_node_v8_d0df5498__;
|
|
2856
2878
|
},
|
|
2857
|
-
path: function(module) {
|
|
2858
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE_path__;
|
|
2859
|
-
},
|
|
2860
2879
|
pathe: function(module) {
|
|
2861
2880
|
module.exports = __WEBPACK_EXTERNAL_MODULE_pathe__;
|
|
2862
2881
|
},
|
|
@@ -2870,7 +2889,7 @@ var __webpack_modules__ = {
|
|
|
2870
2889
|
__webpack_require__.d(__webpack_exports__, {
|
|
2871
2890
|
zA: ()=>glob
|
|
2872
2891
|
});
|
|
2873
|
-
var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("path");
|
|
2892
|
+
var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("node:path");
|
|
2874
2893
|
var fdir__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/fdir@6.4.4_picomatch@4.0.2/node_modules/fdir/dist/index.js");
|
|
2875
2894
|
var picomatch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.2/node_modules/picomatch/index.js");
|
|
2876
2895
|
const ONLY_PARENT_DIRECTORIES = /^(\/?\.\.)+$/;
|
|
@@ -3671,13 +3690,13 @@ function prepareCli() {
|
|
|
3671
3690
|
if (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) console.log();
|
|
3672
3691
|
}
|
|
3673
3692
|
function showRstest() {
|
|
3674
|
-
logger.k.greet(" Rstest v0.0.
|
|
3693
|
+
logger.k.greet(" Rstest v0.0.8");
|
|
3675
3694
|
logger.k.log('');
|
|
3676
3695
|
}
|
|
3677
3696
|
const applyCommonOptions = (cli)=>{
|
|
3678
3697
|
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`', {
|
|
3679
3698
|
default: 'jiti'
|
|
3680
|
-
}).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('--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');
|
|
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');
|
|
3681
3700
|
};
|
|
3682
3701
|
async function initCli(options) {
|
|
3683
3702
|
const cwd = process.cwd();
|
|
@@ -3710,6 +3729,7 @@ async function initCli(options) {
|
|
|
3710
3729
|
];
|
|
3711
3730
|
for (const key of keys)if (void 0 !== options[key]) config[key] = options[key];
|
|
3712
3731
|
if (options.exclude) config.exclude = (0, helper.XQ)(options.exclude);
|
|
3732
|
+
if (options.include) config.include = (0, helper.XQ)(options.include);
|
|
3713
3733
|
return {
|
|
3714
3734
|
config,
|
|
3715
3735
|
configFilePath
|
|
@@ -3718,7 +3738,7 @@ async function initCli(options) {
|
|
|
3718
3738
|
function setupCommands() {
|
|
3719
3739
|
const cli = dist('rstest');
|
|
3720
3740
|
cli.help();
|
|
3721
|
-
cli.version("0.0.
|
|
3741
|
+
cli.version("0.0.8");
|
|
3722
3742
|
applyCommonOptions(cli);
|
|
3723
3743
|
cli.command('[...filters]', 'run tests').action(async (filters, options)=>{
|
|
3724
3744
|
showRstest();
|
package/dist/worker.js
CHANGED
|
@@ -1,24 +1,19 @@
|
|
|
1
1
|
/*! For license information please see worker.js.LICENSE.txt */
|
|
2
2
|
import node_process from "node:process";
|
|
3
|
-
import node_tty from "node:tty";
|
|
4
3
|
import * as __WEBPACK_EXTERNAL_MODULE__vitest_expect_97b57ccd__ from "@vitest/expect";
|
|
5
4
|
import * as __WEBPACK_EXTERNAL_MODULE__vitest_snapshot_692a7094__ from "@vitest/snapshot";
|
|
6
5
|
import * as __WEBPACK_EXTERNAL_MODULE_chai__ from "chai";
|
|
7
|
-
import * as __WEBPACK_EXTERNAL_MODULE_fs__ from "fs";
|
|
8
6
|
import * as __WEBPACK_EXTERNAL_MODULE_node_assert_3e74d44e__ from "node:assert";
|
|
9
7
|
import * as __WEBPACK_EXTERNAL_MODULE_node_console_8631dfae__ from "node:console";
|
|
10
8
|
import * as __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__ from "node:fs";
|
|
11
9
|
import * as __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__ from "node:fs/promises";
|
|
10
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__ from "node:module";
|
|
12
11
|
import * as __WEBPACK_EXTERNAL_MODULE_node_os_74b4b876__ from "node:os";
|
|
12
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__ from "node:path";
|
|
13
13
|
import * as __WEBPACK_EXTERNAL_MODULE_node_timers_7045d530__ from "node:timers";
|
|
14
|
+
import * as __WEBPACK_EXTERNAL_MODULE_node_tty_c64aab7e__ from "node:tty";
|
|
14
15
|
import * as __WEBPACK_EXTERNAL_MODULE_node_util_1b29d436__ from "node:util";
|
|
15
|
-
import * as __WEBPACK_EXTERNAL_MODULE_os__ from "os";
|
|
16
|
-
import * as __WEBPACK_EXTERNAL_MODULE_path__ from "path";
|
|
17
16
|
import * as __WEBPACK_EXTERNAL_MODULE_pathe__ from "pathe";
|
|
18
|
-
import * as __WEBPACK_EXTERNAL_MODULE_tty__ from "tty";
|
|
19
|
-
import * as __WEBPACK_EXTERNAL_MODULE_util__ from "util";
|
|
20
|
-
import { createRequire } from "node:module";
|
|
21
|
-
import { isAbsolute } from "node:path";
|
|
22
17
|
import { pathToFileURL } from "node:url";
|
|
23
18
|
import node_vm from "node:vm";
|
|
24
19
|
import node_v8 from "node:v8";
|
|
@@ -2887,7 +2882,7 @@ var __webpack_modules__ = {
|
|
|
2887
2882
|
return -1 !== position && (-1 === terminatorPosition || position < terminatorPosition);
|
|
2888
2883
|
};
|
|
2889
2884
|
},
|
|
2890
|
-
"../../node_modules/.pnpm/jest-diff@30.0.
|
|
2885
|
+
"../../node_modules/.pnpm/jest-diff@30.0.4/node_modules/jest-diff/build/index.js": function(module, __unused_webpack_exports, __webpack_require__) {
|
|
2891
2886
|
/*!
|
|
2892
2887
|
* /**
|
|
2893
2888
|
* * Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
@@ -4556,8 +4551,8 @@ var __webpack_modules__ = {
|
|
|
4556
4551
|
escapeString: true,
|
|
4557
4552
|
highlight: false,
|
|
4558
4553
|
indent: 2,
|
|
4559
|
-
maxDepth:
|
|
4560
|
-
maxWidth:
|
|
4554
|
+
maxDepth: 1 / 0,
|
|
4555
|
+
maxWidth: 1 / 0,
|
|
4561
4556
|
min: false,
|
|
4562
4557
|
plugins: [],
|
|
4563
4558
|
printBasicPrototype: true,
|
|
@@ -4906,8 +4901,8 @@ var __webpack_modules__ = {
|
|
|
4906
4901
|
else module.exports = __webpack_require__("../../node_modules/.pnpm/react-is@18.3.1/node_modules/react-is/cjs/react-is.development.js");
|
|
4907
4902
|
},
|
|
4908
4903
|
"../../node_modules/.pnpm/supports-color@7.2.0/node_modules/supports-color/index.js": function(module, __unused_webpack_exports, __webpack_require__) {
|
|
4909
|
-
const os = __webpack_require__("os");
|
|
4910
|
-
const tty = __webpack_require__("tty");
|
|
4904
|
+
const os = __webpack_require__("node:os");
|
|
4905
|
+
const tty = __webpack_require__("node:tty");
|
|
4911
4906
|
const hasFlag = __webpack_require__("../../node_modules/.pnpm/has-flag@4.0.0/node_modules/has-flag/index.js");
|
|
4912
4907
|
const { env } = process;
|
|
4913
4908
|
let forceColor;
|
|
@@ -4978,7 +4973,7 @@ var __webpack_modules__ = {
|
|
|
4978
4973
|
o: ()=>formatTestError
|
|
4979
4974
|
});
|
|
4980
4975
|
var external_node_util_ = __webpack_require__("node:util");
|
|
4981
|
-
var build = __webpack_require__("../../node_modules/.pnpm/jest-diff@30.0.
|
|
4976
|
+
var build = __webpack_require__("../../node_modules/.pnpm/jest-diff@30.0.4/node_modules/jest-diff/build/index.js");
|
|
4982
4977
|
build.DIFF_DELETE;
|
|
4983
4978
|
build.DIFF_EQUAL;
|
|
4984
4979
|
build.DIFF_INSERT;
|
|
@@ -5126,6 +5121,7 @@ var __webpack_modules__ = {
|
|
|
5126
5121
|
k: ()=>src_logger
|
|
5127
5122
|
});
|
|
5128
5123
|
var external_node_os_ = __webpack_require__("node:os");
|
|
5124
|
+
var external_node_tty_ = __webpack_require__("node:tty");
|
|
5129
5125
|
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : node_process.argv) {
|
|
5130
5126
|
const prefix = flag.startsWith('-') ? '' : 1 === flag.length ? '-' : '--';
|
|
5131
5127
|
const position = argv.indexOf(prefix + flag);
|
|
@@ -5218,10 +5214,10 @@ var __webpack_modules__ = {
|
|
|
5218
5214
|
}
|
|
5219
5215
|
const supportsColor = {
|
|
5220
5216
|
stdout: createSupportsColor({
|
|
5221
|
-
isTTY:
|
|
5217
|
+
isTTY: external_node_tty_["default"].isatty(1)
|
|
5222
5218
|
}),
|
|
5223
5219
|
stderr: createSupportsColor({
|
|
5224
|
-
isTTY:
|
|
5220
|
+
isTTY: external_node_tty_["default"].isatty(2)
|
|
5225
5221
|
})
|
|
5226
5222
|
};
|
|
5227
5223
|
const supports_color = supportsColor;
|
|
@@ -5412,44 +5408,38 @@ var __webpack_modules__ = {
|
|
|
5412
5408
|
chai: function(module) {
|
|
5413
5409
|
module.exports = __WEBPACK_EXTERNAL_MODULE_chai__;
|
|
5414
5410
|
},
|
|
5415
|
-
fs: function(module) {
|
|
5416
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE_fs__;
|
|
5417
|
-
},
|
|
5418
5411
|
"node:assert": function(module) {
|
|
5419
5412
|
module.exports = __WEBPACK_EXTERNAL_MODULE_node_assert_3e74d44e__;
|
|
5420
5413
|
},
|
|
5421
5414
|
"node:console": function(module) {
|
|
5422
5415
|
module.exports = __WEBPACK_EXTERNAL_MODULE_node_console_8631dfae__;
|
|
5423
5416
|
},
|
|
5424
|
-
|
|
5417
|
+
fs: function(module) {
|
|
5425
5418
|
module.exports = __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__;
|
|
5426
5419
|
},
|
|
5427
5420
|
"node:fs/promises": function(module) {
|
|
5428
5421
|
module.exports = __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__;
|
|
5429
5422
|
},
|
|
5423
|
+
"node:module": function(module) {
|
|
5424
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__;
|
|
5425
|
+
},
|
|
5430
5426
|
"node:os": function(module) {
|
|
5431
5427
|
module.exports = __WEBPACK_EXTERNAL_MODULE_node_os_74b4b876__;
|
|
5432
5428
|
},
|
|
5429
|
+
"node:path": function(module) {
|
|
5430
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__;
|
|
5431
|
+
},
|
|
5433
5432
|
"node:timers": function(module) {
|
|
5434
5433
|
module.exports = __WEBPACK_EXTERNAL_MODULE_node_timers_7045d530__;
|
|
5435
5434
|
},
|
|
5435
|
+
"node:tty": function(module) {
|
|
5436
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE_node_tty_c64aab7e__;
|
|
5437
|
+
},
|
|
5436
5438
|
"node:util": function(module) {
|
|
5437
5439
|
module.exports = __WEBPACK_EXTERNAL_MODULE_node_util_1b29d436__;
|
|
5438
5440
|
},
|
|
5439
|
-
os: function(module) {
|
|
5440
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE_os__;
|
|
5441
|
-
},
|
|
5442
|
-
path: function(module) {
|
|
5443
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE_path__;
|
|
5444
|
-
},
|
|
5445
5441
|
pathe: function(module) {
|
|
5446
5442
|
module.exports = __WEBPACK_EXTERNAL_MODULE_pathe__;
|
|
5447
|
-
},
|
|
5448
|
-
tty: function(module) {
|
|
5449
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE_tty__;
|
|
5450
|
-
},
|
|
5451
|
-
util: function(module) {
|
|
5452
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE_util__;
|
|
5453
5443
|
}
|
|
5454
5444
|
};
|
|
5455
5445
|
var __webpack_module_cache__ = {};
|
|
@@ -5581,6 +5571,8 @@ __webpack_require__("./src/runtime/worker/setup.ts");
|
|
|
5581
5571
|
var constants = __webpack_require__("./src/utils/constants.ts");
|
|
5582
5572
|
var helper = __webpack_require__("./src/utils/helper.ts");
|
|
5583
5573
|
var util = __webpack_require__("./src/runtime/util.ts");
|
|
5574
|
+
var external_node_module_ = __webpack_require__("node:module");
|
|
5575
|
+
var external_node_path_ = __webpack_require__("node:path");
|
|
5584
5576
|
var external_pathe_ = __webpack_require__("pathe");
|
|
5585
5577
|
var logger = __webpack_require__("./src/utils/logger.ts");
|
|
5586
5578
|
const shouldInterop = ({ interopDefault = true, modulePath, mod })=>{
|
|
@@ -5626,8 +5618,14 @@ const asModule = async (something, defaultExport, context, unlinked)=>{
|
|
|
5626
5618
|
return m;
|
|
5627
5619
|
};
|
|
5628
5620
|
const isRelativePath = (p)=>/^\.\.?\//.test(p);
|
|
5629
|
-
const
|
|
5630
|
-
const _require =
|
|
5621
|
+
const createRequire = (filename, distPath, rstestContext, assetFiles, interopDefault)=>{
|
|
5622
|
+
const _require = (()=>{
|
|
5623
|
+
try {
|
|
5624
|
+
return (0, external_node_module_.createRequire)(filename);
|
|
5625
|
+
} catch (_err) {
|
|
5626
|
+
return (0, external_node_module_.createRequire)(distPath);
|
|
5627
|
+
}
|
|
5628
|
+
})();
|
|
5631
5629
|
const require1 = (id)=>{
|
|
5632
5630
|
const currentDirectory = external_pathe_["default"].dirname(distPath);
|
|
5633
5631
|
const joinedPath = isRelativePath(id) ? external_pathe_["default"].join(currentDirectory, id) : id;
|
|
@@ -5652,7 +5650,7 @@ const loadModule_createRequire = (filename, distPath, rstestContext, assetFiles,
|
|
|
5652
5650
|
return require1;
|
|
5653
5651
|
};
|
|
5654
5652
|
const defineRstestDynamicImport = ({ testPath, interopDefault, returnModule = false })=>async (specifier, importAttributes)=>{
|
|
5655
|
-
const resolvedPath = isAbsolute(specifier) ? pathToFileURL(specifier) : await import.meta.resolve(specifier, pathToFileURL(testPath));
|
|
5653
|
+
const resolvedPath = (0, external_node_path_.isAbsolute)(specifier) ? pathToFileURL(specifier) : await import.meta.resolve(specifier, pathToFileURL(testPath));
|
|
5656
5654
|
const modulePath = 'string' == typeof resolvedPath ? resolvedPath : resolvedPath.pathname;
|
|
5657
5655
|
if (importAttributes?.with?.rstest) delete importAttributes.with.rstest;
|
|
5658
5656
|
const importedModule = await import(modulePath, importAttributes);
|
|
@@ -5699,7 +5697,7 @@ const loadModule = ({ codeContent, distPath, testPath, rstestContext, assetFiles
|
|
|
5699
5697
|
const context = {
|
|
5700
5698
|
module: localModule,
|
|
5701
5699
|
exports: localModule.exports,
|
|
5702
|
-
require:
|
|
5700
|
+
require: createRequire(testPath, distPath, rstestContext, assetFiles, interopDefault),
|
|
5703
5701
|
__rstest_dynamic_import__: defineRstestDynamicImport({
|
|
5704
5702
|
testPath,
|
|
5705
5703
|
interopDefault
|
|
@@ -5894,6 +5892,9 @@ const loadFiles = async ({ setupEntries, assetFiles, rstestContext, distPath, te
|
|
|
5894
5892
|
interopDefault
|
|
5895
5893
|
});
|
|
5896
5894
|
};
|
|
5895
|
+
const onExit = ()=>{
|
|
5896
|
+
process.exit();
|
|
5897
|
+
};
|
|
5897
5898
|
const runInPool = async (options)=>{
|
|
5898
5899
|
isTeardown = false;
|
|
5899
5900
|
const { entryInfo: { distPath, testPath }, setupEntries, assetFiles, type, context: { runtimeConfig: { isolate } } } = options;
|
|
@@ -5905,6 +5906,12 @@ const runInPool = async (options)=>{
|
|
|
5905
5906
|
cleanups.push(()=>{
|
|
5906
5907
|
process.exit = exit;
|
|
5907
5908
|
});
|
|
5909
|
+
process.off('SIGTERM', onExit);
|
|
5910
|
+
const teardown = async ()=>{
|
|
5911
|
+
await Promise.all(cleanups.map((fn)=>fn()));
|
|
5912
|
+
isTeardown = true;
|
|
5913
|
+
process.once('SIGTERM', onExit);
|
|
5914
|
+
};
|
|
5908
5915
|
if ('collect' === type) try {
|
|
5909
5916
|
const { rstestContext, runner, cleanup, unhandledErrors, interopDefault } = await preparePool(options);
|
|
5910
5917
|
cleanups.push(cleanup);
|
|
@@ -5930,8 +5937,7 @@ const runInPool = async (options)=>{
|
|
|
5930
5937
|
errors: (0, util.o)(err)
|
|
5931
5938
|
};
|
|
5932
5939
|
} finally{
|
|
5933
|
-
await
|
|
5934
|
-
isTeardown = true;
|
|
5940
|
+
await teardown();
|
|
5935
5941
|
}
|
|
5936
5942
|
try {
|
|
5937
5943
|
const { rstestContext, runner, rpc, api, cleanup, unhandledErrors, interopDefault } = await preparePool(options);
|
|
@@ -5970,8 +5976,7 @@ const runInPool = async (options)=>{
|
|
|
5970
5976
|
errors: (0, util.o)(err)
|
|
5971
5977
|
};
|
|
5972
5978
|
} finally{
|
|
5973
|
-
await
|
|
5974
|
-
isTeardown = true;
|
|
5979
|
+
await teardown();
|
|
5975
5980
|
}
|
|
5976
5981
|
};
|
|
5977
5982
|
const worker = runInPool;
|
package/dist-types/node.d.ts
CHANGED
package/dist-types/public.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type { Assertion as Assertion_2 } from '@vitest/expect';
|
|
|
4
4
|
import type { ExpectStatic as ExpectStatic_2 } from '@vitest/expect';
|
|
5
5
|
import type { MatcherState as MatcherState_2 } from '@vitest/expect';
|
|
6
6
|
import type { RsbuildConfig } from '@rsbuild/core';
|
|
7
|
+
import type { SnapshotManager } from '@vitest/snapshot/manager';
|
|
7
8
|
import type { SnapshotResult } from '@vitest/snapshot';
|
|
8
9
|
import type { SnapshotState } from '@vitest/snapshot';
|
|
9
10
|
import type { SnapshotSummary } from '@vitest/snapshot';
|
|
@@ -269,6 +270,7 @@ declare type Fixtures<T extends Record<string, any> = object, ExtraContext = obj
|
|
|
269
270
|
};
|
|
270
271
|
|
|
271
272
|
declare type FormattedError = {
|
|
273
|
+
fullStack?: boolean;
|
|
272
274
|
message: string;
|
|
273
275
|
name?: string;
|
|
274
276
|
stack?: string;
|
|
@@ -297,7 +299,7 @@ declare interface MatcherState extends MatcherState_2 {
|
|
|
297
299
|
|
|
298
300
|
declare type MaybePromise<T> = T | Promise<T>;
|
|
299
301
|
|
|
300
|
-
declare interface Mock<T extends FunctionLike = FunctionLike> extends MockInstance<T> {
|
|
302
|
+
export declare interface Mock<T extends FunctionLike = FunctionLike> extends MockInstance<T> {
|
|
301
303
|
new (...args: Parameters<T>): ReturnType<T>;
|
|
302
304
|
(...args: Parameters<T>): ReturnType<T>;
|
|
303
305
|
}
|
|
@@ -520,6 +522,8 @@ declare type Rstest = RunnerAPI & {
|
|
|
520
522
|
|
|
521
523
|
export declare const rstest: RstestUtilities;
|
|
522
524
|
|
|
525
|
+
declare type RstestCommand = 'watch' | 'run' | 'list';
|
|
526
|
+
|
|
523
527
|
export declare interface RstestConfig {
|
|
524
528
|
/**
|
|
525
529
|
* Project root
|
|
@@ -679,6 +683,26 @@ export declare type RstestConfigExport = RstestConfig | RstestConfigSyncFn | Rst
|
|
|
679
683
|
|
|
680
684
|
export declare type RstestConfigSyncFn = () => RstestConfig;
|
|
681
685
|
|
|
686
|
+
declare type RstestContext = {
|
|
687
|
+
/** The Rstest core version. */
|
|
688
|
+
version: string;
|
|
689
|
+
/** The root path of current project. */
|
|
690
|
+
rootPath: string;
|
|
691
|
+
/** The original Rstest config passed from the createRstest method. */
|
|
692
|
+
originalConfig: Readonly<RstestConfig>;
|
|
693
|
+
/** The normalized Rstest config. */
|
|
694
|
+
normalizedConfig: NormalizedConfig;
|
|
695
|
+
/**
|
|
696
|
+
* The command type.
|
|
697
|
+
*
|
|
698
|
+
* - dev: `rstest dev`
|
|
699
|
+
* - run: `rstest run`
|
|
700
|
+
*/
|
|
701
|
+
command: RstestCommand;
|
|
702
|
+
reporters: Reporter[];
|
|
703
|
+
snapshotManager: SnapshotManager;
|
|
704
|
+
};
|
|
705
|
+
|
|
682
706
|
declare type RstestExpect = ExpectStatic;
|
|
683
707
|
|
|
684
708
|
declare type RstestPoolOptions = {
|
|
@@ -779,6 +803,14 @@ declare type RstestUtilities = {
|
|
|
779
803
|
* Restores all global variables that were changed with `rstest.stubGlobal`.
|
|
780
804
|
*/
|
|
781
805
|
unstubAllGlobals: () => RstestUtilities;
|
|
806
|
+
/**
|
|
807
|
+
* Update runtime config for the current test.
|
|
808
|
+
*/
|
|
809
|
+
setConfig: (config: RuntimeOptions) => void;
|
|
810
|
+
/**
|
|
811
|
+
* Reset runtime config that were changed with `rstest.setConfig`.
|
|
812
|
+
*/
|
|
813
|
+
resetConfig: () => void;
|
|
782
814
|
/**
|
|
783
815
|
* Mocks timers using `@sinonjs/fake-timers`.
|
|
784
816
|
*/
|
|
@@ -820,6 +852,10 @@ declare type RunnerAPI = {
|
|
|
820
852
|
afterEach: (fn: AfterEachListener, timeout?: number) => MaybePromise<void>;
|
|
821
853
|
};
|
|
822
854
|
|
|
855
|
+
declare type RuntimeConfig = Pick<RstestContext['normalizedConfig'], 'testTimeout' | 'testNamePattern' | 'globals' | 'passWithNoTests' | 'retry' | 'clearMocks' | 'resetMocks' | 'restoreMocks' | 'unstubEnvs' | 'unstubGlobals' | 'maxConcurrency' | 'printConsoleTrace' | 'disableConsoleIntercept' | 'testEnvironment' | 'isolate' | 'hookTimeout'>;
|
|
856
|
+
|
|
857
|
+
declare type RuntimeOptions = Partial<Pick<RuntimeConfig, 'testTimeout' | 'hookTimeout' | 'clearMocks' | 'resetMocks' | 'restoreMocks' | 'maxConcurrency' | 'retry'>>;
|
|
858
|
+
|
|
823
859
|
declare interface SnapshotMatcher<T> {
|
|
824
860
|
<U extends {
|
|
825
861
|
[P in keyof T]: any;
|
package/dist-types/worker.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rstest/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"description": "The Rsbuild-based test tool.",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/web-infra-dev/rstest/issues"
|
|
@@ -48,12 +48,12 @@
|
|
|
48
48
|
"importMeta.d.ts"
|
|
49
49
|
],
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@rsbuild/core": "1.4.
|
|
51
|
+
"@rsbuild/core": "1.4.7",
|
|
52
52
|
"@types/chai": "^5.2.2",
|
|
53
53
|
"@vitest/expect": "^3.2.4",
|
|
54
54
|
"@vitest/snapshot": "^3.2.4",
|
|
55
55
|
"birpc": "2.4.0",
|
|
56
|
-
"chai": "^5.2.
|
|
56
|
+
"chai": "^5.2.1",
|
|
57
57
|
"pathe": "^2.0.3",
|
|
58
58
|
"std-env": "^3.9.0",
|
|
59
59
|
"tinypool": "^1.1.1"
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"@babel/code-frame": "^7.27.1",
|
|
63
63
|
"@jridgewell/trace-mapping": "0.3.29",
|
|
64
64
|
"@microsoft/api-extractor": "^7.52.8",
|
|
65
|
-
"@rslib/core": "0.10.
|
|
65
|
+
"@rslib/core": "0.10.5",
|
|
66
66
|
"@sinonjs/fake-timers": "^14.0.0",
|
|
67
67
|
"@types/babel__code-frame": "^7.0.6",
|
|
68
68
|
"@types/jsdom": "^21.1.7",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"@types/source-map-support": "^0.5.10",
|
|
71
71
|
"cac": "^6.7.14",
|
|
72
72
|
"happy-dom": "^18.0.1",
|
|
73
|
-
"jest-diff": "^30.0.
|
|
73
|
+
"jest-diff": "^30.0.4",
|
|
74
74
|
"jsdom": "^26.1.0",
|
|
75
75
|
"license-webpack-plugin": "^4.0.2",
|
|
76
76
|
"picocolors": "^1.1.1",
|