@rstest/core 0.0.1 → 0.0.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 +658 -0
- package/dist/202.js +365 -0
- package/dist/353.js +1 -1
- package/dist/81.js +1467 -0
- package/dist/813.js +4 -3
- package/dist/{773.js → 867.js} +188 -163
- package/dist/973.js +0 -72
- package/dist/992.js +18 -11
- package/dist/cli.js +127 -118
- package/dist/worker.js +306 -166
- package/dist-types/node.d.ts +1 -2
- package/dist-types/public.d.ts +95 -3
- package/dist-types/worker.d.ts +1 -2
- package/package.json +30 -11
package/dist/992.js
CHANGED
|
@@ -37,10 +37,6 @@ export const __webpack_modules__ = {
|
|
|
37
37
|
...setupFiles
|
|
38
38
|
};
|
|
39
39
|
};
|
|
40
|
-
config.watchOptions ??= {};
|
|
41
|
-
config.watchOptions.ignored = (0, utils.XQ)(config.watchOptions.ignored || []);
|
|
42
|
-
if (0 === config.watchOptions.ignored.length) config.watchOptions.ignored.push('**/.git', '**/node_modules');
|
|
43
|
-
config.watchOptions.ignored.push(utils.f1);
|
|
44
40
|
} else {
|
|
45
41
|
const sourceEntries = await globTestSourceEntries();
|
|
46
42
|
config.entry = {
|
|
@@ -48,6 +44,10 @@ export const __webpack_modules__ = {
|
|
|
48
44
|
...setupFiles
|
|
49
45
|
};
|
|
50
46
|
}
|
|
47
|
+
config.watchOptions ??= {};
|
|
48
|
+
config.watchOptions.ignored = (0, utils.XQ)(config.watchOptions.ignored || []);
|
|
49
|
+
if (0 === config.watchOptions.ignored.length) config.watchOptions.ignored.push('**/.git', '**/node_modules');
|
|
50
|
+
config.watchOptions.ignored.push(utils.f1);
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
53
|
});
|
|
@@ -80,7 +80,6 @@ export const __webpack_modules__ = {
|
|
|
80
80
|
const doExternal = (externalPath = request)=>{
|
|
81
81
|
callback(void 0, externalPath, 'commonjs' === dependencyType ? 'commonjs' : 'module-import');
|
|
82
82
|
};
|
|
83
|
-
if (/node_modules/.test(request)) return doExternal();
|
|
84
83
|
const resolver = getResolve?.();
|
|
85
84
|
if (!resolver) return callback();
|
|
86
85
|
resolver(context, request, (err, resolvePath)=>{
|
|
@@ -90,7 +89,7 @@ export const __webpack_modules__ = {
|
|
|
90
89
|
});
|
|
91
90
|
};
|
|
92
91
|
const prepareRsbuild = async (context, globTestSourceEntries, setupFiles)=>{
|
|
93
|
-
const { command, normalizedConfig: { name, plugins, resolve, source, output, tools } } = context;
|
|
92
|
+
const { command, normalizedConfig: { name, plugins, resolve, source, output, tools, testEnvironment } } = context;
|
|
94
93
|
core_.logger.level = (0, utils.L1)() ? 'verbose' : 'error';
|
|
95
94
|
const writeToDisk = 'true' === process.env.DEBUG_RSTEST_OUTPUTS;
|
|
96
95
|
const rsbuildInstance = await (0, core_.createRsbuild)({
|
|
@@ -112,9 +111,7 @@ export const __webpack_modules__ = {
|
|
|
112
111
|
},
|
|
113
112
|
source: {
|
|
114
113
|
define: {
|
|
115
|
-
'import.meta.rstest': "global['@rstest/core']"
|
|
116
|
-
'import.meta.dirname': '__dirname',
|
|
117
|
-
'import.meta.filename': '__filename'
|
|
114
|
+
'import.meta.rstest': "global['@rstest/core']"
|
|
118
115
|
}
|
|
119
116
|
},
|
|
120
117
|
output: {
|
|
@@ -129,7 +126,7 @@ export const __webpack_modules__ = {
|
|
|
129
126
|
{
|
|
130
127
|
'@rstest/core': 'global @rstest/core'
|
|
131
128
|
},
|
|
132
|
-
autoExternalNodeModules
|
|
129
|
+
'node' === testEnvironment ? autoExternalNodeModules : {}
|
|
133
130
|
],
|
|
134
131
|
target: 'node'
|
|
135
132
|
},
|
|
@@ -141,6 +138,9 @@ export const __webpack_modules__ = {
|
|
|
141
138
|
node: true
|
|
142
139
|
};
|
|
143
140
|
config.output.devtoolModuleFilenameTemplate = '[absolute-resource-path]';
|
|
141
|
+
config.plugins.push(new core_.rspack.RstestPlugin({
|
|
142
|
+
injectModulePathName: true
|
|
143
|
+
}));
|
|
144
144
|
config.module.parser ??= {};
|
|
145
145
|
config.module.parser.javascript = {
|
|
146
146
|
importDynamic: false,
|
|
@@ -148,6 +148,12 @@ export const __webpack_modules__ = {
|
|
|
148
148
|
requireAsExpression: false,
|
|
149
149
|
...config.module.parser.javascript || {}
|
|
150
150
|
};
|
|
151
|
+
if ('node' === testEnvironment && ((0, utils.mP)()[0] || 0) < 20) {
|
|
152
|
+
config.resolve ??= {};
|
|
153
|
+
config.resolve.mainFields = config.resolve.mainFields?.filter((filed)=>'module' !== filed) || [
|
|
154
|
+
'main'
|
|
155
|
+
];
|
|
156
|
+
}
|
|
151
157
|
config.optimization = {
|
|
152
158
|
...config.optimization || {},
|
|
153
159
|
moduleIds: 'named',
|
|
@@ -383,7 +389,8 @@ export const __webpack_modules__ = {
|
|
|
383
389
|
...poolOptions?.execArgv ?? [],
|
|
384
390
|
...execArgv,
|
|
385
391
|
'--experimental-vm-modules',
|
|
386
|
-
'--experimental-import-meta-resolve'
|
|
392
|
+
'--experimental-import-meta-resolve',
|
|
393
|
+
'--no-warnings'
|
|
387
394
|
],
|
|
388
395
|
env: {
|
|
389
396
|
NODE_ENV: 'test',
|
package/dist/cli.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import node_process from "node:process";
|
|
2
|
+
import node_tty from "node:tty";
|
|
2
3
|
import * as __WEBPACK_EXTERNAL_MODULE__rsbuild_core_1b356efc__ from "@rsbuild/core";
|
|
3
4
|
import * as __WEBPACK_EXTERNAL_MODULE__vitest_snapshot_manager_ed2bcef6__ from "@vitest/snapshot/manager";
|
|
4
5
|
import * as __WEBPACK_EXTERNAL_MODULE_birpc__ from "birpc";
|
|
@@ -11,12 +12,10 @@ import * as __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__ from "node:path";
|
|
|
11
12
|
import * as __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__ from "node:url";
|
|
12
13
|
import * as __WEBPACK_EXTERNAL_MODULE_node_util_1b29d436__ from "node:util";
|
|
13
14
|
import * as __WEBPACK_EXTERNAL_MODULE_node_v8_d0df5498__ from "node:v8";
|
|
14
|
-
import * as __WEBPACK_EXTERNAL_MODULE_os__ from "os";
|
|
15
15
|
import * as __WEBPACK_EXTERNAL_MODULE_path__ from "path";
|
|
16
16
|
import * as __WEBPACK_EXTERNAL_MODULE_pathe__ from "pathe";
|
|
17
17
|
import * as __WEBPACK_EXTERNAL_MODULE_std_env_1c7b8267__ from "std-env";
|
|
18
18
|
import * as __WEBPACK_EXTERNAL_MODULE_tinypool__ from "tinypool";
|
|
19
|
-
import * as __WEBPACK_EXTERNAL_MODULE_tty__ from "tty";
|
|
20
19
|
import { EventEmitter } from "events";
|
|
21
20
|
var __webpack_modules__ = {
|
|
22
21
|
"../../node_modules/.pnpm/fdir@6.4.4_picomatch@4.0.2/node_modules/fdir/dist/api/async.js": function(__unused_webpack_module, exports, __webpack_require__) {
|
|
@@ -2227,7 +2226,8 @@ var __webpack_modules__ = {
|
|
|
2227
2226
|
],
|
|
2228
2227
|
exclude: [
|
|
2229
2228
|
'**/node_modules/**',
|
|
2230
|
-
'**/dist/**'
|
|
2229
|
+
'**/dist/**',
|
|
2230
|
+
'**/.{idea,git,cache,output,temp}/**'
|
|
2231
2231
|
],
|
|
2232
2232
|
includeSource: [],
|
|
2233
2233
|
pool: {
|
|
@@ -2296,6 +2296,7 @@ var __webpack_modules__ = {
|
|
|
2296
2296
|
Yz: ()=>getTaskNameWithPrefix,
|
|
2297
2297
|
Z: ()=>formatError,
|
|
2298
2298
|
ZY: ()=>getAbsolutePath,
|
|
2299
|
+
mP: ()=>getNodeVersion,
|
|
2299
2300
|
v8: ()=>serializableConfig
|
|
2300
2301
|
});
|
|
2301
2302
|
var pathe__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("pathe");
|
|
@@ -2353,6 +2354,11 @@ var __webpack_modules__ = {
|
|
|
2353
2354
|
testNamePattern: testNamePattern && 'string' != typeof testNamePattern ? wrapRegex(testNamePattern) : testNamePattern
|
|
2354
2355
|
};
|
|
2355
2356
|
};
|
|
2357
|
+
const getNodeVersion = ()=>'string' == typeof process.versions?.node ? process.versions.node.split('.').map(Number) : [
|
|
2358
|
+
0,
|
|
2359
|
+
0,
|
|
2360
|
+
0
|
|
2361
|
+
];
|
|
2356
2362
|
},
|
|
2357
2363
|
"./src/utils/index.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
2358
2364
|
__webpack_require__.d(__webpack_exports__, {
|
|
@@ -2362,6 +2368,7 @@ var __webpack_modules__ = {
|
|
|
2362
2368
|
aA: ()=>getSetupFiles,
|
|
2363
2369
|
kg: ()=>logger.k,
|
|
2364
2370
|
Io: ()=>constants.Io,
|
|
2371
|
+
mP: ()=>helper.mP,
|
|
2365
2372
|
Ps: ()=>formatTestPath,
|
|
2366
2373
|
XQ: ()=>helper.XQ,
|
|
2367
2374
|
$_: ()=>helper.$_,
|
|
@@ -2446,26 +2453,32 @@ var __webpack_modules__ = {
|
|
|
2446
2453
|
"./src/utils/logger.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
2447
2454
|
__webpack_require__.d(__webpack_exports__, {
|
|
2448
2455
|
L: ()=>isDebug,
|
|
2449
|
-
k: ()=>
|
|
2456
|
+
k: ()=>src_logger
|
|
2450
2457
|
});
|
|
2451
|
-
var
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
const prefix = flag.startsWith("-") ? "" : 1 === flag.length ? "-" : "--";
|
|
2458
|
+
var external_node_os_ = __webpack_require__("node:os");
|
|
2459
|
+
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : node_process.argv) {
|
|
2460
|
+
const prefix = flag.startsWith('-') ? '' : 1 === flag.length ? '-' : '--';
|
|
2455
2461
|
const position = argv.indexOf(prefix + flag);
|
|
2456
|
-
const terminatorPosition = argv.indexOf(
|
|
2462
|
+
const terminatorPosition = argv.indexOf('--');
|
|
2457
2463
|
return -1 !== position && (-1 === terminatorPosition || position < terminatorPosition);
|
|
2458
2464
|
}
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
if (hasFlag(
|
|
2462
|
-
else if (hasFlag(
|
|
2465
|
+
const { env } = node_process;
|
|
2466
|
+
let flagForceColor;
|
|
2467
|
+
if (hasFlag('no-color') || hasFlag('no-colors') || hasFlag('color=false') || hasFlag('color=never')) flagForceColor = 0;
|
|
2468
|
+
else if (hasFlag('color') || hasFlag('colors') || hasFlag('color=true') || hasFlag('color=always')) flagForceColor = 1;
|
|
2463
2469
|
function envForceColor() {
|
|
2464
|
-
if (
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2470
|
+
if (!('FORCE_COLOR' in env)) return;
|
|
2471
|
+
if ('true' === env.FORCE_COLOR) return 1;
|
|
2472
|
+
if ('false' === env.FORCE_COLOR) return 0;
|
|
2473
|
+
if (0 === env.FORCE_COLOR.length) return 1;
|
|
2474
|
+
const level = Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
|
2475
|
+
if (![
|
|
2476
|
+
0,
|
|
2477
|
+
1,
|
|
2478
|
+
2,
|
|
2479
|
+
3
|
|
2480
|
+
].includes(level)) return;
|
|
2481
|
+
return level;
|
|
2469
2482
|
}
|
|
2470
2483
|
function translateLevel(level) {
|
|
2471
2484
|
if (0 === level) return false;
|
|
@@ -2482,45 +2495,48 @@ var __webpack_modules__ = {
|
|
|
2482
2495
|
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
|
|
2483
2496
|
if (0 === forceColor) return 0;
|
|
2484
2497
|
if (sniffFlags) {
|
|
2485
|
-
if (hasFlag(
|
|
2486
|
-
if (hasFlag(
|
|
2498
|
+
if (hasFlag('color=16m') || hasFlag('color=full') || hasFlag('color=truecolor')) return 3;
|
|
2499
|
+
if (hasFlag('color=256')) return 2;
|
|
2487
2500
|
}
|
|
2488
|
-
if (
|
|
2501
|
+
if ('TF_BUILD' in env && 'AGENT_NAME' in env) return 1;
|
|
2489
2502
|
if (haveStream && !streamIsTTY && void 0 === forceColor) return 0;
|
|
2490
2503
|
const min = forceColor || 0;
|
|
2491
|
-
if (
|
|
2492
|
-
if (
|
|
2493
|
-
const osRelease =
|
|
2504
|
+
if ('dumb' === env.TERM) return min;
|
|
2505
|
+
if ('win32' === node_process.platform) {
|
|
2506
|
+
const osRelease = external_node_os_["default"].release().split('.');
|
|
2494
2507
|
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
2495
2508
|
return 1;
|
|
2496
2509
|
}
|
|
2497
|
-
if (
|
|
2498
|
-
if (
|
|
2510
|
+
if ('CI' in env) {
|
|
2511
|
+
if ([
|
|
2512
|
+
'GITHUB_ACTIONS',
|
|
2513
|
+
'GITEA_ACTIONS',
|
|
2514
|
+
'CIRCLECI'
|
|
2515
|
+
].some((key)=>key in env)) return 3;
|
|
2499
2516
|
if ([
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
].some((sign)=>sign in env) || "codeship" === env.CI_NAME) return 1;
|
|
2517
|
+
'TRAVIS',
|
|
2518
|
+
'APPVEYOR',
|
|
2519
|
+
'GITLAB_CI',
|
|
2520
|
+
'BUILDKITE',
|
|
2521
|
+
'DRONE'
|
|
2522
|
+
].some((sign)=>sign in env) || 'codeship' === env.CI_NAME) return 1;
|
|
2507
2523
|
return min;
|
|
2508
2524
|
}
|
|
2509
|
-
if (
|
|
2510
|
-
if (
|
|
2511
|
-
if (
|
|
2512
|
-
if (
|
|
2513
|
-
const version = Number.parseInt((env.TERM_PROGRAM_VERSION ||
|
|
2525
|
+
if ('TEAMCITY_VERSION' in env) return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
2526
|
+
if ('truecolor' === env.COLORTERM) return 3;
|
|
2527
|
+
if ('xterm-kitty' === env.TERM) return 3;
|
|
2528
|
+
if ('TERM_PROGRAM' in env) {
|
|
2529
|
+
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
|
|
2514
2530
|
switch(env.TERM_PROGRAM){
|
|
2515
|
-
case
|
|
2531
|
+
case 'iTerm.app':
|
|
2516
2532
|
return version >= 3 ? 3 : 2;
|
|
2517
|
-
case
|
|
2533
|
+
case 'Apple_Terminal':
|
|
2518
2534
|
return 2;
|
|
2519
2535
|
}
|
|
2520
2536
|
}
|
|
2521
2537
|
if (/-256(color)?$/i.test(env.TERM)) return 2;
|
|
2522
2538
|
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) return 1;
|
|
2523
|
-
if (
|
|
2539
|
+
if ('COLORTERM' in env) return 1;
|
|
2524
2540
|
return min;
|
|
2525
2541
|
}
|
|
2526
2542
|
function createSupportsColor(stream, options = {}) {
|
|
@@ -2530,49 +2546,49 @@ var __webpack_modules__ = {
|
|
|
2530
2546
|
});
|
|
2531
2547
|
return translateLevel(level);
|
|
2532
2548
|
}
|
|
2533
|
-
|
|
2549
|
+
const supportsColor = {
|
|
2534
2550
|
stdout: createSupportsColor({
|
|
2535
|
-
isTTY:
|
|
2551
|
+
isTTY: node_tty.isatty(1)
|
|
2536
2552
|
}),
|
|
2537
2553
|
stderr: createSupportsColor({
|
|
2538
|
-
isTTY:
|
|
2554
|
+
isTTY: node_tty.isatty(2)
|
|
2539
2555
|
})
|
|
2540
2556
|
};
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
let string =
|
|
2557
|
+
const supports_color = supportsColor;
|
|
2558
|
+
const colorLevel = supports_color.stdout ? supports_color.stdout.level : 0;
|
|
2559
|
+
let errorStackRegExp = /at\s.*:\d+:\d+[\s\)]*$/;
|
|
2560
|
+
let anonymousErrorStackRegExp = /at\s.*\(<anonymous>\)$/;
|
|
2561
|
+
let isErrorStackMessage = (message)=>errorStackRegExp.test(message) || anonymousErrorStackRegExp.test(message);
|
|
2562
|
+
let formatter = (open, close, replace = open)=>colorLevel >= 2 ? (input)=>{
|
|
2563
|
+
let string = '' + input;
|
|
2548
2564
|
let index = string.indexOf(close, open.length);
|
|
2549
2565
|
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
2550
2566
|
} : String;
|
|
2551
|
-
|
|
2567
|
+
let replaceClose = (string, close, replace, index)=>{
|
|
2552
2568
|
let start = string.substring(0, index) + replace;
|
|
2553
2569
|
let end = string.substring(index + close.length);
|
|
2554
2570
|
let nextIndex = end.indexOf(close);
|
|
2555
2571
|
return ~nextIndex ? start + replaceClose(end, close, replace, nextIndex) : start + end;
|
|
2556
2572
|
};
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2573
|
+
const bold = formatter('\x1b[1m', '\x1b[22m', '\x1b[22m\x1b[1m');
|
|
2574
|
+
const red = formatter('\x1b[31m', '\x1b[39m');
|
|
2575
|
+
const green = formatter('\x1b[32m', '\x1b[39m');
|
|
2576
|
+
const yellow = formatter('\x1b[33m', '\x1b[39m');
|
|
2577
|
+
const magenta = formatter('\x1b[35m', '\x1b[39m');
|
|
2578
|
+
const cyan = formatter('\x1b[36m', '\x1b[39m');
|
|
2579
|
+
const gray = formatter('\x1b[90m', '\x1b[39m');
|
|
2580
|
+
let startColor = [
|
|
2565
2581
|
189,
|
|
2566
2582
|
255,
|
|
2567
2583
|
243
|
|
2568
2584
|
];
|
|
2569
|
-
|
|
2585
|
+
let endColor = [
|
|
2570
2586
|
74,
|
|
2571
2587
|
194,
|
|
2572
2588
|
154
|
|
2573
2589
|
];
|
|
2574
|
-
|
|
2575
|
-
|
|
2590
|
+
let isWord = (char)=>!/[\s\n]/.test(char);
|
|
2591
|
+
let gradient = (message)=>{
|
|
2576
2592
|
if (colorLevel < 3) return 2 === colorLevel ? bold(cyan(message)) : message;
|
|
2577
2593
|
let chars = [
|
|
2578
2594
|
...message
|
|
@@ -2584,106 +2600,106 @@ var __webpack_modules__ = {
|
|
|
2584
2600
|
let rStep = (endColor[0] - r) / steps;
|
|
2585
2601
|
let gStep = (endColor[1] - g) / steps;
|
|
2586
2602
|
let bStep = (endColor[2] - b) / steps;
|
|
2587
|
-
let output =
|
|
2603
|
+
let output = '';
|
|
2588
2604
|
for (let char of chars){
|
|
2589
2605
|
if (isWord(char)) {
|
|
2590
2606
|
r += rStep;
|
|
2591
2607
|
g += gStep;
|
|
2592
2608
|
b += bStep;
|
|
2593
2609
|
}
|
|
2594
|
-
output += `\
|
|
2610
|
+
output += `\x1b[38;2;${Math.round(r)};${Math.round(g)};${Math.round(b)}m${char}\x1b[39m`;
|
|
2595
2611
|
}
|
|
2596
2612
|
return bold(output);
|
|
2597
2613
|
};
|
|
2598
|
-
|
|
2614
|
+
let LOG_LEVEL = {
|
|
2615
|
+
silent: -1,
|
|
2599
2616
|
error: 0,
|
|
2600
2617
|
warn: 1,
|
|
2601
2618
|
info: 2,
|
|
2602
|
-
log:
|
|
2603
|
-
verbose:
|
|
2619
|
+
log: 2,
|
|
2620
|
+
verbose: 3
|
|
2604
2621
|
};
|
|
2605
|
-
|
|
2622
|
+
let LOG_TYPES = {
|
|
2606
2623
|
error: {
|
|
2607
|
-
label:
|
|
2608
|
-
level:
|
|
2624
|
+
label: 'error',
|
|
2625
|
+
level: 'error',
|
|
2609
2626
|
color: red
|
|
2610
2627
|
},
|
|
2611
2628
|
warn: {
|
|
2612
|
-
label:
|
|
2613
|
-
level:
|
|
2629
|
+
label: 'warn',
|
|
2630
|
+
level: 'warn',
|
|
2614
2631
|
color: yellow
|
|
2615
2632
|
},
|
|
2616
2633
|
info: {
|
|
2617
|
-
label:
|
|
2618
|
-
level:
|
|
2634
|
+
label: 'info',
|
|
2635
|
+
level: 'info',
|
|
2619
2636
|
color: cyan
|
|
2620
2637
|
},
|
|
2621
2638
|
start: {
|
|
2622
|
-
label:
|
|
2623
|
-
level:
|
|
2639
|
+
label: 'start',
|
|
2640
|
+
level: 'info',
|
|
2624
2641
|
color: cyan
|
|
2625
2642
|
},
|
|
2626
2643
|
ready: {
|
|
2627
|
-
label:
|
|
2628
|
-
level:
|
|
2644
|
+
label: 'ready',
|
|
2645
|
+
level: 'info',
|
|
2629
2646
|
color: green
|
|
2630
2647
|
},
|
|
2631
2648
|
success: {
|
|
2632
|
-
label:
|
|
2633
|
-
level:
|
|
2649
|
+
label: 'success',
|
|
2650
|
+
level: 'info',
|
|
2634
2651
|
color: green
|
|
2635
2652
|
},
|
|
2636
2653
|
log: {
|
|
2637
|
-
level:
|
|
2654
|
+
level: 'info'
|
|
2638
2655
|
},
|
|
2639
2656
|
debug: {
|
|
2640
|
-
label:
|
|
2641
|
-
level:
|
|
2657
|
+
label: 'debug',
|
|
2658
|
+
level: 'verbose',
|
|
2642
2659
|
color: magenta
|
|
2643
2660
|
}
|
|
2644
2661
|
};
|
|
2645
|
-
|
|
2646
|
-
let maxLevel = options.level ||
|
|
2662
|
+
let createLogger = (options = {})=>{
|
|
2663
|
+
let maxLevel = options.level || 'info';
|
|
2647
2664
|
let log = (type, message, ...args)=>{
|
|
2648
2665
|
if (LOG_LEVEL[LOG_TYPES[type].level] > LOG_LEVEL[maxLevel]) return;
|
|
2649
2666
|
if (null == message) return console.log();
|
|
2650
2667
|
let logType = LOG_TYPES[type];
|
|
2651
|
-
let label =
|
|
2652
|
-
let text =
|
|
2653
|
-
if (
|
|
2654
|
-
label = (logType.label ||
|
|
2668
|
+
let label = '';
|
|
2669
|
+
let text = '';
|
|
2670
|
+
if ('label' in logType) {
|
|
2671
|
+
label = (logType.label || '').padEnd(7);
|
|
2655
2672
|
label = bold(logType.color ? logType.color(label) : label);
|
|
2656
2673
|
}
|
|
2657
2674
|
if (message instanceof Error) if (message.stack) {
|
|
2658
|
-
let [name, ...rest] = message.stack.split(
|
|
2659
|
-
if (name.startsWith(
|
|
2660
|
-
text = `${name}
|
|
2661
|
-
${gray(rest.join("\n"))}`;
|
|
2675
|
+
let [name, ...rest] = message.stack.split('\n');
|
|
2676
|
+
if (name.startsWith('Error: ')) name = name.slice(7);
|
|
2677
|
+
text = `${name}\n${gray(rest.join('\n'))}`;
|
|
2662
2678
|
} else text = message.message;
|
|
2663
|
-
else if (
|
|
2664
|
-
let lines = message.split(
|
|
2665
|
-
text = lines.map((line)=>isErrorStackMessage(line) ? gray(line) : line).join(
|
|
2679
|
+
else if ('error' === logType.level && 'string' == typeof message) {
|
|
2680
|
+
let lines = message.split('\n');
|
|
2681
|
+
text = lines.map((line)=>isErrorStackMessage(line) ? gray(line) : line).join('\n');
|
|
2666
2682
|
} else text = `${message}`;
|
|
2667
2683
|
console.log(label.length ? `${label} ${text}` : text, ...args);
|
|
2668
2684
|
};
|
|
2669
|
-
let
|
|
2670
|
-
greet: (message)=>log(
|
|
2685
|
+
let logger = {
|
|
2686
|
+
greet: (message)=>log('log', gradient(message))
|
|
2671
2687
|
};
|
|
2672
2688
|
Object.keys(LOG_TYPES).forEach((key)=>{
|
|
2673
|
-
|
|
2689
|
+
logger[key] = (...args)=>log(key, ...args);
|
|
2674
2690
|
});
|
|
2675
|
-
Object.defineProperty(
|
|
2691
|
+
Object.defineProperty(logger, 'level', {
|
|
2676
2692
|
get: ()=>maxLevel,
|
|
2677
2693
|
set (val) {
|
|
2678
2694
|
maxLevel = val;
|
|
2679
2695
|
}
|
|
2680
2696
|
});
|
|
2681
|
-
|
|
2682
|
-
Object.assign(
|
|
2697
|
+
logger.override = (customLogger)=>{
|
|
2698
|
+
Object.assign(logger, customLogger);
|
|
2683
2699
|
};
|
|
2684
|
-
return
|
|
2700
|
+
return logger;
|
|
2685
2701
|
};
|
|
2686
|
-
|
|
2702
|
+
let src_logger = createLogger();
|
|
2687
2703
|
var helper = __webpack_require__("./src/utils/helper.ts");
|
|
2688
2704
|
const isDebug = ()=>{
|
|
2689
2705
|
if (!process.env.DEBUG) return false;
|
|
@@ -2695,7 +2711,7 @@ ${gray(rest.join("\n"))}`;
|
|
|
2695
2711
|
'*'
|
|
2696
2712
|
].some((key)=>values.includes(key));
|
|
2697
2713
|
};
|
|
2698
|
-
if (isDebug())
|
|
2714
|
+
if (isDebug()) src_logger.level = 'verbose';
|
|
2699
2715
|
function getTime() {
|
|
2700
2716
|
const now = new Date();
|
|
2701
2717
|
const hours = String(now.getHours()).padStart(2, '0');
|
|
@@ -2703,9 +2719,9 @@ ${gray(rest.join("\n"))}`;
|
|
|
2703
2719
|
const seconds = String(now.getSeconds()).padStart(2, '0');
|
|
2704
2720
|
return `${hours}:${minutes}:${seconds}`;
|
|
2705
2721
|
}
|
|
2706
|
-
|
|
2722
|
+
src_logger.override({
|
|
2707
2723
|
debug: (message, ...args)=>{
|
|
2708
|
-
if ('verbose' !==
|
|
2724
|
+
if ('verbose' !== src_logger.level) return;
|
|
2709
2725
|
const time = helper.$_.gray(`${getTime()}`);
|
|
2710
2726
|
console.log(` ${helper.$_.magenta('rstest')} ${time} ${message}`, ...args);
|
|
2711
2727
|
}
|
|
@@ -2747,9 +2763,6 @@ ${gray(rest.join("\n"))}`;
|
|
|
2747
2763
|
"node:v8": function(module) {
|
|
2748
2764
|
module.exports = __WEBPACK_EXTERNAL_MODULE_node_v8_d0df5498__;
|
|
2749
2765
|
},
|
|
2750
|
-
os: function(module) {
|
|
2751
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE_os__;
|
|
2752
|
-
},
|
|
2753
2766
|
path: function(module) {
|
|
2754
2767
|
module.exports = __WEBPACK_EXTERNAL_MODULE_path__;
|
|
2755
2768
|
},
|
|
@@ -2762,9 +2775,6 @@ ${gray(rest.join("\n"))}`;
|
|
|
2762
2775
|
tinypool: function(module) {
|
|
2763
2776
|
module.exports = __WEBPACK_EXTERNAL_MODULE_tinypool__;
|
|
2764
2777
|
},
|
|
2765
|
-
tty: function(module) {
|
|
2766
|
-
module.exports = __WEBPACK_EXTERNAL_MODULE_tty__;
|
|
2767
|
-
},
|
|
2768
2778
|
"../../node_modules/.pnpm/tinyglobby@0.2.14/node_modules/tinyglobby/dist/index.mjs": function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
2769
2779
|
__webpack_require__.d(__webpack_exports__, {
|
|
2770
2780
|
zA: ()=>glob
|
|
@@ -2857,7 +2867,6 @@ ${gray(rest.join("\n"))}`;
|
|
|
2857
2867
|
}
|
|
2858
2868
|
}
|
|
2859
2869
|
if (!isIgnore && props.depthOffset >= 0) {
|
|
2860
|
-
var _props$commonPath;
|
|
2861
2870
|
null != props.commonPath || (props.commonPath = parts);
|
|
2862
2871
|
const newCommonPath = [];
|
|
2863
2872
|
const length = Math.min(props.commonPath.length, parts.length);
|
|
@@ -3571,7 +3580,7 @@ function prepareCli() {
|
|
|
3571
3580
|
if (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) console.log();
|
|
3572
3581
|
}
|
|
3573
3582
|
function showRstest() {
|
|
3574
|
-
logger.k.greet(" Rstest v0.0.
|
|
3583
|
+
logger.k.greet(" Rstest v0.0.2");
|
|
3575
3584
|
logger.k.log('');
|
|
3576
3585
|
}
|
|
3577
3586
|
const applyCommonOptions = (cli)=>{
|
|
@@ -3615,7 +3624,7 @@ async function initCli(options) {
|
|
|
3615
3624
|
function setupCommands() {
|
|
3616
3625
|
const cli = dist('rstest');
|
|
3617
3626
|
cli.help();
|
|
3618
|
-
cli.version("0.0.
|
|
3627
|
+
cli.version("0.0.2");
|
|
3619
3628
|
applyCommonOptions(cli);
|
|
3620
3629
|
cli.command('[...filters]', 'run tests').action(async (filters, options)=>{
|
|
3621
3630
|
showRstest();
|