@rstest/core 0.0.1 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/992.js CHANGED
@@ -42,6 +42,9 @@ export const __webpack_modules__ = {
42
42
  if (0 === config.watchOptions.ignored.length) config.watchOptions.ignored.push('**/.git', '**/node_modules');
43
43
  config.watchOptions.ignored.push(utils.f1);
44
44
  } else {
45
+ config.watch = false;
46
+ config.watchOptions ??= {};
47
+ config.watchOptions.ignored = '**/**';
45
48
  const sourceEntries = await globTestSourceEntries();
46
49
  config.entry = {
47
50
  ...sourceEntries,
@@ -54,10 +57,7 @@ export const __webpack_modules__ = {
54
57
  class IgnoreModuleNotFoundErrorPlugin {
55
58
  apply(compiler) {
56
59
  compiler.hooks.done.tap('Rstest:IgnoreModuleNotFoundPlugin', (stats)=>{
57
- stats.compilation.errors = stats.compilation.errors.filter((error)=>{
58
- if (/Module not found/.test(error.message)) return false;
59
- return true;
60
- });
60
+ for(let i = stats.compilation.errors.length - 1; i >= 0; i--)if (/Module not found/.test(stats.compilation.errors[i].message)) stats.compilation.errors.splice(i, 1);
61
61
  });
62
62
  }
63
63
  }
@@ -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,9 +89,10 @@ 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;
94
- core_.logger.level = (0, utils.L1)() ? 'verbose' : 'error';
95
- const writeToDisk = 'true' === process.env.DEBUG_RSTEST_OUTPUTS;
92
+ const { command, normalizedConfig: { name, plugins, resolve, source, output, tools, testEnvironment } } = context;
93
+ const debugMode = (0, utils.L1)();
94
+ core_.logger.level = debugMode ? 'verbose' : 'error';
95
+ const writeToDisk = debugMode;
96
96
  const rsbuildInstance = await (0, core_.createRsbuild)({
97
97
  rsbuildConfig: {
98
98
  tools,
@@ -112,9 +112,7 @@ export const __webpack_modules__ = {
112
112
  },
113
113
  source: {
114
114
  define: {
115
- 'import.meta.rstest': "global['@rstest/core']",
116
- 'import.meta.dirname': '__dirname',
117
- 'import.meta.filename': '__filename'
115
+ 'import.meta.rstest': "global['@rstest/core']"
118
116
  }
119
117
  },
120
118
  output: {
@@ -129,7 +127,7 @@ export const __webpack_modules__ = {
129
127
  {
130
128
  '@rstest/core': 'global @rstest/core'
131
129
  },
132
- autoExternalNodeModules
130
+ 'node' === testEnvironment ? autoExternalNodeModules : {}
133
131
  ],
134
132
  target: 'node'
135
133
  },
@@ -141,6 +139,12 @@ export const __webpack_modules__ = {
141
139
  node: true
142
140
  };
143
141
  config.output.devtoolModuleFilenameTemplate = '[absolute-resource-path]';
142
+ config.plugins.push(new core_.rspack.experiments.RstestPlugin({
143
+ injectModulePathName: true,
144
+ hoistMockModule: true,
145
+ importMetaPathName: true,
146
+ manualMockRoot: context.rootPath
147
+ }));
144
148
  config.module.parser ??= {};
145
149
  config.module.parser.javascript = {
146
150
  importDynamic: false,
@@ -148,10 +152,19 @@ export const __webpack_modules__ = {
148
152
  requireAsExpression: false,
149
153
  ...config.module.parser.javascript || {}
150
154
  };
155
+ if ('node' === testEnvironment && ((0, utils.mP)()[0] || 0) < 20) {
156
+ config.resolve ??= {};
157
+ config.resolve.mainFields = config.resolve.mainFields?.filter((filed)=>'module' !== filed) || [
158
+ 'main'
159
+ ];
160
+ }
151
161
  config.optimization = {
152
162
  ...config.optimization || {},
153
163
  moduleIds: 'named',
154
164
  chunkIds: 'named',
165
+ runtimeChunk: {
166
+ name: 'runtime'
167
+ },
155
168
  splitChunks: {
156
169
  chunks: 'all',
157
170
  minSize: 0,
@@ -383,7 +396,8 @@ export const __webpack_modules__ = {
383
396
  ...poolOptions?.execArgv ?? [],
384
397
  ...execArgv,
385
398
  '--experimental-vm-modules',
386
- '--experimental-import-meta-resolve'
399
+ '--experimental-import-meta-resolve',
400
+ '--no-warnings'
387
401
  ],
388
402
  env: {
389
403
  NODE_ENV: 'test',
package/dist/cli.js CHANGED
@@ -1,4 +1,5 @@
1
- import external_process_default from "process";
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.$_,
@@ -2375,6 +2382,7 @@ var __webpack_modules__ = {
2375
2382
  });
2376
2383
  var helper = __webpack_require__("./src/utils/helper.ts");
2377
2384
  var logger = __webpack_require__("./src/utils/logger.ts");
2385
+ var external_node_fs_ = __webpack_require__("node:fs");
2378
2386
  var promises_ = __webpack_require__("node:fs/promises");
2379
2387
  var external_pathe_ = __webpack_require__("pathe");
2380
2388
  var dist = __webpack_require__("../../node_modules/.pnpm/tinyglobby@0.2.14/node_modules/tinyglobby/dist/index.mjs");
@@ -2391,6 +2399,7 @@ var __webpack_modules__ = {
2391
2399
  });
2392
2400
  };
2393
2401
  const hasInSourceTestCode = (code)=>code.includes('import.meta.rstest');
2402
+ const formatTestEntryName = (name)=>name.replace(/\.*[/\\]/g, '_').replace(/\./g, '~');
2394
2403
  const getTestEntries = async ({ include, exclude, root, fileFilters, includeSource })=>{
2395
2404
  const testFiles = await (0, dist.zA)(include, {
2396
2405
  cwd: root,
@@ -2417,18 +2426,23 @@ var __webpack_modules__ = {
2417
2426
  }));
2418
2427
  }
2419
2428
  return Object.fromEntries(filterFiles(testFiles, fileFilters, root).map((entry)=>{
2420
- const name = external_pathe_["default"].relative(root, entry);
2429
+ const relativePath = external_pathe_["default"].relative(root, entry);
2421
2430
  return [
2422
- name,
2431
+ formatTestEntryName(relativePath),
2423
2432
  entry
2424
2433
  ];
2425
2434
  }));
2426
2435
  };
2427
2436
  const getSetupFiles = (setups, rootPath)=>Object.fromEntries((0, helper.XQ)(setups).map((setupFile)=>{
2428
2437
  const setupFilePath = (0, helper.ZY)(rootPath, setupFile);
2429
- const name = external_pathe_["default"].relative(rootPath, setupFilePath);
2438
+ if (!(0, external_node_fs_.existsSync)(setupFilePath)) {
2439
+ let errorMessage = `Setup file ${helper.$_.red(setupFile)} not found`;
2440
+ if (setupFilePath !== setupFile) errorMessage += helper.$_.gray(` (resolved path: ${setupFilePath})`);
2441
+ throw errorMessage;
2442
+ }
2443
+ const relativePath = external_pathe_["default"].relative(rootPath, setupFilePath);
2430
2444
  return [
2431
- name,
2445
+ formatTestEntryName(relativePath),
2432
2446
  setupFilePath
2433
2447
  ];
2434
2448
  }));
@@ -2446,26 +2460,32 @@ var __webpack_modules__ = {
2446
2460
  "./src/utils/logger.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
2447
2461
  __webpack_require__.d(__webpack_exports__, {
2448
2462
  L: ()=>isDebug,
2449
- k: ()=>logger
2463
+ k: ()=>src_logger
2450
2464
  });
2451
- var external_os_ = __webpack_require__("os");
2452
- var external_tty_ = __webpack_require__("tty");
2453
- function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : external_process_default.argv) {
2454
- const prefix = flag.startsWith("-") ? "" : 1 === flag.length ? "-" : "--";
2465
+ var external_node_os_ = __webpack_require__("node:os");
2466
+ function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : node_process.argv) {
2467
+ const prefix = flag.startsWith('-') ? '' : 1 === flag.length ? '-' : '--';
2455
2468
  const position = argv.indexOf(prefix + flag);
2456
- const terminatorPosition = argv.indexOf("--");
2469
+ const terminatorPosition = argv.indexOf('--');
2457
2470
  return -1 !== position && (-1 === terminatorPosition || position < terminatorPosition);
2458
2471
  }
2459
- var { env } = external_process_default;
2460
- var flagForceColor;
2461
- if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) flagForceColor = 0;
2462
- else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) flagForceColor = 1;
2472
+ const { env } = node_process;
2473
+ let flagForceColor;
2474
+ if (hasFlag('no-color') || hasFlag('no-colors') || hasFlag('color=false') || hasFlag('color=never')) flagForceColor = 0;
2475
+ else if (hasFlag('color') || hasFlag('colors') || hasFlag('color=true') || hasFlag('color=always')) flagForceColor = 1;
2463
2476
  function envForceColor() {
2464
- if ("FORCE_COLOR" in env) {
2465
- if ("true" === env.FORCE_COLOR) return 1;
2466
- if ("false" === env.FORCE_COLOR) return 0;
2467
- return 0 === env.FORCE_COLOR.length ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
2468
- }
2477
+ if (!('FORCE_COLOR' in env)) return;
2478
+ if ('true' === env.FORCE_COLOR) return 1;
2479
+ if ('false' === env.FORCE_COLOR) return 0;
2480
+ if (0 === env.FORCE_COLOR.length) return 1;
2481
+ const level = Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
2482
+ if (![
2483
+ 0,
2484
+ 1,
2485
+ 2,
2486
+ 3
2487
+ ].includes(level)) return;
2488
+ return level;
2469
2489
  }
2470
2490
  function translateLevel(level) {
2471
2491
  if (0 === level) return false;
@@ -2482,45 +2502,48 @@ var __webpack_modules__ = {
2482
2502
  const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
2483
2503
  if (0 === forceColor) return 0;
2484
2504
  if (sniffFlags) {
2485
- if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) return 3;
2486
- if (hasFlag("color=256")) return 2;
2505
+ if (hasFlag('color=16m') || hasFlag('color=full') || hasFlag('color=truecolor')) return 3;
2506
+ if (hasFlag('color=256')) return 2;
2487
2507
  }
2488
- if ("TF_BUILD" in env && "AGENT_NAME" in env) return 1;
2508
+ if ('TF_BUILD' in env && 'AGENT_NAME' in env) return 1;
2489
2509
  if (haveStream && !streamIsTTY && void 0 === forceColor) return 0;
2490
2510
  const min = forceColor || 0;
2491
- if ("dumb" === env.TERM) return min;
2492
- if ("win32" === external_process_default.platform) {
2493
- const osRelease = external_os_["default"].release().split(".");
2511
+ if ('dumb' === env.TERM) return min;
2512
+ if ('win32' === node_process.platform) {
2513
+ const osRelease = external_node_os_["default"].release().split('.');
2494
2514
  if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2;
2495
2515
  return 1;
2496
2516
  }
2497
- if ("CI" in env) {
2498
- if ("GITHUB_ACTIONS" in env || "GITEA_ACTIONS" in env) return 3;
2517
+ if ('CI' in env) {
2518
+ if ([
2519
+ 'GITHUB_ACTIONS',
2520
+ 'GITEA_ACTIONS',
2521
+ 'CIRCLECI'
2522
+ ].some((key)=>key in env)) return 3;
2499
2523
  if ([
2500
- "TRAVIS",
2501
- "CIRCLECI",
2502
- "APPVEYOR",
2503
- "GITLAB_CI",
2504
- "BUILDKITE",
2505
- "DRONE"
2506
- ].some((sign)=>sign in env) || "codeship" === env.CI_NAME) return 1;
2524
+ 'TRAVIS',
2525
+ 'APPVEYOR',
2526
+ 'GITLAB_CI',
2527
+ 'BUILDKITE',
2528
+ 'DRONE'
2529
+ ].some((sign)=>sign in env) || 'codeship' === env.CI_NAME) return 1;
2507
2530
  return min;
2508
2531
  }
2509
- if ("TEAMCITY_VERSION" in env) return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
2510
- if ("truecolor" === env.COLORTERM) return 3;
2511
- if ("xterm-kitty" === env.TERM) return 3;
2512
- if ("TERM_PROGRAM" in env) {
2513
- const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
2532
+ if ('TEAMCITY_VERSION' in env) return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
2533
+ if ('truecolor' === env.COLORTERM) return 3;
2534
+ if ('xterm-kitty' === env.TERM) return 3;
2535
+ if ('TERM_PROGRAM' in env) {
2536
+ const version = Number.parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
2514
2537
  switch(env.TERM_PROGRAM){
2515
- case "iTerm.app":
2538
+ case 'iTerm.app':
2516
2539
  return version >= 3 ? 3 : 2;
2517
- case "Apple_Terminal":
2540
+ case 'Apple_Terminal':
2518
2541
  return 2;
2519
2542
  }
2520
2543
  }
2521
2544
  if (/-256(color)?$/i.test(env.TERM)) return 2;
2522
2545
  if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) return 1;
2523
- if ("COLORTERM" in env) return 1;
2546
+ if ('COLORTERM' in env) return 1;
2524
2547
  return min;
2525
2548
  }
2526
2549
  function createSupportsColor(stream, options = {}) {
@@ -2530,49 +2553,49 @@ var __webpack_modules__ = {
2530
2553
  });
2531
2554
  return translateLevel(level);
2532
2555
  }
2533
- var supportsColor = {
2556
+ const supportsColor = {
2534
2557
  stdout: createSupportsColor({
2535
- isTTY: external_tty_["default"].isatty(1)
2558
+ isTTY: node_tty.isatty(1)
2536
2559
  }),
2537
2560
  stderr: createSupportsColor({
2538
- isTTY: external_tty_["default"].isatty(2)
2561
+ isTTY: node_tty.isatty(2)
2539
2562
  })
2540
2563
  };
2541
- var supports_color_default = supportsColor;
2542
- var colorLevel = supports_color_default.stdout ? supports_color_default.stdout.level : 0;
2543
- var errorStackRegExp = /at\s.*:\d+:\d+[\s\)]*$/;
2544
- var anonymousErrorStackRegExp = /at\s.*\(<anonymous>\)$/;
2545
- var isErrorStackMessage = (message)=>errorStackRegExp.test(message) || anonymousErrorStackRegExp.test(message);
2546
- var formatter = (open, close, replace = open)=>colorLevel >= 2 ? (input)=>{
2547
- let string = "" + input;
2564
+ const supports_color = supportsColor;
2565
+ const colorLevel = supports_color.stdout ? supports_color.stdout.level : 0;
2566
+ let errorStackRegExp = /at\s.*:\d+:\d+[\s\)]*$/;
2567
+ let anonymousErrorStackRegExp = /at\s.*\(<anonymous>\)$/;
2568
+ let isErrorStackMessage = (message)=>errorStackRegExp.test(message) || anonymousErrorStackRegExp.test(message);
2569
+ let formatter = (open, close, replace = open)=>colorLevel >= 2 ? (input)=>{
2570
+ let string = '' + input;
2548
2571
  let index = string.indexOf(close, open.length);
2549
2572
  return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
2550
2573
  } : String;
2551
- var replaceClose = (string, close, replace, index)=>{
2574
+ let replaceClose = (string, close, replace, index)=>{
2552
2575
  let start = string.substring(0, index) + replace;
2553
2576
  let end = string.substring(index + close.length);
2554
2577
  let nextIndex = end.indexOf(close);
2555
2578
  return ~nextIndex ? start + replaceClose(end, close, replace, nextIndex) : start + end;
2556
2579
  };
2557
- var bold = formatter("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m");
2558
- var red = formatter("\x1B[31m", "\x1B[39m");
2559
- var green = formatter("\x1B[32m", "\x1B[39m");
2560
- var yellow = formatter("\x1B[33m", "\x1B[39m");
2561
- var magenta = formatter("\x1B[35m", "\x1B[39m");
2562
- var cyan = formatter("\x1B[36m", "\x1B[39m");
2563
- var gray = formatter("\x1B[90m", "\x1B[39m");
2564
- var startColor = [
2580
+ const bold = formatter('\x1b[1m', '\x1b[22m', '\x1b[22m\x1b[1m');
2581
+ const red = formatter('\x1b[31m', '\x1b[39m');
2582
+ const green = formatter('\x1b[32m', '\x1b[39m');
2583
+ const yellow = formatter('\x1b[33m', '\x1b[39m');
2584
+ const magenta = formatter('\x1b[35m', '\x1b[39m');
2585
+ const cyan = formatter('\x1b[36m', '\x1b[39m');
2586
+ const gray = formatter('\x1b[90m', '\x1b[39m');
2587
+ let startColor = [
2565
2588
  189,
2566
2589
  255,
2567
2590
  243
2568
2591
  ];
2569
- var endColor = [
2592
+ let endColor = [
2570
2593
  74,
2571
2594
  194,
2572
2595
  154
2573
2596
  ];
2574
- var isWord = (char)=>!/[\s\n]/.test(char);
2575
- var gradient = (message)=>{
2597
+ let isWord = (char)=>!/[\s\n]/.test(char);
2598
+ let gradient = (message)=>{
2576
2599
  if (colorLevel < 3) return 2 === colorLevel ? bold(cyan(message)) : message;
2577
2600
  let chars = [
2578
2601
  ...message
@@ -2584,106 +2607,106 @@ var __webpack_modules__ = {
2584
2607
  let rStep = (endColor[0] - r) / steps;
2585
2608
  let gStep = (endColor[1] - g) / steps;
2586
2609
  let bStep = (endColor[2] - b) / steps;
2587
- let output = "";
2610
+ let output = '';
2588
2611
  for (let char of chars){
2589
2612
  if (isWord(char)) {
2590
2613
  r += rStep;
2591
2614
  g += gStep;
2592
2615
  b += bStep;
2593
2616
  }
2594
- output += `\x1B[38;2;${Math.round(r)};${Math.round(g)};${Math.round(b)}m${char}\x1B[39m`;
2617
+ output += `\x1b[38;2;${Math.round(r)};${Math.round(g)};${Math.round(b)}m${char}\x1b[39m`;
2595
2618
  }
2596
2619
  return bold(output);
2597
2620
  };
2598
- var LOG_LEVEL = {
2621
+ let LOG_LEVEL = {
2622
+ silent: -1,
2599
2623
  error: 0,
2600
2624
  warn: 1,
2601
2625
  info: 2,
2602
- log: 3,
2603
- verbose: 4
2626
+ log: 2,
2627
+ verbose: 3
2604
2628
  };
2605
- var LOG_TYPES = {
2629
+ let LOG_TYPES = {
2606
2630
  error: {
2607
- label: "error",
2608
- level: "error",
2631
+ label: 'error',
2632
+ level: 'error',
2609
2633
  color: red
2610
2634
  },
2611
2635
  warn: {
2612
- label: "warn",
2613
- level: "warn",
2636
+ label: 'warn',
2637
+ level: 'warn',
2614
2638
  color: yellow
2615
2639
  },
2616
2640
  info: {
2617
- label: "info",
2618
- level: "info",
2641
+ label: 'info',
2642
+ level: 'info',
2619
2643
  color: cyan
2620
2644
  },
2621
2645
  start: {
2622
- label: "start",
2623
- level: "info",
2646
+ label: 'start',
2647
+ level: 'info',
2624
2648
  color: cyan
2625
2649
  },
2626
2650
  ready: {
2627
- label: "ready",
2628
- level: "info",
2651
+ label: 'ready',
2652
+ level: 'info',
2629
2653
  color: green
2630
2654
  },
2631
2655
  success: {
2632
- label: "success",
2633
- level: "info",
2656
+ label: 'success',
2657
+ level: 'info',
2634
2658
  color: green
2635
2659
  },
2636
2660
  log: {
2637
- level: "log"
2661
+ level: 'info'
2638
2662
  },
2639
2663
  debug: {
2640
- label: "debug",
2641
- level: "verbose",
2664
+ label: 'debug',
2665
+ level: 'verbose',
2642
2666
  color: magenta
2643
2667
  }
2644
2668
  };
2645
- var createLogger = (options = {})=>{
2646
- let maxLevel = options.level || "log";
2669
+ let createLogger = (options = {})=>{
2670
+ let maxLevel = options.level || 'info';
2647
2671
  let log = (type, message, ...args)=>{
2648
2672
  if (LOG_LEVEL[LOG_TYPES[type].level] > LOG_LEVEL[maxLevel]) return;
2649
2673
  if (null == message) return console.log();
2650
2674
  let logType = LOG_TYPES[type];
2651
- let label = "";
2652
- let text = "";
2653
- if ("label" in logType) {
2654
- label = (logType.label || "").padEnd(7);
2675
+ let label = '';
2676
+ let text = '';
2677
+ if ('label' in logType) {
2678
+ label = (logType.label || '').padEnd(7);
2655
2679
  label = bold(logType.color ? logType.color(label) : label);
2656
2680
  }
2657
2681
  if (message instanceof Error) if (message.stack) {
2658
- let [name, ...rest] = message.stack.split("\n");
2659
- if (name.startsWith("Error: ")) name = name.slice(7);
2660
- text = `${name}
2661
- ${gray(rest.join("\n"))}`;
2682
+ let [name, ...rest] = message.stack.split('\n');
2683
+ if (name.startsWith('Error: ')) name = name.slice(7);
2684
+ text = `${name}\n${gray(rest.join('\n'))}`;
2662
2685
  } else text = message.message;
2663
- else if ("error" === logType.level && "string" == typeof message) {
2664
- let lines = message.split("\n");
2665
- text = lines.map((line)=>isErrorStackMessage(line) ? gray(line) : line).join("\n");
2686
+ else if ('error' === logType.level && 'string' == typeof message) {
2687
+ let lines = message.split('\n');
2688
+ text = lines.map((line)=>isErrorStackMessage(line) ? gray(line) : line).join('\n');
2666
2689
  } else text = `${message}`;
2667
2690
  console.log(label.length ? `${label} ${text}` : text, ...args);
2668
2691
  };
2669
- let logger2 = {
2670
- greet: (message)=>log("log", gradient(message))
2692
+ let logger = {
2693
+ greet: (message)=>log('log', gradient(message))
2671
2694
  };
2672
2695
  Object.keys(LOG_TYPES).forEach((key)=>{
2673
- logger2[key] = (...args)=>log(key, ...args);
2696
+ logger[key] = (...args)=>log(key, ...args);
2674
2697
  });
2675
- Object.defineProperty(logger2, "level", {
2698
+ Object.defineProperty(logger, 'level', {
2676
2699
  get: ()=>maxLevel,
2677
2700
  set (val) {
2678
2701
  maxLevel = val;
2679
2702
  }
2680
2703
  });
2681
- logger2.override = (customLogger)=>{
2682
- Object.assign(logger2, customLogger);
2704
+ logger.override = (customLogger)=>{
2705
+ Object.assign(logger, customLogger);
2683
2706
  };
2684
- return logger2;
2707
+ return logger;
2685
2708
  };
2686
- var logger = createLogger();
2709
+ let src_logger = createLogger();
2687
2710
  var helper = __webpack_require__("./src/utils/helper.ts");
2688
2711
  const isDebug = ()=>{
2689
2712
  if (!process.env.DEBUG) return false;
@@ -2695,7 +2718,7 @@ ${gray(rest.join("\n"))}`;
2695
2718
  '*'
2696
2719
  ].some((key)=>values.includes(key));
2697
2720
  };
2698
- if (isDebug()) logger.level = 'verbose';
2721
+ if (isDebug()) src_logger.level = 'verbose';
2699
2722
  function getTime() {
2700
2723
  const now = new Date();
2701
2724
  const hours = String(now.getHours()).padStart(2, '0');
@@ -2703,9 +2726,9 @@ ${gray(rest.join("\n"))}`;
2703
2726
  const seconds = String(now.getSeconds()).padStart(2, '0');
2704
2727
  return `${hours}:${minutes}:${seconds}`;
2705
2728
  }
2706
- logger.override({
2729
+ src_logger.override({
2707
2730
  debug: (message, ...args)=>{
2708
- if ('verbose' !== logger.level) return;
2731
+ if ('verbose' !== src_logger.level) return;
2709
2732
  const time = helper.$_.gray(`${getTime()}`);
2710
2733
  console.log(` ${helper.$_.magenta('rstest')} ${time} ${message}`, ...args);
2711
2734
  }
@@ -2747,9 +2770,6 @@ ${gray(rest.join("\n"))}`;
2747
2770
  "node:v8": function(module) {
2748
2771
  module.exports = __WEBPACK_EXTERNAL_MODULE_node_v8_d0df5498__;
2749
2772
  },
2750
- os: function(module) {
2751
- module.exports = __WEBPACK_EXTERNAL_MODULE_os__;
2752
- },
2753
2773
  path: function(module) {
2754
2774
  module.exports = __WEBPACK_EXTERNAL_MODULE_path__;
2755
2775
  },
@@ -2762,9 +2782,6 @@ ${gray(rest.join("\n"))}`;
2762
2782
  tinypool: function(module) {
2763
2783
  module.exports = __WEBPACK_EXTERNAL_MODULE_tinypool__;
2764
2784
  },
2765
- tty: function(module) {
2766
- module.exports = __WEBPACK_EXTERNAL_MODULE_tty__;
2767
- },
2768
2785
  "../../node_modules/.pnpm/tinyglobby@0.2.14/node_modules/tinyglobby/dist/index.mjs": function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
2769
2786
  __webpack_require__.d(__webpack_exports__, {
2770
2787
  zA: ()=>glob
@@ -2857,7 +2874,6 @@ ${gray(rest.join("\n"))}`;
2857
2874
  }
2858
2875
  }
2859
2876
  if (!isIgnore && props.depthOffset >= 0) {
2860
- var _props$commonPath;
2861
2877
  null != props.commonPath || (props.commonPath = parts);
2862
2878
  const newCommonPath = [];
2863
2879
  const length = Math.min(props.commonPath.length, parts.length);
@@ -3571,7 +3587,7 @@ function prepareCli() {
3571
3587
  if (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) console.log();
3572
3588
  }
3573
3589
  function showRstest() {
3574
- logger.k.greet(" Rstest v0.0.1");
3590
+ logger.k.greet(" Rstest v0.0.3");
3575
3591
  logger.k.log('');
3576
3592
  }
3577
3593
  const applyCommonOptions = (cli)=>{
@@ -3615,7 +3631,7 @@ async function initCli(options) {
3615
3631
  function setupCommands() {
3616
3632
  const cli = dist('rstest');
3617
3633
  cli.help();
3618
- cli.version("0.0.1");
3634
+ cli.version("0.0.3");
3619
3635
  applyCommonOptions(cli);
3620
3636
  cli.command('[...filters]', 'run tests').action(async (filters, options)=>{
3621
3637
  showRstest();