@rstest/core 0.8.0 → 0.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +0 -200
- package/dist/0~130.js +7 -9
- package/dist/0~1472.js +8 -12
- package/dist/0~2173.js +102 -67
- package/dist/0~2255.js +2 -2
- package/dist/0~3919.js +1 -1
- package/dist/0~4403.js +4 -4
- package/dist/0~5835.js +3 -3
- package/dist/0~6588.js +4 -7
- package/dist/0~6923.js +3 -3
- package/dist/0~7583.js +8 -9
- package/dist/0~7882.js +36 -723
- package/dist/0~8426.js +5 -7
- package/dist/0~89.js +21 -18
- package/dist/0~9348.js +1 -2
- package/dist/0~9634.js +24 -13
- package/dist/1157.js +172 -42
- package/dist/1157.js.LICENSE.txt +21 -0
- package/dist/1294.js +1 -1
- package/dist/{2672.js → 3160.js} +312 -8
- package/dist/487.js +3 -3
- package/dist/5734.js +2 -5
- package/dist/6151.js +210 -11
- package/dist/6973.js +5 -7
- package/dist/7011.js +19 -0
- package/dist/9131.js +1381 -71
- package/dist/browser-runtime/2~907.js +0 -2
- package/dist/browser-runtime/389.js +628 -24
- package/dist/browser-runtime/index.d.ts +263 -118
- package/dist/browser-runtime/rslib-runtime.js +0 -2
- package/dist/browser.d.ts +324 -119
- package/dist/browser.js +2 -7
- package/dist/globalSetupWorker.js +2 -4
- package/dist/index.d.ts +274 -117
- package/dist/mockRuntimeCode.js +92 -0
- package/dist/rslib-runtime.js +0 -27
- package/dist/worker.d.ts +99 -110
- package/dist/worker.js +3 -5
- package/package.json +2 -3
- package/dist/3278.js +0 -318
- package/dist/browser-runtime/2~907.js.map +0 -1
- package/dist/browser-runtime/389.js.map +0 -1
- package/dist/browser-runtime/rslib-runtime.js.map +0 -1
|
@@ -7378,6 +7378,104 @@ __webpack_require__.add({
|
|
|
7378
7378
|
return number < 0 ? -1 : 1;
|
|
7379
7379
|
};
|
|
7380
7380
|
},
|
|
7381
|
+
"../../node_modules/.pnpm/os-browserify@0.3.0/node_modules/os-browserify/browser.js" (__unused_rspack_module, exports) {
|
|
7382
|
+
exports.endianness = function() {
|
|
7383
|
+
return 'LE';
|
|
7384
|
+
};
|
|
7385
|
+
exports.hostname = function() {
|
|
7386
|
+
if ("u" > typeof location) return location.hostname;
|
|
7387
|
+
return '';
|
|
7388
|
+
};
|
|
7389
|
+
exports.loadavg = function() {
|
|
7390
|
+
return [];
|
|
7391
|
+
};
|
|
7392
|
+
exports.uptime = function() {
|
|
7393
|
+
return 0;
|
|
7394
|
+
};
|
|
7395
|
+
exports.freemem = function() {
|
|
7396
|
+
return Number.MAX_VALUE;
|
|
7397
|
+
};
|
|
7398
|
+
exports.totalmem = function() {
|
|
7399
|
+
return Number.MAX_VALUE;
|
|
7400
|
+
};
|
|
7401
|
+
exports.cpus = function() {
|
|
7402
|
+
return [];
|
|
7403
|
+
};
|
|
7404
|
+
exports.type = function() {
|
|
7405
|
+
return 'Browser';
|
|
7406
|
+
};
|
|
7407
|
+
exports.release = function() {
|
|
7408
|
+
if ("u" > typeof navigator) return navigator.appVersion;
|
|
7409
|
+
return '';
|
|
7410
|
+
};
|
|
7411
|
+
exports.networkInterfaces = exports.getNetworkInterfaces = function() {
|
|
7412
|
+
return {};
|
|
7413
|
+
};
|
|
7414
|
+
exports.arch = function() {
|
|
7415
|
+
return "javascript";
|
|
7416
|
+
};
|
|
7417
|
+
exports.platform = function() {
|
|
7418
|
+
return 'browser';
|
|
7419
|
+
};
|
|
7420
|
+
exports.tmpdir = exports.tmpDir = function() {
|
|
7421
|
+
return '/tmp';
|
|
7422
|
+
};
|
|
7423
|
+
exports.EOL = '\n';
|
|
7424
|
+
exports.homedir = function() {
|
|
7425
|
+
return '/';
|
|
7426
|
+
};
|
|
7427
|
+
},
|
|
7428
|
+
"../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.browser.js" (module) {
|
|
7429
|
+
var x = String;
|
|
7430
|
+
var create = function() {
|
|
7431
|
+
return {
|
|
7432
|
+
isColorSupported: false,
|
|
7433
|
+
reset: x,
|
|
7434
|
+
bold: x,
|
|
7435
|
+
dim: x,
|
|
7436
|
+
italic: x,
|
|
7437
|
+
underline: x,
|
|
7438
|
+
inverse: x,
|
|
7439
|
+
hidden: x,
|
|
7440
|
+
strikethrough: x,
|
|
7441
|
+
black: x,
|
|
7442
|
+
red: x,
|
|
7443
|
+
green: x,
|
|
7444
|
+
yellow: x,
|
|
7445
|
+
blue: x,
|
|
7446
|
+
magenta: x,
|
|
7447
|
+
cyan: x,
|
|
7448
|
+
white: x,
|
|
7449
|
+
gray: x,
|
|
7450
|
+
bgBlack: x,
|
|
7451
|
+
bgRed: x,
|
|
7452
|
+
bgGreen: x,
|
|
7453
|
+
bgYellow: x,
|
|
7454
|
+
bgBlue: x,
|
|
7455
|
+
bgMagenta: x,
|
|
7456
|
+
bgCyan: x,
|
|
7457
|
+
bgWhite: x,
|
|
7458
|
+
blackBright: x,
|
|
7459
|
+
redBright: x,
|
|
7460
|
+
greenBright: x,
|
|
7461
|
+
yellowBright: x,
|
|
7462
|
+
blueBright: x,
|
|
7463
|
+
magentaBright: x,
|
|
7464
|
+
cyanBright: x,
|
|
7465
|
+
whiteBright: x,
|
|
7466
|
+
bgBlackBright: x,
|
|
7467
|
+
bgRedBright: x,
|
|
7468
|
+
bgGreenBright: x,
|
|
7469
|
+
bgYellowBright: x,
|
|
7470
|
+
bgBlueBright: x,
|
|
7471
|
+
bgMagentaBright: x,
|
|
7472
|
+
bgCyanBright: x,
|
|
7473
|
+
bgWhiteBright: x
|
|
7474
|
+
};
|
|
7475
|
+
};
|
|
7476
|
+
module.exports = create();
|
|
7477
|
+
module.exports.createColors = create;
|
|
7478
|
+
},
|
|
7381
7479
|
"../../node_modules/.pnpm/possible-typed-array-names@1.1.0/node_modules/possible-typed-array-names/index.js" (module) {
|
|
7382
7480
|
module.exports = [
|
|
7383
7481
|
'Float16Array',
|
|
@@ -8701,6 +8799,19 @@ __webpack_require__.add({
|
|
|
8701
8799
|
exports.setImmediate = "u" > typeof self && self.setImmediate || void 0 !== __webpack_require__.g && __webpack_require__.g.setImmediate || this && this.setImmediate;
|
|
8702
8800
|
exports.clearImmediate = "u" > typeof self && self.clearImmediate || void 0 !== __webpack_require__.g && __webpack_require__.g.clearImmediate || this && this.clearImmediate;
|
|
8703
8801
|
},
|
|
8802
|
+
"../../node_modules/.pnpm/tty-browserify@0.0.1/node_modules/tty-browserify/index.js" (__unused_rspack_module, exports) {
|
|
8803
|
+
exports.isatty = function() {
|
|
8804
|
+
return false;
|
|
8805
|
+
};
|
|
8806
|
+
function ReadStream() {
|
|
8807
|
+
throw new Error('tty.ReadStream is not implemented');
|
|
8808
|
+
}
|
|
8809
|
+
exports.ReadStream = ReadStream;
|
|
8810
|
+
function WriteStream() {
|
|
8811
|
+
throw new Error('tty.WriteStream is not implemented');
|
|
8812
|
+
}
|
|
8813
|
+
exports.WriteStream = WriteStream;
|
|
8814
|
+
},
|
|
8704
8815
|
"../../node_modules/.pnpm/type-detect@4.0.8/node_modules/type-detect/type-detect.js" (module, __unused_rspack_exports, __webpack_require__) {
|
|
8705
8816
|
(function(global, factory) {
|
|
8706
8817
|
module.exports = factory();
|
|
@@ -17760,6 +17871,302 @@ const JestExtend = (chai, utils)=>{
|
|
|
17760
17871
|
use(JestExtendPlugin(chai, expect, expects));
|
|
17761
17872
|
});
|
|
17762
17873
|
};
|
|
17874
|
+
const browser = __webpack_require__("../../node_modules/.pnpm/process@0.11.10/node_modules/process/browser.js");
|
|
17875
|
+
const browser_0 = __webpack_require__("../../node_modules/.pnpm/os-browserify@0.3.0/node_modules/os-browserify/browser.js");
|
|
17876
|
+
const tty_browserify = __webpack_require__("../../node_modules/.pnpm/tty-browserify@0.0.1/node_modules/tty-browserify/index.js");
|
|
17877
|
+
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : browser.argv) {
|
|
17878
|
+
const prefix = flag.startsWith('-') ? '' : 1 === flag.length ? '-' : '--';
|
|
17879
|
+
const position = argv.indexOf(prefix + flag);
|
|
17880
|
+
const terminatorPosition = argv.indexOf('--');
|
|
17881
|
+
return -1 !== position && (-1 === terminatorPosition || position < terminatorPosition);
|
|
17882
|
+
}
|
|
17883
|
+
const { env: env } = browser;
|
|
17884
|
+
let flagForceColor;
|
|
17885
|
+
if (hasFlag('no-color') || hasFlag('no-colors') || hasFlag('color=false') || hasFlag('color=never')) flagForceColor = 0;
|
|
17886
|
+
else if (hasFlag('color') || hasFlag('colors') || hasFlag('color=true') || hasFlag('color=always')) flagForceColor = 1;
|
|
17887
|
+
function envForceColor() {
|
|
17888
|
+
if (!('FORCE_COLOR' in env)) return;
|
|
17889
|
+
if ('true' === env.FORCE_COLOR) return 1;
|
|
17890
|
+
if ('false' === env.FORCE_COLOR) return 0;
|
|
17891
|
+
if (0 === env.FORCE_COLOR.length) return 1;
|
|
17892
|
+
const level = Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
|
17893
|
+
if (![
|
|
17894
|
+
0,
|
|
17895
|
+
1,
|
|
17896
|
+
2,
|
|
17897
|
+
3
|
|
17898
|
+
].includes(level)) return;
|
|
17899
|
+
return level;
|
|
17900
|
+
}
|
|
17901
|
+
function translateLevel(level) {
|
|
17902
|
+
if (0 === level) return false;
|
|
17903
|
+
return {
|
|
17904
|
+
level,
|
|
17905
|
+
hasBasic: true,
|
|
17906
|
+
has256: level >= 2,
|
|
17907
|
+
has16m: level >= 3
|
|
17908
|
+
};
|
|
17909
|
+
}
|
|
17910
|
+
function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
17911
|
+
const noFlagForceColor = envForceColor();
|
|
17912
|
+
if (void 0 !== noFlagForceColor) flagForceColor = noFlagForceColor;
|
|
17913
|
+
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
|
|
17914
|
+
if (0 === forceColor) return 0;
|
|
17915
|
+
if (sniffFlags) {
|
|
17916
|
+
if (hasFlag('color=16m') || hasFlag('color=full') || hasFlag('color=truecolor')) return 3;
|
|
17917
|
+
if (hasFlag('color=256')) return 2;
|
|
17918
|
+
}
|
|
17919
|
+
if ('TF_BUILD' in env && 'AGENT_NAME' in env) return 1;
|
|
17920
|
+
if (haveStream && !streamIsTTY && void 0 === forceColor) return 0;
|
|
17921
|
+
const min = forceColor || 0;
|
|
17922
|
+
if ('dumb' === env.TERM) return min;
|
|
17923
|
+
if ('win32' === browser.platform) {
|
|
17924
|
+
const osRelease = browser_0.release().split('.');
|
|
17925
|
+
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
17926
|
+
return 1;
|
|
17927
|
+
}
|
|
17928
|
+
if ('CI' in env) {
|
|
17929
|
+
if ([
|
|
17930
|
+
'GITHUB_ACTIONS',
|
|
17931
|
+
'GITEA_ACTIONS',
|
|
17932
|
+
'CIRCLECI'
|
|
17933
|
+
].some((key)=>key in env)) return 3;
|
|
17934
|
+
if ([
|
|
17935
|
+
'TRAVIS',
|
|
17936
|
+
'APPVEYOR',
|
|
17937
|
+
'GITLAB_CI',
|
|
17938
|
+
'BUILDKITE',
|
|
17939
|
+
'DRONE'
|
|
17940
|
+
].some((sign)=>sign in env) || 'codeship' === env.CI_NAME) return 1;
|
|
17941
|
+
return min;
|
|
17942
|
+
}
|
|
17943
|
+
if ('TEAMCITY_VERSION' in env) return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
17944
|
+
if ('truecolor' === env.COLORTERM) return 3;
|
|
17945
|
+
if ('xterm-kitty' === env.TERM) return 3;
|
|
17946
|
+
if ('xterm-ghostty' === env.TERM) return 3;
|
|
17947
|
+
if ('wezterm' === env.TERM) return 3;
|
|
17948
|
+
if ('TERM_PROGRAM' in env) {
|
|
17949
|
+
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
|
|
17950
|
+
switch(env.TERM_PROGRAM){
|
|
17951
|
+
case 'iTerm.app':
|
|
17952
|
+
return version >= 3 ? 3 : 2;
|
|
17953
|
+
case 'Apple_Terminal':
|
|
17954
|
+
return 2;
|
|
17955
|
+
}
|
|
17956
|
+
}
|
|
17957
|
+
if (/-256(color)?$/i.test(env.TERM)) return 2;
|
|
17958
|
+
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) return 1;
|
|
17959
|
+
if ('COLORTERM' in env) return 1;
|
|
17960
|
+
return min;
|
|
17961
|
+
}
|
|
17962
|
+
function createSupportsColor(stream, options = {}) {
|
|
17963
|
+
const level = _supportsColor(stream, {
|
|
17964
|
+
streamIsTTY: stream && stream.isTTY,
|
|
17965
|
+
...options
|
|
17966
|
+
});
|
|
17967
|
+
return translateLevel(level);
|
|
17968
|
+
}
|
|
17969
|
+
const supportsColor = {
|
|
17970
|
+
stdout: createSupportsColor({
|
|
17971
|
+
isTTY: tty_browserify.isatty(1)
|
|
17972
|
+
}),
|
|
17973
|
+
stderr: createSupportsColor({
|
|
17974
|
+
isTTY: tty_browserify.isatty(2)
|
|
17975
|
+
})
|
|
17976
|
+
};
|
|
17977
|
+
const supports_color = supportsColor;
|
|
17978
|
+
const colorLevel = supports_color.stdout ? supports_color.stdout.level : 0;
|
|
17979
|
+
let errorStackRegExp = /at [^\r\n]{0,200}:\d+:\d+[\s\)]*$/;
|
|
17980
|
+
let anonymousErrorStackRegExp = /at [^\r\n]{0,200}\(<anonymous>\)$/;
|
|
17981
|
+
let indexErrorStackRegExp = /at [^\r\n]{0,200}\(index\s\d+\)$/;
|
|
17982
|
+
let isErrorStackMessage = (message)=>errorStackRegExp.test(message) || anonymousErrorStackRegExp.test(message) || indexErrorStackRegExp.test(message);
|
|
17983
|
+
let formatter = (open, close, replace = open)=>colorLevel >= 2 ? (input)=>{
|
|
17984
|
+
let string = '' + input;
|
|
17985
|
+
let index = string.indexOf(close, open.length);
|
|
17986
|
+
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
17987
|
+
} : String;
|
|
17988
|
+
let replaceClose = (string, close, replace, index)=>{
|
|
17989
|
+
let start = string.substring(0, index) + replace;
|
|
17990
|
+
let end = string.substring(index + close.length);
|
|
17991
|
+
let nextIndex = end.indexOf(close);
|
|
17992
|
+
return ~nextIndex ? start + replaceClose(end, close, replace, nextIndex) : start + end;
|
|
17993
|
+
};
|
|
17994
|
+
const bold = formatter('\x1b[1m', '\x1b[22m', '\x1b[22m\x1b[1m');
|
|
17995
|
+
const red = formatter('\x1b[31m', '\x1b[39m');
|
|
17996
|
+
const green = formatter('\x1b[32m', '\x1b[39m');
|
|
17997
|
+
const yellow = formatter('\x1b[33m', '\x1b[39m');
|
|
17998
|
+
const magenta = formatter('\x1b[35m', '\x1b[39m');
|
|
17999
|
+
const cyan = formatter('\x1b[36m', '\x1b[39m');
|
|
18000
|
+
const gray = formatter('\x1b[90m', '\x1b[39m');
|
|
18001
|
+
let startColor = [
|
|
18002
|
+
189,
|
|
18003
|
+
255,
|
|
18004
|
+
243
|
|
18005
|
+
];
|
|
18006
|
+
let endColor = [
|
|
18007
|
+
74,
|
|
18008
|
+
194,
|
|
18009
|
+
154
|
|
18010
|
+
];
|
|
18011
|
+
let isWord = (char)=>!/[\s\n]/.test(char);
|
|
18012
|
+
let gradient = (message)=>{
|
|
18013
|
+
if (colorLevel < 3) return 2 === colorLevel ? bold(cyan(message)) : message;
|
|
18014
|
+
let chars = [
|
|
18015
|
+
...message
|
|
18016
|
+
];
|
|
18017
|
+
let steps = chars.filter(isWord).length;
|
|
18018
|
+
let r = startColor[0];
|
|
18019
|
+
let g = startColor[1];
|
|
18020
|
+
let b = startColor[2];
|
|
18021
|
+
let rStep = (endColor[0] - r) / steps;
|
|
18022
|
+
let gStep = (endColor[1] - g) / steps;
|
|
18023
|
+
let bStep = (endColor[2] - b) / steps;
|
|
18024
|
+
let output = '';
|
|
18025
|
+
for (let char of chars){
|
|
18026
|
+
if (isWord(char)) {
|
|
18027
|
+
r += rStep;
|
|
18028
|
+
g += gStep;
|
|
18029
|
+
b += bStep;
|
|
18030
|
+
}
|
|
18031
|
+
output += `\x1b[38;2;${Math.round(r)};${Math.round(g)};${Math.round(b)}m${char}\x1b[39m`;
|
|
18032
|
+
}
|
|
18033
|
+
return bold(output);
|
|
18034
|
+
};
|
|
18035
|
+
let LOG_LEVEL = {
|
|
18036
|
+
silent: -1,
|
|
18037
|
+
error: 0,
|
|
18038
|
+
warn: 1,
|
|
18039
|
+
info: 2,
|
|
18040
|
+
log: 2,
|
|
18041
|
+
verbose: 3
|
|
18042
|
+
};
|
|
18043
|
+
let LOG_TYPES = {
|
|
18044
|
+
error: {
|
|
18045
|
+
label: 'error',
|
|
18046
|
+
level: 'error',
|
|
18047
|
+
color: red
|
|
18048
|
+
},
|
|
18049
|
+
warn: {
|
|
18050
|
+
label: 'warn',
|
|
18051
|
+
level: 'warn',
|
|
18052
|
+
color: yellow
|
|
18053
|
+
},
|
|
18054
|
+
info: {
|
|
18055
|
+
label: 'info',
|
|
18056
|
+
level: 'info',
|
|
18057
|
+
color: cyan
|
|
18058
|
+
},
|
|
18059
|
+
start: {
|
|
18060
|
+
label: 'start',
|
|
18061
|
+
level: 'info',
|
|
18062
|
+
color: cyan
|
|
18063
|
+
},
|
|
18064
|
+
ready: {
|
|
18065
|
+
label: 'ready',
|
|
18066
|
+
level: 'info',
|
|
18067
|
+
color: green
|
|
18068
|
+
},
|
|
18069
|
+
success: {
|
|
18070
|
+
label: 'success',
|
|
18071
|
+
level: 'info',
|
|
18072
|
+
color: green
|
|
18073
|
+
},
|
|
18074
|
+
log: {
|
|
18075
|
+
level: 'info'
|
|
18076
|
+
},
|
|
18077
|
+
debug: {
|
|
18078
|
+
label: 'debug',
|
|
18079
|
+
level: 'verbose',
|
|
18080
|
+
color: magenta
|
|
18081
|
+
}
|
|
18082
|
+
};
|
|
18083
|
+
const dist_normalizeErrorMessage = (err)=>{
|
|
18084
|
+
if (err.stack) {
|
|
18085
|
+
let [name, ...rest] = err.stack.split('\n');
|
|
18086
|
+
if (name.startsWith('Error: ')) name = name.slice(7);
|
|
18087
|
+
return `${name}\n${gray(rest.join('\n'))}`;
|
|
18088
|
+
}
|
|
18089
|
+
return err.message;
|
|
18090
|
+
};
|
|
18091
|
+
let createLogger = (options = {})=>{
|
|
18092
|
+
let maxLevel = options.level || 'info';
|
|
18093
|
+
let log = (type, message, ...args)=>{
|
|
18094
|
+
let logType = LOG_TYPES[type];
|
|
18095
|
+
const { level } = logType;
|
|
18096
|
+
if (LOG_LEVEL[level] > LOG_LEVEL[maxLevel]) return;
|
|
18097
|
+
if (null == message) return console.log();
|
|
18098
|
+
let label = '';
|
|
18099
|
+
let text = '';
|
|
18100
|
+
if ('label' in logType) {
|
|
18101
|
+
label = (logType.label || '').padEnd(7);
|
|
18102
|
+
label = bold(logType.color ? logType.color(label) : label);
|
|
18103
|
+
}
|
|
18104
|
+
if (message instanceof Error) {
|
|
18105
|
+
text += dist_normalizeErrorMessage(message);
|
|
18106
|
+
const { cause } = message;
|
|
18107
|
+
if (cause) {
|
|
18108
|
+
text += yellow('\n [cause]: ');
|
|
18109
|
+
text += cause instanceof Error ? dist_normalizeErrorMessage(cause) : String(cause);
|
|
18110
|
+
}
|
|
18111
|
+
} else if ('error' === level && 'string' == typeof message) {
|
|
18112
|
+
let lines = message.split('\n');
|
|
18113
|
+
text = lines.map((line)=>isErrorStackMessage(line) ? gray(line) : line).join('\n');
|
|
18114
|
+
} else text = `${message}`;
|
|
18115
|
+
const method = 'error' === level || 'warn' === level ? level : 'log';
|
|
18116
|
+
console[method](label.length ? `${label} ${text}` : text, ...args);
|
|
18117
|
+
};
|
|
18118
|
+
let logger = {
|
|
18119
|
+
greet: (message)=>log('log', gradient(message))
|
|
18120
|
+
};
|
|
18121
|
+
Object.keys(LOG_TYPES).forEach((key)=>{
|
|
18122
|
+
logger[key] = (...args)=>log(key, ...args);
|
|
18123
|
+
});
|
|
18124
|
+
Object.defineProperty(logger, 'level', {
|
|
18125
|
+
get: ()=>maxLevel,
|
|
18126
|
+
set (val) {
|
|
18127
|
+
maxLevel = val;
|
|
18128
|
+
}
|
|
18129
|
+
});
|
|
18130
|
+
logger.override = (customLogger)=>{
|
|
18131
|
+
Object.assign(logger, customLogger);
|
|
18132
|
+
};
|
|
18133
|
+
return logger;
|
|
18134
|
+
};
|
|
18135
|
+
let src_logger = createLogger();
|
|
18136
|
+
const picocolors_browser = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.browser.js");
|
|
18137
|
+
var logger_process = __webpack_require__("../../node_modules/.pnpm/process@0.11.10/node_modules/process/browser.js");
|
|
18138
|
+
const isDebug = ()=>{
|
|
18139
|
+
if (!logger_process.env.DEBUG) return false;
|
|
18140
|
+
const values = logger_process.env.DEBUG.toLocaleLowerCase().split(',');
|
|
18141
|
+
return [
|
|
18142
|
+
'rstest',
|
|
18143
|
+
'rsbuild',
|
|
18144
|
+
'builder',
|
|
18145
|
+
'*'
|
|
18146
|
+
].some((key)=>values.includes(key));
|
|
18147
|
+
};
|
|
18148
|
+
const logger_color = (0, picocolors_browser.createColors)();
|
|
18149
|
+
if (isDebug()) src_logger.level = 'verbose';
|
|
18150
|
+
function getTime() {
|
|
18151
|
+
const now = new Date();
|
|
18152
|
+
const hours = String(now.getHours()).padStart(2, '0');
|
|
18153
|
+
const minutes = String(now.getMinutes()).padStart(2, '0');
|
|
18154
|
+
const seconds = String(now.getSeconds()).padStart(2, '0');
|
|
18155
|
+
return `${hours}:${minutes}:${seconds}`;
|
|
18156
|
+
}
|
|
18157
|
+
src_logger.override({
|
|
18158
|
+
debug: (message, ...args)=>{
|
|
18159
|
+
if ('verbose' !== src_logger.level) return;
|
|
18160
|
+
const time = logger_color.gray(getTime());
|
|
18161
|
+
console.log(` ${logger_color.magenta('rstest')} ${time} ${message}`, ...args);
|
|
18162
|
+
}
|
|
18163
|
+
});
|
|
18164
|
+
({
|
|
18165
|
+
...src_logger,
|
|
18166
|
+
stderr: (message, ...args)=>{
|
|
18167
|
+
console.error(message, ...args);
|
|
18168
|
+
}
|
|
18169
|
+
});
|
|
17763
18170
|
var helper_process = __webpack_require__("../../node_modules/.pnpm/process@0.11.10/node_modules/process/browser.js");
|
|
17764
18171
|
const helper_isObject = (obj)=>'[object Object]' === Object.prototype.toString.call(obj);
|
|
17765
18172
|
const castArray = (arr)=>{
|
|
@@ -17769,7 +18176,7 @@ const castArray = (arr)=>{
|
|
|
17769
18176
|
];
|
|
17770
18177
|
};
|
|
17771
18178
|
const getTaskNames = (test)=>(test.parentNames || []).concat(test.name).filter(Boolean);
|
|
17772
|
-
const getTaskNameWithPrefix = (test, delimiter = ">")=>getTaskNames(test).join(` ${delimiter} `);
|
|
18179
|
+
const getTaskNameWithPrefix = (test, delimiter = ">")=>getTaskNames(test).join(delimiter ? ` ${delimiter} ` : ' ');
|
|
17773
18180
|
void 0 !== helper_process && helper_process.versions?.deno;
|
|
17774
18181
|
const build_0 = __webpack_require__("../../node_modules/.pnpm/jest-diff@30.2.0/node_modules/jest-diff/build/index.js");
|
|
17775
18182
|
build_0.DIFF_DELETE;
|
|
@@ -18079,11 +18486,11 @@ const pathe_M_eThtNZ_isAbsolute = function(p) {
|
|
|
18079
18486
|
};
|
|
18080
18487
|
var snapshot_dist_process = __webpack_require__("../../node_modules/.pnpm/process@0.11.10/node_modules/process/browser.js");
|
|
18081
18488
|
const comma = ','.charCodeAt(0);
|
|
18082
|
-
const
|
|
18489
|
+
const dist_chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
18083
18490
|
const intToChar = new Uint8Array(64);
|
|
18084
18491
|
const charToInt = new Uint8Array(128);
|
|
18085
|
-
for(let i = 0; i <
|
|
18086
|
-
const c =
|
|
18492
|
+
for(let i = 0; i < dist_chars.length; i++){
|
|
18493
|
+
const c = dist_chars.charCodeAt(i);
|
|
18087
18494
|
intToChar[i] = c;
|
|
18088
18495
|
charToInt[c] = i;
|
|
18089
18496
|
}
|
|
@@ -18589,10 +18996,10 @@ function parseSingleV8Stack(raw) {
|
|
|
18589
18996
|
if (!CHROME_IE_STACK_REGEXP.test(line)) return null;
|
|
18590
18997
|
if (line.includes("(eval ")) line = line.replace(/eval code/g, "eval").replace(/(\(eval at [^()]*)|(,.*$)/g, "");
|
|
18591
18998
|
let sanitizedLine = line.replace(/^\s+/, "").replace(/\(eval code/g, "(").replace(/^.*?\s+/, "");
|
|
18592
|
-
const
|
|
18593
|
-
sanitizedLine =
|
|
18594
|
-
const [url, lineNumber, columnNumber] = extractLocation(
|
|
18595
|
-
let method =
|
|
18999
|
+
const location1 = sanitizedLine.match(/ (\(.+\)$)/);
|
|
19000
|
+
sanitizedLine = location1 ? sanitizedLine.replace(location1[0], "") : sanitizedLine;
|
|
19001
|
+
const [url, lineNumber, columnNumber] = extractLocation(location1 ? location1[1] : sanitizedLine);
|
|
19002
|
+
let method = location1 && sanitizedLine || "";
|
|
18596
19003
|
let file = url && [
|
|
18597
19004
|
"eval",
|
|
18598
19005
|
"<anonymous>"
|
|
@@ -20435,7 +20842,8 @@ function hasOnlyTest(test) {
|
|
|
20435
20842
|
}
|
|
20436
20843
|
const shouldTestSkip = (test, runOnly, testNamePattern)=>{
|
|
20437
20844
|
if (runOnly && 'only' !== test.runMode) return true;
|
|
20438
|
-
|
|
20845
|
+
const delimiter = testNamePattern?.toString().includes(">") ? ">" : '';
|
|
20846
|
+
if (testNamePattern && !getTaskNameWithPrefix(test, delimiter).match(testNamePattern)) return true;
|
|
20439
20847
|
return false;
|
|
20440
20848
|
};
|
|
20441
20849
|
const traverseUpdateTestRunMode = (testSuite, parentRunMode, runOnly, testNamePattern)=>{
|
|
@@ -20685,13 +21093,16 @@ class TestRunner {
|
|
|
20685
21093
|
result.errors ??= [];
|
|
20686
21094
|
result.errors.push(...formatTestError(error));
|
|
20687
21095
|
}
|
|
20688
|
-
if ('fail' === result.status)
|
|
20689
|
-
|
|
20690
|
-
|
|
20691
|
-
|
|
20692
|
-
|
|
20693
|
-
|
|
20694
|
-
|
|
21096
|
+
if ('fail' === result.status) {
|
|
21097
|
+
for (const fn of [
|
|
21098
|
+
...test.onFailed
|
|
21099
|
+
].reverse())try {
|
|
21100
|
+
await fn(test.context);
|
|
21101
|
+
} catch (error) {
|
|
21102
|
+
result.errors ??= [];
|
|
21103
|
+
result.errors.push(...formatTestError(error));
|
|
21104
|
+
}
|
|
21105
|
+
snapshotClient.skipTest(testPath, getTaskNameWithPrefix(test));
|
|
20695
21106
|
}
|
|
20696
21107
|
this.resetCurrentTest();
|
|
20697
21108
|
return result;
|
|
@@ -21151,7 +21562,7 @@ class RunnerRuntime {
|
|
|
21151
21562
|
type: 'suite'
|
|
21152
21563
|
};
|
|
21153
21564
|
}
|
|
21154
|
-
describe({ name, fn, runMode = 'run', each = false, concurrent, sequential, location }) {
|
|
21565
|
+
describe({ name, fn, runMode = 'run', each = false, concurrent, sequential, location: location1 }) {
|
|
21155
21566
|
this.checkStatus(name, 'suite');
|
|
21156
21567
|
const currentSuite = {
|
|
21157
21568
|
project: this.project,
|
|
@@ -21163,7 +21574,7 @@ class RunnerRuntime {
|
|
|
21163
21574
|
testPath: this.testPath,
|
|
21164
21575
|
concurrent,
|
|
21165
21576
|
sequential,
|
|
21166
|
-
location
|
|
21577
|
+
location: location1
|
|
21167
21578
|
};
|
|
21168
21579
|
if (!fn) {
|
|
21169
21580
|
this.addTest(currentSuite);
|
|
@@ -21232,7 +21643,7 @@ class RunnerRuntime {
|
|
|
21232
21643
|
ensureRootSuite() {
|
|
21233
21644
|
if (0 === this._currentTest.length) this.addTest(this.getDefaultRootSuite());
|
|
21234
21645
|
}
|
|
21235
|
-
it({ name, fn, originalFn = fn, fixtures, timeout = this.runtimeConfig.testTimeout, runMode = 'run', fails = false, each = false, concurrent, sequential, location }) {
|
|
21646
|
+
it({ name, fn, originalFn = fn, fixtures, timeout = this.runtimeConfig.testTimeout, runMode = 'run', fails = false, each = false, concurrent, sequential, location: location1 }) {
|
|
21236
21647
|
this.checkStatus(name, 'case');
|
|
21237
21648
|
this.addTestCase({
|
|
21238
21649
|
project: this.project,
|
|
@@ -21250,7 +21661,7 @@ class RunnerRuntime {
|
|
|
21250
21661
|
fails,
|
|
21251
21662
|
onFinished: [],
|
|
21252
21663
|
onFailed: [],
|
|
21253
|
-
location
|
|
21664
|
+
location: location1
|
|
21254
21665
|
});
|
|
21255
21666
|
}
|
|
21256
21667
|
describeEach({ cases, ...options }) {
|
|
@@ -21705,6 +22116,152 @@ class FakeTimers {
|
|
|
21705
22116
|
this._fakeTimers = (0, fake_timers_src.withGlobal)(global);
|
|
21706
22117
|
}
|
|
21707
22118
|
}
|
|
22119
|
+
function getTypeName(value) {
|
|
22120
|
+
return Object.prototype.toString.call(value).slice(8, -1);
|
|
22121
|
+
}
|
|
22122
|
+
function mockObject_isPlainObject(value) {
|
|
22123
|
+
if (!value || 'object' != typeof value) return false;
|
|
22124
|
+
const type = getTypeName(value);
|
|
22125
|
+
return 'Object' === type || 'Module' === type;
|
|
22126
|
+
}
|
|
22127
|
+
function isFunction(value) {
|
|
22128
|
+
return 'function' == typeof value;
|
|
22129
|
+
}
|
|
22130
|
+
function isBuiltinReadonly(target, prop) {
|
|
22131
|
+
const builtinFunctionProps = [
|
|
22132
|
+
'arguments',
|
|
22133
|
+
'callee',
|
|
22134
|
+
'caller',
|
|
22135
|
+
'length',
|
|
22136
|
+
'name'
|
|
22137
|
+
];
|
|
22138
|
+
const builtinRegExpProps = [
|
|
22139
|
+
'source',
|
|
22140
|
+
'global',
|
|
22141
|
+
'flags'
|
|
22142
|
+
];
|
|
22143
|
+
const type = getTypeName(target);
|
|
22144
|
+
if (builtinFunctionProps.includes(prop)) return 'Function' === type || 'AsyncFunction' === type;
|
|
22145
|
+
if (builtinRegExpProps.includes(prop)) return 'RegExp' === type;
|
|
22146
|
+
return false;
|
|
22147
|
+
}
|
|
22148
|
+
function collectPrototypeMethods(proto) {
|
|
22149
|
+
const methods = [];
|
|
22150
|
+
let current = proto;
|
|
22151
|
+
while(current && current !== Object.prototype){
|
|
22152
|
+
for (const key of [
|
|
22153
|
+
...Object.getOwnPropertyNames(current),
|
|
22154
|
+
...Object.getOwnPropertySymbols(current)
|
|
22155
|
+
]){
|
|
22156
|
+
if ('constructor' === key) continue;
|
|
22157
|
+
const descriptor = Object.getOwnPropertyDescriptor(current, key);
|
|
22158
|
+
if (descriptor?.value && 'function' == typeof descriptor.value) methods.push(key);
|
|
22159
|
+
}
|
|
22160
|
+
current = Object.getPrototypeOf(current);
|
|
22161
|
+
}
|
|
22162
|
+
return methods;
|
|
22163
|
+
}
|
|
22164
|
+
function getEnumerableProperties(obj, constructors) {
|
|
22165
|
+
const props = new Set();
|
|
22166
|
+
const isModule = 'Module' === getTypeName(obj) || obj.__esModule;
|
|
22167
|
+
if (isModule) {
|
|
22168
|
+
for (const k of Object.getOwnPropertyNames(obj))props.add(k);
|
|
22169
|
+
for (const k of Object.getOwnPropertySymbols(obj))props.add(k);
|
|
22170
|
+
return [
|
|
22171
|
+
...props
|
|
22172
|
+
];
|
|
22173
|
+
}
|
|
22174
|
+
const builtinPrototypes = [
|
|
22175
|
+
constructors.Object.prototype,
|
|
22176
|
+
constructors.Function.prototype,
|
|
22177
|
+
constructors.Array.prototype,
|
|
22178
|
+
constructors.Map.prototype,
|
|
22179
|
+
constructors.RegExp.prototype
|
|
22180
|
+
];
|
|
22181
|
+
let current = obj;
|
|
22182
|
+
while(current && !builtinPrototypes.includes(current)){
|
|
22183
|
+
for (const key of [
|
|
22184
|
+
...Object.getOwnPropertyNames(current),
|
|
22185
|
+
...Object.getOwnPropertySymbols(current)
|
|
22186
|
+
])if ('constructor' !== key) props.add(key);
|
|
22187
|
+
current = Object.getPrototypeOf(current);
|
|
22188
|
+
}
|
|
22189
|
+
return [
|
|
22190
|
+
...props
|
|
22191
|
+
];
|
|
22192
|
+
}
|
|
22193
|
+
function mockObject(options, object, mockExports = {}) {
|
|
22194
|
+
const { createMockInstance, globalConstructors, type } = options;
|
|
22195
|
+
const isSpyMode = 'autospy' === type;
|
|
22196
|
+
const processedRefs = new WeakMap();
|
|
22197
|
+
const deferredAssignments = [];
|
|
22198
|
+
const createFunctionMock = (fn)=>{
|
|
22199
|
+
const prototypeMembers = fn.prototype ? collectPrototypeMethods(fn.prototype) : [];
|
|
22200
|
+
return createMockInstance({
|
|
22201
|
+
name: fn.name,
|
|
22202
|
+
prototypeMembers,
|
|
22203
|
+
originalImplementation: isSpyMode ? fn : void 0,
|
|
22204
|
+
keepMembersImplementation: isSpyMode
|
|
22205
|
+
});
|
|
22206
|
+
};
|
|
22207
|
+
const processValue = (value)=>{
|
|
22208
|
+
if (null == value) return value;
|
|
22209
|
+
if ('object' != typeof value && 'function' != typeof value) return value;
|
|
22210
|
+
if (value._isMockFunction) return value;
|
|
22211
|
+
if ('object' == typeof value && processedRefs.has(value)) return processedRefs.get(value);
|
|
22212
|
+
if (isFunction(value)) {
|
|
22213
|
+
const mock = createFunctionMock(value);
|
|
22214
|
+
processProperties(value, mock);
|
|
22215
|
+
return mock;
|
|
22216
|
+
}
|
|
22217
|
+
if (Array.isArray(value)) {
|
|
22218
|
+
if (!isSpyMode) return [];
|
|
22219
|
+
return value.map(processValue);
|
|
22220
|
+
}
|
|
22221
|
+
if (mockObject_isPlainObject(value)) {
|
|
22222
|
+
const result = {};
|
|
22223
|
+
processedRefs.set(value, result);
|
|
22224
|
+
processProperties(value, result);
|
|
22225
|
+
return result;
|
|
22226
|
+
}
|
|
22227
|
+
return value;
|
|
22228
|
+
};
|
|
22229
|
+
const processProperties = (source, target)=>{
|
|
22230
|
+
const props = getEnumerableProperties(source, globalConstructors);
|
|
22231
|
+
const isModule = 'Module' === getTypeName(source) || source.__esModule;
|
|
22232
|
+
for (const prop of props){
|
|
22233
|
+
if (isBuiltinReadonly(source, prop)) continue;
|
|
22234
|
+
const descriptor = Object.getOwnPropertyDescriptor(source, prop);
|
|
22235
|
+
if (!descriptor) continue;
|
|
22236
|
+
if (!isModule && descriptor.get) {
|
|
22237
|
+
try {
|
|
22238
|
+
if (isSpyMode) Object.defineProperty(target, prop, descriptor);
|
|
22239
|
+
else Object.defineProperty(target, prop, {
|
|
22240
|
+
configurable: descriptor.configurable,
|
|
22241
|
+
enumerable: descriptor.enumerable,
|
|
22242
|
+
get: ()=>void 0,
|
|
22243
|
+
set: descriptor.set ? ()=>{} : void 0
|
|
22244
|
+
});
|
|
22245
|
+
} catch {}
|
|
22246
|
+
continue;
|
|
22247
|
+
}
|
|
22248
|
+
const value = source[prop];
|
|
22249
|
+
if (value && 'object' == typeof value && processedRefs.has(value)) {
|
|
22250
|
+
deferredAssignments.push(()=>{
|
|
22251
|
+
target[prop] = processedRefs.get(value);
|
|
22252
|
+
});
|
|
22253
|
+
continue;
|
|
22254
|
+
}
|
|
22255
|
+
try {
|
|
22256
|
+
target[prop] = processValue(value);
|
|
22257
|
+
} catch {}
|
|
22258
|
+
}
|
|
22259
|
+
};
|
|
22260
|
+
processedRefs.set(object, mockExports);
|
|
22261
|
+
processProperties(object, mockExports);
|
|
22262
|
+
for (const assign of deferredAssignments)assign();
|
|
22263
|
+
return mockExports;
|
|
22264
|
+
}
|
|
21708
22265
|
const spy_isMockFunction = (fn)=>'function' == typeof fn && '_isMockFunction' in fn && fn._isMockFunction;
|
|
21709
22266
|
const initSpy = ()=>{
|
|
21710
22267
|
let callOrder = 0;
|
|
@@ -21843,11 +22400,46 @@ const initSpy = ()=>{
|
|
|
21843
22400
|
} : methodName;
|
|
21844
22401
|
return wrapSpy(obj, method);
|
|
21845
22402
|
};
|
|
22403
|
+
const createMockInstance = (options)=>{
|
|
22404
|
+
const { name, originalImplementation, prototypeMembers = [], keepMembersImplementation = false } = options || {};
|
|
22405
|
+
const mockName = name ? String(name) : 'rstest.fn()';
|
|
22406
|
+
const isClass = originalImplementation && /^class\s/.test(Function.prototype.toString.call(originalImplementation));
|
|
22407
|
+
if (isClass && originalImplementation) {
|
|
22408
|
+
const classWrapper = function(...args) {
|
|
22409
|
+
const instance = Reflect.construct(originalImplementation, args, new.target || originalImplementation);
|
|
22410
|
+
if (keepMembersImplementation && prototypeMembers.length > 0) for (const memberName of prototypeMembers){
|
|
22411
|
+
const originalMethod = instance[memberName];
|
|
22412
|
+
if ('function' == typeof originalMethod) {
|
|
22413
|
+
const methodSpy = wrapSpy(instance, memberName, originalMethod.bind(instance));
|
|
22414
|
+
instance[memberName] = methodSpy;
|
|
22415
|
+
}
|
|
22416
|
+
}
|
|
22417
|
+
return instance;
|
|
22418
|
+
};
|
|
22419
|
+
Object.defineProperty(classWrapper, 'name', {
|
|
22420
|
+
value: mockName,
|
|
22421
|
+
configurable: true
|
|
22422
|
+
});
|
|
22423
|
+
classWrapper.prototype = originalImplementation.prototype;
|
|
22424
|
+
const mock = wrapSpy({
|
|
22425
|
+
[mockName]: classWrapper
|
|
22426
|
+
}, mockName, classWrapper);
|
|
22427
|
+
Object.setPrototypeOf(mock, Function.prototype);
|
|
22428
|
+
mock.prototype = originalImplementation.prototype;
|
|
22429
|
+
return mock;
|
|
22430
|
+
}
|
|
22431
|
+
const mock = wrapSpy({
|
|
22432
|
+
[mockName]: originalImplementation
|
|
22433
|
+
}, mockName, originalImplementation);
|
|
22434
|
+
if (prototypeMembers.length > 0 && originalImplementation?.prototype) Object.setPrototypeOf(mock.prototype, originalImplementation.prototype);
|
|
22435
|
+
return mock;
|
|
22436
|
+
};
|
|
21846
22437
|
return {
|
|
21847
22438
|
isMockFunction: spy_isMockFunction,
|
|
21848
22439
|
spyOn,
|
|
21849
22440
|
fn,
|
|
21850
|
-
mocks
|
|
22441
|
+
mocks,
|
|
22442
|
+
createMockInstance
|
|
21851
22443
|
};
|
|
21852
22444
|
};
|
|
21853
22445
|
var utilities_process = __webpack_require__("../../node_modules/.pnpm/process@0.11.10/node_modules/process/browser.js");
|
|
@@ -21862,11 +22454,25 @@ const createRstestUtilities = async (workerState)=>{
|
|
|
21862
22454
|
});
|
|
21863
22455
|
return _timers;
|
|
21864
22456
|
};
|
|
21865
|
-
const { fn, spyOn, isMockFunction, mocks } = initSpy();
|
|
22457
|
+
const { fn, spyOn, isMockFunction, mocks, createMockInstance } = initSpy();
|
|
21866
22458
|
const rstest = {
|
|
21867
22459
|
fn,
|
|
21868
22460
|
spyOn,
|
|
21869
22461
|
isMockFunction,
|
|
22462
|
+
mockObject: (value, options)=>mockObject({
|
|
22463
|
+
globalConstructors: {
|
|
22464
|
+
Object,
|
|
22465
|
+
Function,
|
|
22466
|
+
Array,
|
|
22467
|
+
Map,
|
|
22468
|
+
RegExp
|
|
22469
|
+
},
|
|
22470
|
+
createMockInstance,
|
|
22471
|
+
type: options?.spy ? 'autospy' : 'automock'
|
|
22472
|
+
}, {
|
|
22473
|
+
value
|
|
22474
|
+
}, {}).value,
|
|
22475
|
+
mocked: (item)=>item,
|
|
21870
22476
|
clearAllMocks: ()=>{
|
|
21871
22477
|
for (const mock of mocks)mock.mockClear();
|
|
21872
22478
|
return rstest;
|
|
@@ -22067,5 +22673,3 @@ const rs = wrapRstestUtilitiesAPI('rs');
|
|
|
22067
22673
|
const onTestFinished = wrapRstestAPI('onTestFinished');
|
|
22068
22674
|
const onTestFailed = wrapRstestAPI('onTestFailed');
|
|
22069
22675
|
export { afterAll, afterEach, beforeAll, beforeEach, createRstestRuntime, globalApis, onTestFailed, onTestFinished, public_assert as assert, public_describe as describe, public_expect as expect, public_it as it, public_rstest as rstest, public_test as test, rs, setRealTimers };
|
|
22070
|
-
|
|
22071
|
-
//# sourceMappingURL=389.js.map
|