@rstest/core 0.5.4 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +1 -1
- package/dist/{0~816.js → 0~628.js} +34 -109
- package/dist/0~655.js +121 -121
- package/dist/0~85.js +1 -1
- package/dist/importActualLoader.mjs +1 -0
- package/dist/index.js +29 -21
- package/dist/mockRuntimeCode.js +118 -0
- package/dist/worker.js +28 -18
- package/dist-types/worker.d.ts +1 -0
- package/package.json +11 -11
package/LICENSE.md
CHANGED
|
@@ -682,7 +682,7 @@ Licensed under MIT license in the repository at chalk/ansi-styles.
|
|
|
682
682
|
|
|
683
683
|
### birpc
|
|
684
684
|
|
|
685
|
-
Licensed under MIT license in the repository at git+https://github.com/antfu/birpc.git.
|
|
685
|
+
Licensed under MIT license in the repository at git+https://github.com/antfu-collective/birpc.git.
|
|
686
686
|
|
|
687
687
|
> MIT License
|
|
688
688
|
>
|
|
@@ -5,9 +5,9 @@ import * as __WEBPACK_EXTERNAL_MODULE_node_v8_d0df5498__ from "node:v8";
|
|
|
5
5
|
import * as __WEBPACK_EXTERNAL_MODULE_node_events_0a6aefe7__ from "node:events";
|
|
6
6
|
import * as __WEBPACK_EXTERNAL_MODULE_tinypool__ from "tinypool";
|
|
7
7
|
import * as __WEBPACK_EXTERNAL_MODULE_node_inspector_dd9822d6__ from "node:inspector";
|
|
8
|
-
export const __webpack_id__ = "
|
|
8
|
+
export const __webpack_id__ = "628";
|
|
9
9
|
export const __webpack_ids__ = [
|
|
10
|
-
"
|
|
10
|
+
"628"
|
|
11
11
|
];
|
|
12
12
|
export const __webpack_modules__ = {
|
|
13
13
|
"./src/core/rsbuild.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
@@ -15,6 +15,7 @@ export const __webpack_modules__ = {
|
|
|
15
15
|
XD: ()=>createRsbuildServer,
|
|
16
16
|
zh: ()=>prepareRsbuild
|
|
17
17
|
});
|
|
18
|
+
var external_node_url_ = __webpack_require__("node:url");
|
|
18
19
|
var core_ = __webpack_require__("@rsbuild/core");
|
|
19
20
|
var dist = __webpack_require__("../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/index.mjs");
|
|
20
21
|
var utils = __webpack_require__("./src/utils/index.ts");
|
|
@@ -108,7 +109,6 @@ export const __webpack_modules__ = {
|
|
|
108
109
|
}
|
|
109
110
|
});
|
|
110
111
|
var external_node_path_ = __webpack_require__("node:path");
|
|
111
|
-
var external_node_url_ = __webpack_require__("node:url");
|
|
112
112
|
const PLUGIN_CSS_FILTER = 'rstest:css-filter';
|
|
113
113
|
const css_filter_dirname = external_node_path_["default"].dirname((0, external_node_url_.fileURLToPath)(import.meta.url));
|
|
114
114
|
const pluginCSSFilter = ()=>({
|
|
@@ -268,6 +268,8 @@ export const __webpack_modules__ = {
|
|
|
268
268
|
});
|
|
269
269
|
}
|
|
270
270
|
} : null;
|
|
271
|
+
var external_node_fs_ = __webpack_require__("node:fs");
|
|
272
|
+
const mockRuntime_dirname = external_node_path_["default"].dirname((0, external_node_url_.fileURLToPath)(import.meta.url));
|
|
271
273
|
class MockRuntimeRspackPlugin {
|
|
272
274
|
apply(compiler) {
|
|
273
275
|
const { RuntimeModule } = compiler.webpack;
|
|
@@ -276,109 +278,24 @@ export const __webpack_modules__ = {
|
|
|
276
278
|
super('rstest runtime');
|
|
277
279
|
}
|
|
278
280
|
generate() {
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
return;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
const originalRequire = __webpack_require__;
|
|
285
|
-
__webpack_require__ = function(...args) {
|
|
286
|
-
try {
|
|
287
|
-
return originalRequire(...args);
|
|
288
|
-
} catch (e) {
|
|
289
|
-
const errMsg = e.message ?? e.toString();
|
|
290
|
-
if (errMsg.includes('__webpack_modules__[moduleId] is not a function')) {
|
|
291
|
-
throw new Error(\`Cannot find module '\${args[0]}'\`)
|
|
292
|
-
}
|
|
293
|
-
throw e;
|
|
294
|
-
}
|
|
295
|
-
};
|
|
296
|
-
|
|
297
|
-
Object.keys(originalRequire).forEach(key => {
|
|
298
|
-
__webpack_require__[key] = originalRequire[key];
|
|
299
|
-
});
|
|
300
|
-
|
|
301
|
-
__webpack_require__.rstest_original_modules = {};
|
|
302
|
-
|
|
303
|
-
__webpack_require__.rstest_reset_modules = () => {
|
|
304
|
-
const mockedIds = Object.keys(__webpack_require__.rstest_original_modules)
|
|
305
|
-
Object.keys(__webpack_module_cache__).forEach(id => {
|
|
306
|
-
// Do not reset mocks registry.
|
|
307
|
-
if (!mockedIds.includes(id)) {
|
|
308
|
-
delete __webpack_module_cache__[id];
|
|
309
|
-
}
|
|
310
|
-
});
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
__webpack_require__.rstest_unmock = (id) => {
|
|
314
|
-
delete __webpack_module_cache__[id]
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
__webpack_require__.rstest_require_actual = __webpack_require__.rstest_import_actual = (id) => {
|
|
318
|
-
const originalModule = __webpack_require__.rstest_original_modules[id];
|
|
319
|
-
// Use fallback module if the module is not mocked.
|
|
320
|
-
const fallbackMod = __webpack_require__(id);
|
|
321
|
-
return originalModule ? originalModule : fallbackMod;
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
__webpack_require__.rstest_exec = async (id, modFactory) => {
|
|
325
|
-
if (__webpack_module_cache__) {
|
|
326
|
-
let asyncFactory = __webpack_module_cache__[id];
|
|
327
|
-
if (asyncFactory && asyncFactory.constructor.name === 'AsyncFunction') {
|
|
328
|
-
await asyncFactory();
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
};
|
|
332
|
-
|
|
333
|
-
__webpack_require__.rstest_mock = (id, modFactory) => {
|
|
334
|
-
let requiredModule = undefined
|
|
335
|
-
try {
|
|
336
|
-
requiredModule = __webpack_require__(id);
|
|
337
|
-
} catch {
|
|
338
|
-
// TODO: non-resolved module
|
|
339
|
-
} finally {
|
|
340
|
-
__webpack_require__.rstest_original_modules[id] = requiredModule;
|
|
341
|
-
}
|
|
342
|
-
if (typeof modFactory === 'string' || typeof modFactory === 'number') {
|
|
343
|
-
__webpack_module_cache__[id] = { exports: __webpack_require__(modFactory) };
|
|
344
|
-
} else if (typeof modFactory === 'function') {
|
|
345
|
-
if (modFactory.constructor.name === 'AsyncFunction') {
|
|
346
|
-
__webpack_module_cache__[id] = async () => {
|
|
347
|
-
const exports = await modFactory();
|
|
348
|
-
__webpack_require__.r(exports);
|
|
349
|
-
__webpack_module_cache__[id] = { exports, id, loaded: true };
|
|
350
|
-
}
|
|
351
|
-
} else {
|
|
352
|
-
const exports = modFactory();
|
|
353
|
-
__webpack_require__.r(exports);
|
|
354
|
-
__webpack_module_cache__[id] = { exports, id, loaded: true };
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
};
|
|
358
|
-
|
|
359
|
-
__webpack_require__.rstest_do_mock = (id, modFactory) => {
|
|
360
|
-
let requiredModule = undefined
|
|
361
|
-
try {
|
|
362
|
-
requiredModule = __webpack_require__(id);
|
|
363
|
-
} catch {
|
|
364
|
-
// TODO: non-resolved module
|
|
365
|
-
} finally {
|
|
366
|
-
__webpack_require__.rstest_original_modules[id] = requiredModule;
|
|
367
|
-
}
|
|
368
|
-
if (typeof modFactory === 'string' || typeof modFactory === 'number') {
|
|
369
|
-
__webpack_module_cache__[id] = { exports: __webpack_require__(modFactory) };
|
|
370
|
-
} else if (typeof modFactory === 'function') {
|
|
371
|
-
const exports = modFactory();
|
|
372
|
-
__webpack_require__.r(exports);
|
|
373
|
-
__webpack_module_cache__[id] = { exports, id, loaded: true };
|
|
374
|
-
}
|
|
375
|
-
};
|
|
376
|
-
|
|
377
|
-
`;
|
|
281
|
+
const code = external_node_fs_["default"].readFileSync(external_node_path_["default"].join(mockRuntime_dirname, './mockRuntimeCode.js'), 'utf8');
|
|
282
|
+
return code;
|
|
378
283
|
}
|
|
379
284
|
}
|
|
380
|
-
compiler.hooks.
|
|
381
|
-
compilation.hooks.
|
|
285
|
+
compiler.hooks.compilation.tap('RstestMockPlugin', (compilation)=>{
|
|
286
|
+
compilation.hooks.runtimeModule.tap('RstestMockChunkLoadingRuntimePlugin', (module)=>{
|
|
287
|
+
if ('require_chunk_loading' === module.name) {
|
|
288
|
+
const finalSource = module.source.source.toString('utf-8').replace('for (var moduleId in moreModules) {', "for (var moduleId in moreModules) {\n if (Object.keys(__webpack_require__.rstest_original_modules).includes(moduleId)) continue;");
|
|
289
|
+
module.source.source = Buffer.from(finalSource);
|
|
290
|
+
}
|
|
291
|
+
if ('define_property_getters' === module.name) {
|
|
292
|
+
const finalSource = module.source.source.toString('utf-8').replace('enumerable: true, get:', 'enumerable: true, configurable: true, get:');
|
|
293
|
+
module.source.source = Buffer.from(finalSource);
|
|
294
|
+
}
|
|
295
|
+
});
|
|
296
|
+
});
|
|
297
|
+
compiler.hooks.thisCompilation.tap('RstestMockPlugin', (compilation)=>{
|
|
298
|
+
compilation.hooks.additionalTreeRuntimeRequirements.tap('RstestAddMockRuntimePlugin', (chunk)=>{
|
|
382
299
|
compilation.addRuntimeModule(chunk, new RetestImportRuntimeModule());
|
|
383
300
|
});
|
|
384
301
|
});
|
|
@@ -418,8 +335,8 @@ global.__rstest_clean_core_cache__ = __rstest_clean_core_cache__;
|
|
|
418
335
|
`;
|
|
419
336
|
}
|
|
420
337
|
}
|
|
421
|
-
compiler.hooks.thisCompilation.tap('
|
|
422
|
-
compilation.hooks.additionalTreeRuntimeRequirements.tap('
|
|
338
|
+
compiler.hooks.thisCompilation.tap('RstestCacheControlPlugin', (compilation)=>{
|
|
339
|
+
compilation.hooks.additionalTreeRuntimeRequirements.tap('RstestAddCacheControlRuntimePlugin', (chunk)=>{
|
|
423
340
|
compilation.addRuntimeModule(chunk, new RetestCacheControlModule());
|
|
424
341
|
});
|
|
425
342
|
});
|
|
@@ -443,6 +360,7 @@ global.__rstest_clean_core_cache__ = __rstest_clean_core_cache__;
|
|
|
443
360
|
});
|
|
444
361
|
}
|
|
445
362
|
});
|
|
363
|
+
const rsbuild_dirname = dist.Ay.dirname((0, external_node_url_.fileURLToPath)(import.meta.url));
|
|
446
364
|
function parseInlineSourceMapStr(code) {
|
|
447
365
|
const inlineSourceMapRegex = /\/\/# sourceMappingURL=data:application\/json(?:;charset=utf-8)?;base64,(.+)\s*$/m;
|
|
448
366
|
const match = code.match(inlineSourceMapRegex);
|
|
@@ -574,6 +492,11 @@ global.__rstest_clean_core_cache__ = __rstest_clean_core_cache__;
|
|
|
574
492
|
const rstestCompilerPlugin = {
|
|
575
493
|
name: 'rstest:compiler',
|
|
576
494
|
setup: (api)=>{
|
|
495
|
+
api.modifyBundlerChain((chain)=>{
|
|
496
|
+
chain.module.rule('rstest-mock-module-doppelgangers').test(/\.(?:js|jsx|mjs|cjs|ts|tsx|mts|cts)$/).with({
|
|
497
|
+
rstest: 'importActual'
|
|
498
|
+
}).use('import-actual-loader').loader(dist.Ay.resolve(rsbuild_dirname, './importActualLoader.mjs')).end();
|
|
499
|
+
});
|
|
577
500
|
api.onAfterCreateCompiler(({ compiler })=>{
|
|
578
501
|
rspackCompiler = compiler;
|
|
579
502
|
});
|
|
@@ -840,7 +763,7 @@ global.__rstest_clean_core_cache__ = __rstest_clean_core_cache__;
|
|
|
840
763
|
if (msg.t === TYPE_REQUEST) {
|
|
841
764
|
const { m: method, a: args } = msg;
|
|
842
765
|
let result, error;
|
|
843
|
-
const fn = resolver ? resolver(method, functions[method]) : functions[method];
|
|
766
|
+
const fn = await (resolver ? resolver(method, functions[method]) : functions[method]);
|
|
844
767
|
if (fn) try {
|
|
845
768
|
result = await fn.apply("rpc" === bind ? rpc : functions, args);
|
|
846
769
|
} catch (e) {
|
|
@@ -1060,11 +983,12 @@ global.__rstest_clean_core_cache__ = __rstest_clean_core_cache__;
|
|
|
1060
983
|
const projectName = context.normalizedConfig.name;
|
|
1061
984
|
const runtimeConfig = getRuntimeConfig(project);
|
|
1062
985
|
const setupAssets = setupEntries.flatMap((entry)=>entry.files || []);
|
|
1063
|
-
const results = await Promise.all(entries.map(async (entryInfo)=>{
|
|
986
|
+
const results = await Promise.all(entries.map(async (entryInfo, index)=>{
|
|
1064
987
|
const result = await pool.runTest({
|
|
1065
988
|
options: {
|
|
1066
989
|
entryInfo,
|
|
1067
990
|
context: {
|
|
991
|
+
taskId: index + 1,
|
|
1068
992
|
project: projectName,
|
|
1069
993
|
rootPath: context.rootPath,
|
|
1070
994
|
projectRoot: project.rootPath,
|
|
@@ -1107,10 +1031,11 @@ global.__rstest_clean_core_cache__ = __rstest_clean_core_cache__;
|
|
|
1107
1031
|
const runtimeConfig = getRuntimeConfig(project);
|
|
1108
1032
|
const projectName = project.normalizedConfig.name;
|
|
1109
1033
|
const setupAssets = setupEntries.flatMap((entry)=>entry.files || []);
|
|
1110
|
-
return Promise.all(entries.map(async (entryInfo)=>pool.collectTests({
|
|
1034
|
+
return Promise.all(entries.map(async (entryInfo, index)=>pool.collectTests({
|
|
1111
1035
|
options: {
|
|
1112
1036
|
entryInfo,
|
|
1113
1037
|
context: {
|
|
1038
|
+
taskId: index + 1,
|
|
1114
1039
|
project: projectName,
|
|
1115
1040
|
rootPath: context.rootPath,
|
|
1116
1041
|
projectRoot: project.rootPath,
|
package/dist/0~655.js
CHANGED
|
@@ -1541,7 +1541,7 @@ export const __webpack_modules__ = {
|
|
|
1541
1541
|
const string = `${options.stylize(helpers_truncate(array[i], options.truncate), 'number')}${i === array.length - 1 ? '' : ', '}`;
|
|
1542
1542
|
options.truncate -= string.length;
|
|
1543
1543
|
if (array[i] !== array.length && options.truncate <= 3) {
|
|
1544
|
-
output +=
|
|
1544
|
+
output += `…(${array.length - array[i] + 1})`;
|
|
1545
1545
|
break;
|
|
1546
1546
|
}
|
|
1547
1547
|
output += string;
|
|
@@ -1598,7 +1598,7 @@ export const __webpack_modules__ = {
|
|
|
1598
1598
|
}
|
|
1599
1599
|
function inspectBigInt(number, options) {
|
|
1600
1600
|
let nums = helpers_truncate(number.toString(), options.truncate - 1);
|
|
1601
|
-
if (
|
|
1601
|
+
if ("…" !== nums) nums += 'n';
|
|
1602
1602
|
return options.stylize(nums, 'bigint');
|
|
1603
1603
|
}
|
|
1604
1604
|
function inspectRegExp(value, options) {
|
|
@@ -1754,7 +1754,7 @@ export const __webpack_modules__ = {
|
|
|
1754
1754
|
options.truncate -= propertyContents.length;
|
|
1755
1755
|
const truncate = options.truncate;
|
|
1756
1756
|
let children = inspectNodeCollection(element.children, options);
|
|
1757
|
-
if (children && children.length > truncate) children =
|
|
1757
|
+
if (children && children.length > truncate) children = `…(${element.children.length})`;
|
|
1758
1758
|
return `${head}${propertyContents}${headClose}${children}${tail}`;
|
|
1759
1759
|
}
|
|
1760
1760
|
const symbolsSupported = 'function' == typeof Symbol && 'function' == typeof Symbol.for;
|
|
@@ -3285,7 +3285,7 @@ export const __webpack_modules__ = {
|
|
|
3285
3285
|
function getCommonAndChangedSubstrings(diffs, op, hasCommonDiff) {
|
|
3286
3286
|
return diffs.reduce((reduced, diff)=>reduced + (diff[0] === DIFF_EQUAL ? diff[1] : diff[0] === op ? hasCommonDiff ? dist_node.Ay.inverse(diff[1]) : diff[1] : ""), "");
|
|
3287
3287
|
}
|
|
3288
|
-
__webpack_require__("../../node_modules/.pnpm/tinyspy@4.0.
|
|
3288
|
+
__webpack_require__("../../node_modules/.pnpm/tinyspy@4.0.4/node_modules/tinyspy/dist/index.js");
|
|
3289
3289
|
new Set();
|
|
3290
3290
|
function isMockFunction(fn) {
|
|
3291
3291
|
return "function" == typeof fn && "_isMockFunction" in fn && fn._isMockFunction;
|
|
@@ -11369,165 +11369,165 @@ deep-eql/index.js:
|
|
|
11369
11369
|
var node_r = void 0 !== process.env.FORCE_TTY || (0, external_node_tty_.isatty)(1);
|
|
11370
11370
|
var node_u = p(node_r);
|
|
11371
11371
|
},
|
|
11372
|
-
"../../node_modules/.pnpm/tinyspy@4.0.
|
|
11372
|
+
"../../node_modules/.pnpm/tinyspy@4.0.4/node_modules/tinyspy/dist/index.js": function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
11373
11373
|
__webpack_require__.d(__webpack_exports__, {
|
|
11374
|
-
jo: ()=>
|
|
11375
|
-
lf: ()=>
|
|
11374
|
+
jo: ()=>M,
|
|
11375
|
+
lf: ()=>T
|
|
11376
11376
|
});
|
|
11377
|
-
function
|
|
11378
|
-
if (!
|
|
11377
|
+
function S(e, t) {
|
|
11378
|
+
if (!e) throw new Error(t);
|
|
11379
11379
|
}
|
|
11380
|
-
function
|
|
11381
|
-
return typeof
|
|
11380
|
+
function f(e, t) {
|
|
11381
|
+
return typeof t === e;
|
|
11382
11382
|
}
|
|
11383
|
-
function
|
|
11384
|
-
return
|
|
11383
|
+
function w(e) {
|
|
11384
|
+
return e instanceof Promise;
|
|
11385
11385
|
}
|
|
11386
|
-
function
|
|
11387
|
-
Object.defineProperty(
|
|
11386
|
+
function u(e, t, r) {
|
|
11387
|
+
Object.defineProperty(e, t, r);
|
|
11388
11388
|
}
|
|
11389
|
-
function
|
|
11390
|
-
|
|
11391
|
-
value,
|
|
11389
|
+
function l(e, t, r) {
|
|
11390
|
+
u(e, t, {
|
|
11391
|
+
value: r,
|
|
11392
11392
|
configurable: !0,
|
|
11393
11393
|
writable: !0
|
|
11394
11394
|
});
|
|
11395
11395
|
}
|
|
11396
|
-
var
|
|
11397
|
-
var
|
|
11398
|
-
|
|
11399
|
-
},
|
|
11396
|
+
var y = Symbol.for("tinyspy:spy");
|
|
11397
|
+
var x = /* @__PURE__ */ new Set(), h = (e)=>{
|
|
11398
|
+
e.called = !1, e.callCount = 0, e.calls = [], e.results = [], e.resolves = [], e.next = [];
|
|
11399
|
+
}, k = (e)=>(u(e, y, {
|
|
11400
11400
|
value: {
|
|
11401
|
-
reset: ()=>
|
|
11402
|
-
}
|
|
11403
|
-
}),
|
|
11404
|
-
function
|
|
11405
|
-
|
|
11406
|
-
let
|
|
11407
|
-
let
|
|
11408
|
-
|
|
11409
|
-
let
|
|
11410
|
-
if (
|
|
11411
|
-
|
|
11412
|
-
let [
|
|
11413
|
-
if ("ok" ===
|
|
11414
|
-
throw
|
|
11415
|
-
}
|
|
11416
|
-
let
|
|
11417
|
-
if (
|
|
11418
|
-
new.target ?
|
|
11419
|
-
} catch (
|
|
11420
|
-
throw
|
|
11421
|
-
|
|
11422
|
-
|
|
11423
|
-
]),
|
|
11424
|
-
}
|
|
11425
|
-
let
|
|
11426
|
-
|
|
11427
|
-
|
|
11401
|
+
reset: ()=>h(e[y])
|
|
11402
|
+
}
|
|
11403
|
+
}), e[y]), T = (e)=>e[y] || k(e);
|
|
11404
|
+
function R(e) {
|
|
11405
|
+
S(f("function", e) || f("undefined", e), "cannot spy on a non-function value");
|
|
11406
|
+
let t = function(...s) {
|
|
11407
|
+
let n = T(t);
|
|
11408
|
+
n.called = !0, n.callCount++, n.calls.push(s);
|
|
11409
|
+
let d = n.next.shift();
|
|
11410
|
+
if (d) {
|
|
11411
|
+
n.results.push(d);
|
|
11412
|
+
let [a, i] = d;
|
|
11413
|
+
if ("ok" === a) return i;
|
|
11414
|
+
throw i;
|
|
11415
|
+
}
|
|
11416
|
+
let o, c = "ok", p = n.results.length;
|
|
11417
|
+
if (n.impl) try {
|
|
11418
|
+
new.target ? o = Reflect.construct(n.impl, s, new.target) : o = n.impl.apply(this, s), c = "ok";
|
|
11419
|
+
} catch (a) {
|
|
11420
|
+
throw o = a, c = "error", n.results.push([
|
|
11421
|
+
c,
|
|
11422
|
+
a
|
|
11423
|
+
]), a;
|
|
11424
|
+
}
|
|
11425
|
+
let g = [
|
|
11426
|
+
c,
|
|
11427
|
+
o
|
|
11428
11428
|
];
|
|
11429
|
-
return
|
|
11429
|
+
return w(o) && o.then((a)=>n.resolves[p] = [
|
|
11430
11430
|
"ok",
|
|
11431
|
-
|
|
11432
|
-
], (
|
|
11431
|
+
a
|
|
11432
|
+
], (a)=>n.resolves[p] = [
|
|
11433
11433
|
"error",
|
|
11434
|
-
|
|
11435
|
-
]),
|
|
11434
|
+
a
|
|
11435
|
+
]), n.results.push(g), o;
|
|
11436
11436
|
};
|
|
11437
|
-
|
|
11438
|
-
let
|
|
11439
|
-
return
|
|
11440
|
-
}
|
|
11441
|
-
function
|
|
11442
|
-
return !!
|
|
11443
|
-
}
|
|
11444
|
-
var
|
|
11445
|
-
let
|
|
11446
|
-
if (
|
|
11447
|
-
|
|
11448
|
-
|
|
11437
|
+
l(t, "_isMockFunction", !0), l(t, "length", e ? e.length : 0), l(t, "name", e && e.name || "spy");
|
|
11438
|
+
let r = T(t);
|
|
11439
|
+
return r.reset(), r.impl = e, t;
|
|
11440
|
+
}
|
|
11441
|
+
function v(e) {
|
|
11442
|
+
return !!e && !0 === e._isMockFunction;
|
|
11443
|
+
}
|
|
11444
|
+
var b = (e, t)=>{
|
|
11445
|
+
let r = Object.getOwnPropertyDescriptor(e, t);
|
|
11446
|
+
if (r) return [
|
|
11447
|
+
e,
|
|
11448
|
+
r
|
|
11449
11449
|
];
|
|
11450
|
-
let
|
|
11451
|
-
for(; null !==
|
|
11452
|
-
let
|
|
11453
|
-
if (
|
|
11454
|
-
|
|
11455
|
-
|
|
11450
|
+
let s = Object.getPrototypeOf(e);
|
|
11451
|
+
for(; null !== s;){
|
|
11452
|
+
let n = Object.getOwnPropertyDescriptor(s, t);
|
|
11453
|
+
if (n) return [
|
|
11454
|
+
s,
|
|
11455
|
+
n
|
|
11456
11456
|
];
|
|
11457
|
-
|
|
11457
|
+
s = Object.getPrototypeOf(s);
|
|
11458
11458
|
}
|
|
11459
|
-
},
|
|
11460
|
-
null !=
|
|
11459
|
+
}, P = (e, t)=>{
|
|
11460
|
+
null != t && "function" == typeof t && null != t.prototype && Object.setPrototypeOf(e.prototype, t.prototype);
|
|
11461
11461
|
};
|
|
11462
|
-
function
|
|
11463
|
-
|
|
11464
|
-
let [
|
|
11465
|
-
if (!
|
|
11466
|
-
|
|
11462
|
+
function M(e, t, r) {
|
|
11463
|
+
S(!f("undefined", e), "spyOn could not find an object to spy upon"), S(f("object", e) || f("function", e), "cannot spyOn on a primitive value");
|
|
11464
|
+
let [s, n] = (()=>{
|
|
11465
|
+
if (!f("object", t)) return [
|
|
11466
|
+
t,
|
|
11467
11467
|
"value"
|
|
11468
11468
|
];
|
|
11469
|
-
if ("getter" in
|
|
11470
|
-
if ("getter" in
|
|
11471
|
-
|
|
11469
|
+
if ("getter" in t && "setter" in t) throw new Error("cannot spy on both getter and setter");
|
|
11470
|
+
if ("getter" in t) return [
|
|
11471
|
+
t.getter,
|
|
11472
11472
|
"get"
|
|
11473
11473
|
];
|
|
11474
|
-
if ("setter" in
|
|
11475
|
-
|
|
11474
|
+
if ("setter" in t) return [
|
|
11475
|
+
t.setter,
|
|
11476
11476
|
"set"
|
|
11477
11477
|
];
|
|
11478
11478
|
throw new Error("specify getter or setter to spy on");
|
|
11479
|
-
})(), [
|
|
11480
|
-
|
|
11481
|
-
let
|
|
11482
|
-
"value" ===
|
|
11483
|
-
let
|
|
11484
|
-
|
|
11485
|
-
let
|
|
11486
|
-
let { value, ...
|
|
11479
|
+
})(), [d, o] = b(e, s) || [];
|
|
11480
|
+
S(o || s in e, `${String(s)} does not exist`);
|
|
11481
|
+
let c = !1;
|
|
11482
|
+
"value" === n && o && !o.value && o.get && (n = "get", c = !0, r = o.get());
|
|
11483
|
+
let p;
|
|
11484
|
+
o ? p = o[n] : "value" !== n ? p = ()=>e[s] : p = e[s], p && j(p) && (p = p[y].getOriginal());
|
|
11485
|
+
let g = (I)=>{
|
|
11486
|
+
let { value: F, ...O } = o || {
|
|
11487
11487
|
configurable: !0,
|
|
11488
11488
|
writable: !0
|
|
11489
11489
|
};
|
|
11490
|
-
"value" !==
|
|
11491
|
-
},
|
|
11492
|
-
|
|
11490
|
+
"value" !== n && delete O.writable, O[n] = I, u(e, s, O);
|
|
11491
|
+
}, a = ()=>{
|
|
11492
|
+
d !== e ? Reflect.deleteProperty(e, s) : o && !p ? u(e, s, o) : g(p);
|
|
11493
11493
|
};
|
|
11494
|
-
|
|
11495
|
-
let
|
|
11496
|
-
"value" ===
|
|
11497
|
-
let
|
|
11498
|
-
return
|
|
11494
|
+
r || (r = p);
|
|
11495
|
+
let i = E(R(r), r);
|
|
11496
|
+
"value" === n && P(i, p);
|
|
11497
|
+
let m = i[y];
|
|
11498
|
+
return l(m, "restore", a), l(m, "getOriginal", ()=>c ? p() : p), l(m, "willCall", (I)=>(m.impl = I, i)), g(c ? ()=>(P(i, r), i) : i), x.add(i), i;
|
|
11499
11499
|
}
|
|
11500
|
-
var
|
|
11500
|
+
var K = /* @__PURE__ */ new Set([
|
|
11501
11501
|
"length",
|
|
11502
11502
|
"name",
|
|
11503
11503
|
"prototype"
|
|
11504
11504
|
]);
|
|
11505
|
-
function
|
|
11506
|
-
let
|
|
11507
|
-
for(;
|
|
11508
|
-
let
|
|
11509
|
-
...Object.getOwnPropertyNames(
|
|
11510
|
-
...Object.getOwnPropertySymbols(
|
|
11505
|
+
function D(e) {
|
|
11506
|
+
let t = /* @__PURE__ */ new Set(), r = {};
|
|
11507
|
+
for(; e && e !== Object.prototype && e !== Function.prototype;){
|
|
11508
|
+
let s = [
|
|
11509
|
+
...Object.getOwnPropertyNames(e),
|
|
11510
|
+
...Object.getOwnPropertySymbols(e)
|
|
11511
11511
|
];
|
|
11512
|
-
for (let
|
|
11513
|
-
|
|
11512
|
+
for (let n of s)r[n] || K.has(n) || (t.add(n), r[n] = Object.getOwnPropertyDescriptor(e, n));
|
|
11513
|
+
e = Object.getPrototypeOf(e);
|
|
11514
11514
|
}
|
|
11515
11515
|
return {
|
|
11516
|
-
properties,
|
|
11517
|
-
descriptors:
|
|
11516
|
+
properties: t,
|
|
11517
|
+
descriptors: r
|
|
11518
11518
|
};
|
|
11519
11519
|
}
|
|
11520
|
-
function
|
|
11521
|
-
if (!
|
|
11522
|
-
let { properties, descriptors:
|
|
11523
|
-
for (let
|
|
11524
|
-
let
|
|
11525
|
-
|
|
11520
|
+
function E(e, t) {
|
|
11521
|
+
if (!t || y in t) return e;
|
|
11522
|
+
let { properties: r, descriptors: s } = D(t);
|
|
11523
|
+
for (let n of r){
|
|
11524
|
+
let d = s[n];
|
|
11525
|
+
b(e, n) || u(e, n, d);
|
|
11526
11526
|
}
|
|
11527
|
-
return
|
|
11527
|
+
return e;
|
|
11528
11528
|
}
|
|
11529
|
-
function
|
|
11530
|
-
return
|
|
11529
|
+
function j(e) {
|
|
11530
|
+
return v(e) && "getOriginal" in e[y];
|
|
11531
11531
|
}
|
|
11532
11532
|
}
|
|
11533
11533
|
};
|
package/dist/0~85.js
CHANGED
|
@@ -1511,7 +1511,7 @@ export const __webpack_modules__ = {
|
|
|
1511
1511
|
return this._fakingTime;
|
|
1512
1512
|
}
|
|
1513
1513
|
}
|
|
1514
|
-
var tinyspy_dist = __webpack_require__("../../node_modules/.pnpm/tinyspy@4.0.
|
|
1514
|
+
var tinyspy_dist = __webpack_require__("../../node_modules/.pnpm/tinyspy@4.0.4/node_modules/tinyspy/dist/index.js");
|
|
1515
1515
|
let callOrder = 0;
|
|
1516
1516
|
const mocks = new Set();
|
|
1517
1517
|
const wrapSpy = (obj, methodName, mockFn)=>{
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default ((source)=>source);
|
package/dist/index.js
CHANGED
|
@@ -2108,7 +2108,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
2108
2108
|
function setupCommands() {
|
|
2109
2109
|
const cli = dist('rstest');
|
|
2110
2110
|
cli.help();
|
|
2111
|
-
cli.version("0.
|
|
2111
|
+
cli.version("0.6.0");
|
|
2112
2112
|
applyCommonOptions(cli);
|
|
2113
2113
|
cli.command('[...filters]', 'run tests').option('-w, --watch', 'Run tests in watch mode').action(async (filters, options)=>{
|
|
2114
2114
|
(0, prepare.N)();
|
|
@@ -2348,7 +2348,7 @@ ${conflictProjects.map((p)=>`- ${p.configFilePath || p.config.root}`).join('\n')
|
|
|
2348
2348
|
if (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) console.log();
|
|
2349
2349
|
}
|
|
2350
2350
|
function showRstest() {
|
|
2351
|
-
_utils_logger__WEBPACK_IMPORTED_MODULE_0__.vF.greet(" Rstest v0.
|
|
2351
|
+
_utils_logger__WEBPACK_IMPORTED_MODULE_0__.vF.greet(" Rstest v0.6.0");
|
|
2352
2352
|
_utils_logger__WEBPACK_IMPORTED_MODULE_0__.vF.log('');
|
|
2353
2353
|
}
|
|
2354
2354
|
},
|
|
@@ -3275,7 +3275,7 @@ ${conflictProjects.map((p)=>`- ${p.configFilePath || p.config.root}`).join('\n')
|
|
|
3275
3275
|
logs.push(`::${type} file=${this.onWritePath?.(file) || file},line=${line},col=${column},title=${escapeData(title)}::${escapeData(message)}`);
|
|
3276
3276
|
}
|
|
3277
3277
|
}
|
|
3278
|
-
this.log('::group::
|
|
3278
|
+
this.log('::group::Error for GitHub Actions');
|
|
3279
3279
|
for (const log of logs)this.log(log);
|
|
3280
3280
|
this.log('::endgroup::');
|
|
3281
3281
|
}
|
|
@@ -3468,7 +3468,7 @@ ${conflictProjects.map((p)=>`- ${p.configFilePath || p.config.root}`).join('\n')
|
|
|
3468
3468
|
});
|
|
3469
3469
|
this.reporters = reporters;
|
|
3470
3470
|
this.snapshotManager = snapshotManager;
|
|
3471
|
-
this.version = "0.
|
|
3471
|
+
this.version = "0.6.0";
|
|
3472
3472
|
this.rootPath = rootPath;
|
|
3473
3473
|
this.originalConfig = userConfig;
|
|
3474
3474
|
this.normalizedConfig = rstestConfig;
|
|
@@ -3552,14 +3552,14 @@ ${conflictProjects.map((p)=>`- ${p.configFilePath || p.config.root}`).join('\n')
|
|
|
3552
3552
|
}, config);
|
|
3553
3553
|
const runTests = async ()=>{
|
|
3554
3554
|
const { runTests } = await Promise.all([
|
|
3555
|
-
__webpack_require__.e("
|
|
3555
|
+
__webpack_require__.e("628"),
|
|
3556
3556
|
__webpack_require__.e("33")
|
|
3557
3557
|
]).then(__webpack_require__.bind(__webpack_require__, "./src/core/runTests.ts"));
|
|
3558
3558
|
await runTests(context);
|
|
3559
3559
|
};
|
|
3560
3560
|
const listTests = async (options)=>{
|
|
3561
3561
|
const { listTests } = await Promise.all([
|
|
3562
|
-
__webpack_require__.e("
|
|
3562
|
+
__webpack_require__.e("628"),
|
|
3563
3563
|
__webpack_require__.e("971")
|
|
3564
3564
|
]).then(__webpack_require__.bind(__webpack_require__, "./src/core/listTests.ts"));
|
|
3565
3565
|
await listTests(context, options);
|
|
@@ -3578,11 +3578,9 @@ ${conflictProjects.map((p)=>`- ${p.configFilePath || p.config.root}`).join('\n')
|
|
|
3578
3578
|
WB: ()=>TS_CONFIG_FILE,
|
|
3579
3579
|
kv: ()=>DEFAULT_CONFIG_EXTENSIONS,
|
|
3580
3580
|
t: ()=>DEFAULT_CONFIG_NAME,
|
|
3581
|
-
vO: ()=>TEST_DELIMITER,
|
|
3582
3581
|
zZ: ()=>TEMP_RSTEST_OUTPUT_DIR
|
|
3583
3582
|
});
|
|
3584
3583
|
const DEFAULT_CONFIG_NAME = 'rstest.config';
|
|
3585
|
-
const TEST_DELIMITER = '>';
|
|
3586
3584
|
const TEMP_RSTEST_OUTPUT_DIR = 'dist/.rstest-temp';
|
|
3587
3585
|
const TEMP_RSTEST_OUTPUT_DIR_GLOB = '**/dist/.rstest-temp';
|
|
3588
3586
|
const DEFAULT_CONFIG_EXTENSIONS = [
|
|
@@ -4142,15 +4140,15 @@ ${conflictProjects.map((p)=>`- ${p.configFilePath || p.config.root}`).join('\n')
|
|
|
4142
4140
|
var pathe__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs");
|
|
4143
4141
|
var picocolors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
4144
4142
|
var picocolors__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/ __webpack_require__.n(picocolors__WEBPACK_IMPORTED_MODULE_1__);
|
|
4145
|
-
|
|
4146
|
-
const formatRootStr = (rootStr, root)=>rootStr.replace('<rootDir>', root);
|
|
4143
|
+
__webpack_require__("./src/utils/constants.ts");
|
|
4144
|
+
const formatRootStr = (rootStr, root)=>rootStr.replace('<rootDir>', (0, pathe__WEBPACK_IMPORTED_MODULE_2__.n)(root));
|
|
4147
4145
|
function getAbsolutePath(base, filepath) {
|
|
4148
4146
|
return (0, pathe__WEBPACK_IMPORTED_MODULE_2__.i)(filepath) ? filepath : (0, pathe__WEBPACK_IMPORTED_MODULE_2__.j)(base, filepath);
|
|
4149
4147
|
}
|
|
4150
4148
|
const parsePosix = (filePath)=>{
|
|
4151
4149
|
const { dir, base } = (0, pathe__WEBPACK_IMPORTED_MODULE_2__.p)(filePath);
|
|
4152
4150
|
return {
|
|
4153
|
-
dir: dir.split(
|
|
4151
|
+
dir: dir.split("/").join('/'),
|
|
4154
4152
|
base
|
|
4155
4153
|
};
|
|
4156
4154
|
};
|
|
@@ -4190,7 +4188,7 @@ ${conflictProjects.map((p)=>`- ${p.configFilePath || p.config.root}`).join('\n')
|
|
|
4190
4188
|
return time;
|
|
4191
4189
|
};
|
|
4192
4190
|
const getTaskNames = (test)=>(test.parentNames || []).concat(test.name).filter(Boolean);
|
|
4193
|
-
const getTaskNameWithPrefix = (test, delimiter =
|
|
4191
|
+
const getTaskNameWithPrefix = (test, delimiter = ">")=>getTaskNames(test).join(` ${delimiter} `);
|
|
4194
4192
|
const REGEXP_FLAG_PREFIX = 'RSTEST_REGEXP:';
|
|
4195
4193
|
const wrapRegex = (value)=>`${REGEXP_FLAG_PREFIX}${value.toString()}`;
|
|
4196
4194
|
const serializableConfig = (normalizedConfig)=>{
|
|
@@ -4236,7 +4234,7 @@ ${conflictProjects.map((p)=>`- ${p.configFilePath || p.config.root}`).join('\n')
|
|
|
4236
4234
|
fN: ()=>helper.fN,
|
|
4237
4235
|
vF: ()=>logger.vF,
|
|
4238
4236
|
Ok: ()=>helper.Ok,
|
|
4239
|
-
vO: ()=>
|
|
4237
|
+
vO: ()=>">",
|
|
4240
4238
|
tG: ()=>getTestEntries,
|
|
4241
4239
|
FI: ()=>helper.FI,
|
|
4242
4240
|
Uq: ()=>helper.Uq,
|
|
@@ -4446,6 +4444,7 @@ ${conflictProjects.map((p)=>`- ${p.configFilePath || p.config.root}`).join('\n')
|
|
|
4446
4444
|
if ('truecolor' === env.COLORTERM) return 3;
|
|
4447
4445
|
if ('xterm-kitty' === env.TERM) return 3;
|
|
4448
4446
|
if ('xterm-ghostty' === env.TERM) return 3;
|
|
4447
|
+
if ('wezterm' === env.TERM) return 3;
|
|
4449
4448
|
if ('TERM_PROGRAM' in env) {
|
|
4450
4449
|
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
|
|
4451
4450
|
switch(env.TERM_PROGRAM){
|
|
@@ -4580,6 +4579,14 @@ ${conflictProjects.map((p)=>`- ${p.configFilePath || p.config.root}`).join('\n')
|
|
|
4580
4579
|
color: magenta
|
|
4581
4580
|
}
|
|
4582
4581
|
};
|
|
4582
|
+
const normalizeErrorMessage = (err)=>{
|
|
4583
|
+
if (err.stack) {
|
|
4584
|
+
let [name, ...rest] = err.stack.split('\n');
|
|
4585
|
+
if (name.startsWith('Error: ')) name = name.slice(7);
|
|
4586
|
+
return `${name}\n${gray(rest.join('\n'))}`;
|
|
4587
|
+
}
|
|
4588
|
+
return err.message;
|
|
4589
|
+
};
|
|
4583
4590
|
let createLogger = (options = {})=>{
|
|
4584
4591
|
let maxLevel = options.level || 'info';
|
|
4585
4592
|
let log = (type, message, ...args)=>{
|
|
@@ -4592,12 +4599,14 @@ ${conflictProjects.map((p)=>`- ${p.configFilePath || p.config.root}`).join('\n')
|
|
|
4592
4599
|
label = (logType.label || '').padEnd(7);
|
|
4593
4600
|
label = bold(logType.color ? logType.color(label) : label);
|
|
4594
4601
|
}
|
|
4595
|
-
if (message instanceof Error)
|
|
4596
|
-
|
|
4597
|
-
|
|
4598
|
-
|
|
4599
|
-
|
|
4600
|
-
|
|
4602
|
+
if (message instanceof Error) {
|
|
4603
|
+
text += normalizeErrorMessage(message);
|
|
4604
|
+
const { cause } = message;
|
|
4605
|
+
if (cause) {
|
|
4606
|
+
text += yellow('\n [cause]: ');
|
|
4607
|
+
text += cause instanceof Error ? normalizeErrorMessage(cause) : String(cause);
|
|
4608
|
+
}
|
|
4609
|
+
} else if ('error' === logType.level && 'string' == typeof message) {
|
|
4601
4610
|
let lines = message.split('\n');
|
|
4602
4611
|
text = lines.map((line)=>isErrorStackMessage(line) ? gray(line) : line).join('\n');
|
|
4603
4612
|
} else text = `${message}`;
|
|
@@ -4709,8 +4718,7 @@ ${conflictProjects.map((p)=>`- ${p.configFilePath || p.config.root}`).join('\n')
|
|
|
4709
4718
|
j: ()=>join,
|
|
4710
4719
|
n: ()=>normalize,
|
|
4711
4720
|
p: ()=>parse,
|
|
4712
|
-
r: ()=>resolve
|
|
4713
|
-
s: ()=>sep
|
|
4721
|
+
r: ()=>resolve
|
|
4714
4722
|
});
|
|
4715
4723
|
let _lazyMatch = ()=>{
|
|
4716
4724
|
var __lib__ = (()=>{
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
const originalWebpackRequire = __webpack_require__;
|
|
2
|
+
__webpack_require__ = function(...args) {
|
|
3
|
+
try {
|
|
4
|
+
return originalWebpackRequire(...args);
|
|
5
|
+
} catch (e) {
|
|
6
|
+
const errMsg = e.message ?? e.toString();
|
|
7
|
+
if (errMsg.includes('__webpack_modules__[moduleId] is not a function')) throw new Error(`[Rstest] Cannot find module "${args[0]}"`);
|
|
8
|
+
throw e;
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
Object.keys(originalWebpackRequire).forEach((key)=>{
|
|
12
|
+
__webpack_require__[key] = originalWebpackRequire[key];
|
|
13
|
+
});
|
|
14
|
+
__webpack_require__.rstest_original_modules = {};
|
|
15
|
+
__webpack_require__.rstest_original_module_factories = {};
|
|
16
|
+
__webpack_require__.rstest_unmock = (id)=>{
|
|
17
|
+
const originalModuleFactory = __webpack_require__.rstest_original_module_factories[id];
|
|
18
|
+
if (originalModuleFactory) __webpack_modules__[id] = originalModuleFactory;
|
|
19
|
+
delete __webpack_module_cache__[id];
|
|
20
|
+
};
|
|
21
|
+
__webpack_require__.rstest_do_unmock = __webpack_require__.rstest_unmock;
|
|
22
|
+
__webpack_require__.rstest_require_actual = __webpack_require__.rstest_import_actual = (id)=>{
|
|
23
|
+
const originalModule = __webpack_require__.rstest_original_modules[id];
|
|
24
|
+
const fallbackMod = __webpack_require__(id);
|
|
25
|
+
return originalModule ? originalModule : fallbackMod;
|
|
26
|
+
};
|
|
27
|
+
__webpack_require__.rstest_mock = (id, modFactory)=>{
|
|
28
|
+
let requiredModule;
|
|
29
|
+
try {
|
|
30
|
+
requiredModule = __webpack_require__(id);
|
|
31
|
+
} catch {} finally{
|
|
32
|
+
__webpack_require__.rstest_original_modules[id] = requiredModule;
|
|
33
|
+
__webpack_require__.rstest_original_module_factories[id] = __webpack_modules__[id];
|
|
34
|
+
}
|
|
35
|
+
if ('string' == typeof modFactory || 'number' == typeof modFactory) __webpack_module_cache__[id] = {
|
|
36
|
+
exports: __webpack_require__(modFactory)
|
|
37
|
+
};
|
|
38
|
+
else if ('function' == typeof modFactory) {
|
|
39
|
+
const finalModFactory = function(__unused_webpack_module, __webpack_exports__, __webpack_require__1) {
|
|
40
|
+
__webpack_require__1.r(__webpack_exports__);
|
|
41
|
+
const res = modFactory();
|
|
42
|
+
for(const key in res)__webpack_require__1.d(__webpack_exports__, {
|
|
43
|
+
[key]: ()=>res[key]
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
__webpack_modules__[id] = finalModFactory;
|
|
47
|
+
delete __webpack_module_cache__[id];
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
__webpack_require__.rstest_mock_require = (id, modFactory)=>{
|
|
51
|
+
let requiredModule;
|
|
52
|
+
try {
|
|
53
|
+
requiredModule = __webpack_require__(id);
|
|
54
|
+
} catch {} finally{
|
|
55
|
+
__webpack_require__.rstest_original_modules[id] = requiredModule;
|
|
56
|
+
__webpack_require__.rstest_original_module_factories[id] = __webpack_modules__[id];
|
|
57
|
+
}
|
|
58
|
+
if ('string' == typeof modFactory || 'number' == typeof modFactory) __webpack_module_cache__[id] = {
|
|
59
|
+
exports: __webpack_require__(modFactory)
|
|
60
|
+
};
|
|
61
|
+
else if ('function' == typeof modFactory) {
|
|
62
|
+
const exports = modFactory();
|
|
63
|
+
__webpack_require__.r(exports);
|
|
64
|
+
__webpack_module_cache__[id] = {
|
|
65
|
+
exports,
|
|
66
|
+
id,
|
|
67
|
+
loaded: true
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
__webpack_require__.rstest_do_mock = (id, modFactory)=>{
|
|
72
|
+
let requiredModule;
|
|
73
|
+
try {
|
|
74
|
+
requiredModule = __webpack_require__(id);
|
|
75
|
+
} catch {} finally{
|
|
76
|
+
__webpack_require__.rstest_original_modules[id] = requiredModule;
|
|
77
|
+
__webpack_require__.rstest_original_module_factories[id] = __webpack_modules__[id];
|
|
78
|
+
}
|
|
79
|
+
if ('string' == typeof modFactory || 'number' == typeof modFactory) __webpack_module_cache__[id] = {
|
|
80
|
+
exports: __webpack_require__(modFactory)
|
|
81
|
+
};
|
|
82
|
+
else if ('function' == typeof modFactory) {
|
|
83
|
+
const exports = modFactory();
|
|
84
|
+
__webpack_require__.r(exports);
|
|
85
|
+
__webpack_module_cache__[id] = {
|
|
86
|
+
exports,
|
|
87
|
+
id,
|
|
88
|
+
loaded: true
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
__webpack_require__.rstest_do_mock_require = (id, modFactory)=>{
|
|
93
|
+
let requiredModule;
|
|
94
|
+
try {
|
|
95
|
+
requiredModule = __webpack_require__(id);
|
|
96
|
+
} catch {} finally{
|
|
97
|
+
__webpack_require__.rstest_original_modules[id] = requiredModule;
|
|
98
|
+
__webpack_require__.rstest_original_module_factories[id] = __webpack_modules__[id];
|
|
99
|
+
}
|
|
100
|
+
if ('string' == typeof modFactory || 'number' == typeof modFactory) __webpack_module_cache__[id] = {
|
|
101
|
+
exports: __webpack_require__(modFactory)
|
|
102
|
+
};
|
|
103
|
+
else if ('function' == typeof modFactory) {
|
|
104
|
+
const exports = modFactory();
|
|
105
|
+
__webpack_require__.r(exports);
|
|
106
|
+
__webpack_module_cache__[id] = {
|
|
107
|
+
exports,
|
|
108
|
+
id,
|
|
109
|
+
loaded: true
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
__webpack_require__.rstest_reset_modules = ()=>{
|
|
114
|
+
const mockedIds = Object.keys(__webpack_require__.rstest_original_modules);
|
|
115
|
+
Object.keys(__webpack_module_cache__).forEach((id)=>{
|
|
116
|
+
if (!mockedIds.includes(id)) delete __webpack_module_cache__[id];
|
|
117
|
+
});
|
|
118
|
+
};
|
package/dist/worker.js
CHANGED
|
@@ -2905,7 +2905,7 @@ var __webpack_modules__ = {
|
|
|
2905
2905
|
return -1 !== position && (-1 === terminatorPosition || position < terminatorPosition);
|
|
2906
2906
|
};
|
|
2907
2907
|
},
|
|
2908
|
-
"../../node_modules/.pnpm/jest-diff@30.
|
|
2908
|
+
"../../node_modules/.pnpm/jest-diff@30.2.0/node_modules/jest-diff/build/index.js": function(module, __unused_webpack_exports, __webpack_require__) {
|
|
2909
2909
|
/*!
|
|
2910
2910
|
* /**
|
|
2911
2911
|
* * Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
@@ -3770,7 +3770,7 @@ var __webpack_modules__ = {
|
|
|
3770
3770
|
});
|
|
3771
3771
|
var _chalk = _interopRequireDefault(__webpack_require__("../../node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/index.js"));
|
|
3772
3772
|
var _getType = __webpack_require__("../../node_modules/.pnpm/@jest+get-type@30.1.0/node_modules/@jest/get-type/build/index.js");
|
|
3773
|
-
var _prettyFormat = __webpack_require__("../../node_modules/.pnpm/pretty-format@30.0
|
|
3773
|
+
var _prettyFormat = __webpack_require__("../../node_modules/.pnpm/pretty-format@30.2.0/node_modules/pretty-format/build/index.js");
|
|
3774
3774
|
var _cleanupSemantic = __nested_webpack_require_48295__("./src/cleanupSemantic.ts");
|
|
3775
3775
|
var _constants = __nested_webpack_require_48295__("./src/constants.ts");
|
|
3776
3776
|
var _diffLines = __nested_webpack_require_48295__("./src/diffLines.ts");
|
|
@@ -3954,7 +3954,7 @@ var __webpack_modules__ = {
|
|
|
3954
3954
|
module.exports = createColors();
|
|
3955
3955
|
module.exports.createColors = createColors;
|
|
3956
3956
|
},
|
|
3957
|
-
"../../node_modules/.pnpm/pretty-format@30.0
|
|
3957
|
+
"../../node_modules/.pnpm/pretty-format@30.2.0/node_modules/pretty-format/build/index.js": function(module, __unused_webpack_exports, __webpack_require__) {
|
|
3958
3958
|
/*!
|
|
3959
3959
|
* /**
|
|
3960
3960
|
* * Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
@@ -4494,6 +4494,7 @@ var __webpack_modules__ = {
|
|
|
4494
4494
|
if ('function' === typeOf) return printFunction(val, printFunctionName);
|
|
4495
4495
|
if ('symbol' === typeOf) return printSymbol(val);
|
|
4496
4496
|
const toStringed = src_toString.call(val);
|
|
4497
|
+
if ('[object Promise]' === toStringed) return 'Promise {}';
|
|
4497
4498
|
if ('[object WeakMap]' === toStringed) return 'WeakMap {}';
|
|
4498
4499
|
if ('[object WeakSet]' === toStringed) return 'WeakSet {}';
|
|
4499
4500
|
if ('[object Function]' === toStringed || '[object GeneratorFunction]' === toStringed) return printFunction(val, printFunctionName);
|
|
@@ -6417,7 +6418,6 @@ var __webpack_modules__ = {
|
|
|
6417
6418
|
map: map
|
|
6418
6419
|
};
|
|
6419
6420
|
};
|
|
6420
|
-
exports.SourceNode = SourceNode;
|
|
6421
6421
|
},
|
|
6422
6422
|
"../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/lib/util.js": function(__unused_webpack_module, exports) {
|
|
6423
6423
|
function getArg(aArgs, aName, aDefaultValue) {
|
|
@@ -6621,7 +6621,7 @@ var __webpack_modules__ = {
|
|
|
6621
6621
|
"../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/source-map.js": function(__unused_webpack_module, exports, __webpack_require__) {
|
|
6622
6622
|
__webpack_require__("../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/lib/source-map-generator.js").SourceMapGenerator;
|
|
6623
6623
|
exports.SourceMapConsumer = __webpack_require__("../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/lib/source-map-consumer.js").SourceMapConsumer;
|
|
6624
|
-
__webpack_require__("../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/lib/source-node.js")
|
|
6624
|
+
__webpack_require__("../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/lib/source-node.js");
|
|
6625
6625
|
},
|
|
6626
6626
|
"../../node_modules/.pnpm/supports-color@7.2.0/node_modules/supports-color/index.js": function(module, __unused_webpack_exports, __webpack_require__) {
|
|
6627
6627
|
const os = __webpack_require__("node:os");
|
|
@@ -6701,7 +6701,7 @@ var __webpack_modules__ = {
|
|
|
6701
6701
|
});
|
|
6702
6702
|
var external_node_module_ = __webpack_require__("node:module");
|
|
6703
6703
|
var external_node_util_ = __webpack_require__("node:util");
|
|
6704
|
-
var build = __webpack_require__("../../node_modules/.pnpm/jest-diff@30.
|
|
6704
|
+
var build = __webpack_require__("../../node_modules/.pnpm/jest-diff@30.2.0/node_modules/jest-diff/build/index.js");
|
|
6705
6705
|
build.DIFF_DELETE;
|
|
6706
6706
|
build.DIFF_EQUAL;
|
|
6707
6707
|
build.DIFF_INSERT;
|
|
@@ -6794,10 +6794,8 @@ var __webpack_modules__ = {
|
|
|
6794
6794
|
"./src/utils/constants.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
6795
6795
|
__webpack_require__.d(__webpack_exports__, {
|
|
6796
6796
|
TE: ()=>globalApis,
|
|
6797
|
-
q_: ()=>ROOT_SUITE_NAME
|
|
6798
|
-
vO: ()=>TEST_DELIMITER
|
|
6797
|
+
q_: ()=>ROOT_SUITE_NAME
|
|
6799
6798
|
});
|
|
6800
|
-
const TEST_DELIMITER = '>';
|
|
6801
6799
|
const ROOT_SUITE_NAME = 'Rstest:_internal_root_suite';
|
|
6802
6800
|
const globalApis = [
|
|
6803
6801
|
'test',
|
|
@@ -6826,7 +6824,7 @@ var __webpack_modules__ = {
|
|
|
6826
6824
|
});
|
|
6827
6825
|
var picocolors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
|
|
6828
6826
|
var picocolors__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/ __webpack_require__.n(picocolors__WEBPACK_IMPORTED_MODULE_1__);
|
|
6829
|
-
|
|
6827
|
+
__webpack_require__("./src/utils/constants.ts");
|
|
6830
6828
|
const isObject = (obj)=>'[object Object]' === Object.prototype.toString.call(obj);
|
|
6831
6829
|
const castArray = (arr)=>{
|
|
6832
6830
|
if (void 0 === arr) return [];
|
|
@@ -6853,7 +6851,7 @@ var __webpack_modules__ = {
|
|
|
6853
6851
|
return time;
|
|
6854
6852
|
};
|
|
6855
6853
|
const getTaskNames = (test)=>(test.parentNames || []).concat(test.name).filter(Boolean);
|
|
6856
|
-
const getTaskNameWithPrefix = (test, delimiter =
|
|
6854
|
+
const getTaskNameWithPrefix = (test, delimiter = ">")=>getTaskNames(test).join(` ${delimiter} `);
|
|
6857
6855
|
const REGEXP_FLAG_PREFIX = 'RSTEST_REGEXP:';
|
|
6858
6856
|
const unwrapRegex = (value)=>{
|
|
6859
6857
|
if (value.startsWith(REGEXP_FLAG_PREFIX)) {
|
|
@@ -6967,6 +6965,7 @@ var __webpack_modules__ = {
|
|
|
6967
6965
|
if ('truecolor' === env.COLORTERM) return 3;
|
|
6968
6966
|
if ('xterm-kitty' === env.TERM) return 3;
|
|
6969
6967
|
if ('xterm-ghostty' === env.TERM) return 3;
|
|
6968
|
+
if ('wezterm' === env.TERM) return 3;
|
|
6970
6969
|
if ('TERM_PROGRAM' in env) {
|
|
6971
6970
|
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
|
|
6972
6971
|
switch(env.TERM_PROGRAM){
|
|
@@ -7101,6 +7100,14 @@ var __webpack_modules__ = {
|
|
|
7101
7100
|
color: magenta
|
|
7102
7101
|
}
|
|
7103
7102
|
};
|
|
7103
|
+
const normalizeErrorMessage = (err)=>{
|
|
7104
|
+
if (err.stack) {
|
|
7105
|
+
let [name, ...rest] = err.stack.split('\n');
|
|
7106
|
+
if (name.startsWith('Error: ')) name = name.slice(7);
|
|
7107
|
+
return `${name}\n${gray(rest.join('\n'))}`;
|
|
7108
|
+
}
|
|
7109
|
+
return err.message;
|
|
7110
|
+
};
|
|
7104
7111
|
let createLogger = (options = {})=>{
|
|
7105
7112
|
let maxLevel = options.level || 'info';
|
|
7106
7113
|
let log = (type, message, ...args)=>{
|
|
@@ -7113,12 +7120,14 @@ var __webpack_modules__ = {
|
|
|
7113
7120
|
label = (logType.label || '').padEnd(7);
|
|
7114
7121
|
label = bold(logType.color ? logType.color(label) : label);
|
|
7115
7122
|
}
|
|
7116
|
-
if (message instanceof Error)
|
|
7117
|
-
|
|
7118
|
-
|
|
7119
|
-
|
|
7120
|
-
|
|
7121
|
-
|
|
7123
|
+
if (message instanceof Error) {
|
|
7124
|
+
text += normalizeErrorMessage(message);
|
|
7125
|
+
const { cause } = message;
|
|
7126
|
+
if (cause) {
|
|
7127
|
+
text += yellow('\n [cause]: ');
|
|
7128
|
+
text += cause instanceof Error ? normalizeErrorMessage(cause) : String(cause);
|
|
7129
|
+
}
|
|
7130
|
+
} else if ('error' === logType.level && 'string' == typeof message) {
|
|
7122
7131
|
let lines = message.split('\n');
|
|
7123
7132
|
text = lines.map((line)=>isErrorStackMessage(line) ? gray(line) : line).join('\n');
|
|
7124
7133
|
} else text = `${message}`;
|
|
@@ -8081,7 +8090,7 @@ function createBirpc(functions, options) {
|
|
|
8081
8090
|
if (msg.t === TYPE_REQUEST) {
|
|
8082
8091
|
const { m: method, a: args } = msg;
|
|
8083
8092
|
let result, error;
|
|
8084
|
-
const fn = resolver ? resolver(method, functions[method]) : functions[method];
|
|
8093
|
+
const fn = await (resolver ? resolver(method, functions[method]) : functions[method]);
|
|
8085
8094
|
if (fn) try {
|
|
8086
8095
|
result = await fn.apply("rpc" === bind ? rpc : functions, args);
|
|
8087
8096
|
} catch (e) {
|
|
@@ -8233,6 +8242,7 @@ const setupEnv = (env)=>{
|
|
|
8233
8242
|
const preparePool = async ({ entryInfo: { distPath, testPath }, updateSnapshot, context })=>{
|
|
8234
8243
|
(0, util.zH)();
|
|
8235
8244
|
context.runtimeConfig = (0, helper.gy)(context.runtimeConfig);
|
|
8245
|
+
process.env.RSTEST_WORKER_ID = String(process.__tinypool_state__.workerId || context.taskId);
|
|
8236
8246
|
const cleanupFns = [];
|
|
8237
8247
|
const { rpc } = createRuntimeRpc(createForksRpcOptions());
|
|
8238
8248
|
const { runtimeConfig: { globals, printConsoleTrace, disableConsoleIntercept, testEnvironment, snapshotFormat, env } } = context;
|
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.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "The Rsbuild-based test tool.",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/web-infra-dev/rstest/issues"
|
|
@@ -47,20 +47,20 @@
|
|
|
47
47
|
"importMeta.d.ts"
|
|
48
48
|
],
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@types/chai": "^5.2.
|
|
51
|
-
"@rsbuild/core": "1.
|
|
50
|
+
"@types/chai": "^5.2.3",
|
|
51
|
+
"@rsbuild/core": "1.6.0-beta.1",
|
|
52
52
|
"tinypool": "^1.1.1"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"chai": "^5.3.3",
|
|
56
56
|
"pathe": "^2.0.3",
|
|
57
|
-
"birpc": "2.
|
|
57
|
+
"birpc": "2.6.1",
|
|
58
58
|
"@vitest/expect": "^3.2.4",
|
|
59
59
|
"@vitest/snapshot": "^3.2.4",
|
|
60
60
|
"@babel/code-frame": "^7.27.1",
|
|
61
61
|
"@jridgewell/trace-mapping": "0.3.31",
|
|
62
|
-
"@microsoft/api-extractor": "^7.
|
|
63
|
-
"@rslib/core": "0.
|
|
62
|
+
"@microsoft/api-extractor": "^7.53.2",
|
|
63
|
+
"@rslib/core": "0.16.0",
|
|
64
64
|
"@sinonjs/fake-timers": "^14.0.0",
|
|
65
65
|
"@types/babel__code-frame": "^7.0.6",
|
|
66
66
|
"@types/istanbul-reports": "^3.0.4",
|
|
@@ -71,18 +71,18 @@
|
|
|
71
71
|
"@types/picomatch": "^4.0.2",
|
|
72
72
|
"cac": "^6.7.14",
|
|
73
73
|
"chokidar": "^4.0.3",
|
|
74
|
-
"happy-dom": "^20.0.
|
|
75
|
-
"jest-diff": "^30.
|
|
74
|
+
"happy-dom": "^20.0.8",
|
|
75
|
+
"jest-diff": "^30.2.0",
|
|
76
76
|
"jsdom": "^26.1.0",
|
|
77
77
|
"webpack-license-plugin": "^4.5.1",
|
|
78
78
|
"picocolors": "^1.1.1",
|
|
79
|
-
"rslog": "^1.
|
|
79
|
+
"rslog": "^1.3.0",
|
|
80
80
|
"source-map-support": "^0.5.21",
|
|
81
|
-
"std-env": "^3.
|
|
81
|
+
"std-env": "^3.10.0",
|
|
82
82
|
"stacktrace-parser": "0.1.11",
|
|
83
83
|
"strip-ansi": "^7.1.2",
|
|
84
84
|
"tinyglobby": "^0.2.15",
|
|
85
|
-
"tinyspy": "^4.0.
|
|
85
|
+
"tinyspy": "^4.0.4",
|
|
86
86
|
"picomatch": "^4.0.3",
|
|
87
87
|
"@rstest/tsconfig": "0.0.1"
|
|
88
88
|
},
|