@rstest/core 0.5.0 → 0.5.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/dist/index.js CHANGED
@@ -7,10 +7,11 @@ import * as __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__ from "node:fs/
7
7
  import * as __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__ from "node:module";
8
8
  import * as __WEBPACK_EXTERNAL_MODULE_node_os_74b4b876__ from "node:os";
9
9
  import * as __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__ from "node:path";
10
- import * as __WEBPACK_EXTERNAL_MODULE_node_tty_c64aab7e__ from "node:tty";
11
10
  import * as __WEBPACK_EXTERNAL_MODULE_node_process_786449bf__ from "node:process";
11
+ import * as __WEBPACK_EXTERNAL_MODULE_node_tty_c64aab7e__ from "node:tty";
12
12
  import * as __WEBPACK_EXTERNAL_MODULE_url__ from "url";
13
13
  import * as __WEBPACK_EXTERNAL_MODULE_module__ from "module";
14
+ import * as __WEBPACK_EXTERNAL_MODULE_node_util_1b29d436__ from "node:util";
14
15
  var __webpack_modules__ = {
15
16
  "../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js": function(module) {
16
17
  let p = process || {}, argv = p.argv || [], env = p.env || {};
@@ -1484,6 +1485,99 @@ var __webpack_modules__ = {
1484
1485
  return last;
1485
1486
  };
1486
1487
  },
1488
+ "../../node_modules/.pnpm/stacktrace-parser@0.1.11/node_modules/stacktrace-parser/dist/stack-trace-parser.esm.js": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
1489
+ __webpack_require__.d(__webpack_exports__, {
1490
+ q: ()=>parse
1491
+ });
1492
+ var UNKNOWN_FUNCTION = '<unknown>';
1493
+ function parse(stackString) {
1494
+ var lines = stackString.split('\n');
1495
+ return lines.reduce(function(stack, line) {
1496
+ var parseResult = parseChrome(line) || parseWinjs(line) || parseGecko(line) || parseNode(line) || parseJSC(line);
1497
+ if (parseResult) stack.push(parseResult);
1498
+ return stack;
1499
+ }, []);
1500
+ }
1501
+ var chromeRe = /^\s*at (.*?) ?\(((?:file|https?|blob|chrome-extension|native|eval|webpack|rsc|<anonymous>|\/|[a-z]:\\|\\\\).*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i;
1502
+ var chromeEvalRe = /\((\S*)(?::(\d+))(?::(\d+))\)/;
1503
+ function parseChrome(line) {
1504
+ var parts = chromeRe.exec(line);
1505
+ if (!parts) return null;
1506
+ var isNative = parts[2] && 0 === parts[2].indexOf('native');
1507
+ var isEval = parts[2] && 0 === parts[2].indexOf('eval');
1508
+ var submatch = chromeEvalRe.exec(parts[2]);
1509
+ if (isEval && null != submatch) {
1510
+ parts[2] = submatch[1];
1511
+ parts[3] = submatch[2];
1512
+ parts[4] = submatch[3];
1513
+ }
1514
+ return {
1515
+ file: isNative ? null : parts[2],
1516
+ methodName: parts[1] || UNKNOWN_FUNCTION,
1517
+ arguments: isNative ? [
1518
+ parts[2]
1519
+ ] : [],
1520
+ lineNumber: parts[3] ? +parts[3] : null,
1521
+ column: parts[4] ? +parts[4] : null
1522
+ };
1523
+ }
1524
+ var winjsRe = /^\s*at (?:((?:\[object object\])?.+) )?\(?((?:file|ms-appx|https?|webpack|rsc|blob):.*?):(\d+)(?::(\d+))?\)?\s*$/i;
1525
+ function parseWinjs(line) {
1526
+ var parts = winjsRe.exec(line);
1527
+ if (!parts) return null;
1528
+ return {
1529
+ file: parts[2],
1530
+ methodName: parts[1] || UNKNOWN_FUNCTION,
1531
+ arguments: [],
1532
+ lineNumber: +parts[3],
1533
+ column: parts[4] ? +parts[4] : null
1534
+ };
1535
+ }
1536
+ var geckoRe = /^\s*(.*?)(?:\((.*?)\))?(?:^|@)((?:file|https?|blob|chrome|webpack|rsc|resource|\[native).*?|[^@]*bundle)(?::(\d+))?(?::(\d+))?\s*$/i;
1537
+ var geckoEvalRe = /(\S+) line (\d+)(?: > eval line \d+)* > eval/i;
1538
+ function parseGecko(line) {
1539
+ var parts = geckoRe.exec(line);
1540
+ if (!parts) return null;
1541
+ var isEval = parts[3] && parts[3].indexOf(' > eval') > -1;
1542
+ var submatch = geckoEvalRe.exec(parts[3]);
1543
+ if (isEval && null != submatch) {
1544
+ parts[3] = submatch[1];
1545
+ parts[4] = submatch[2];
1546
+ parts[5] = null;
1547
+ }
1548
+ return {
1549
+ file: parts[3],
1550
+ methodName: parts[1] || UNKNOWN_FUNCTION,
1551
+ arguments: parts[2] ? parts[2].split(',') : [],
1552
+ lineNumber: parts[4] ? +parts[4] : null,
1553
+ column: parts[5] ? +parts[5] : null
1554
+ };
1555
+ }
1556
+ var javaScriptCoreRe = /^\s*(?:([^@]*)(?:\((.*?)\))?@)?(\S.*?):(\d+)(?::(\d+))?\s*$/i;
1557
+ function parseJSC(line) {
1558
+ var parts = javaScriptCoreRe.exec(line);
1559
+ if (!parts) return null;
1560
+ return {
1561
+ file: parts[3],
1562
+ methodName: parts[1] || UNKNOWN_FUNCTION,
1563
+ arguments: [],
1564
+ lineNumber: +parts[4],
1565
+ column: parts[5] ? +parts[5] : null
1566
+ };
1567
+ }
1568
+ var nodeRe = /^\s*at (?:((?:\[object object\])?[^\\/]+(?: \[as \S+\])?) )?\(?(.*?):(\d+)(?::(\d+))?\)?\s*$/i;
1569
+ function parseNode(line) {
1570
+ var parts = nodeRe.exec(line);
1571
+ if (!parts) return null;
1572
+ return {
1573
+ file: parts[2],
1574
+ methodName: parts[1] || UNKNOWN_FUNCTION,
1575
+ arguments: [],
1576
+ lineNumber: +parts[3],
1577
+ column: parts[4] ? +parts[4] : null
1578
+ };
1579
+ }
1580
+ },
1487
1581
  "./src/cli/commands.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
1488
1582
  __webpack_require__.d(__webpack_exports__, {
1489
1583
  a: ()=>runRest,
@@ -1987,12 +2081,9 @@ ${section.body}` : section.body).join("\n\n"));
1987
2081
  const runRest = async ({ options, filters, command })=>{
1988
2082
  let rstest;
1989
2083
  try {
1990
- const { initCli } = await __webpack_require__.e("223").then(__webpack_require__.bind(__webpack_require__, "./src/cli/init.ts"));
2084
+ const { initCli } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "./src/cli/init.ts"));
1991
2085
  const { config, configFilePath, projects } = await initCli(options);
1992
- const { createRstest } = await Promise.all([
1993
- __webpack_require__.e("908"),
1994
- __webpack_require__.e("876")
1995
- ]).then(__webpack_require__.bind(__webpack_require__, "./src/core/index.ts"));
2086
+ const { createRstest } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "./src/core/index.ts"));
1996
2087
  rstest = createRstest({
1997
2088
  config,
1998
2089
  configFilePath,
@@ -2017,7 +2108,7 @@ ${section.body}` : section.body).join("\n\n"));
2017
2108
  function setupCommands() {
2018
2109
  const cli = dist('rstest');
2019
2110
  cli.help();
2020
- cli.version("0.5.0");
2111
+ cli.version("0.5.2");
2021
2112
  applyCommonOptions(cli);
2022
2113
  cli.command('[...filters]', 'run tests').option('-w, --watch', 'Run tests in watch mode').action(async (filters, options)=>{
2023
2114
  (0, prepare.N)();
@@ -2050,12 +2141,9 @@ ${section.body}` : section.body).join("\n\n"));
2050
2141
  });
2051
2142
  cli.command('list [...filters]', 'lists all test files that Rstest will run').option('--filesOnly', 'only list the test files').option('--json [boolean/path]', 'print tests as JSON or write to a file').action(async (filters, options)=>{
2052
2143
  try {
2053
- const { initCli } = await __webpack_require__.e("223").then(__webpack_require__.bind(__webpack_require__, "./src/cli/init.ts"));
2144
+ const { initCli } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "./src/cli/init.ts"));
2054
2145
  const { config, configFilePath, projects } = await initCli(options);
2055
- const { createRstest } = await Promise.all([
2056
- __webpack_require__.e("908"),
2057
- __webpack_require__.e("876")
2058
- ]).then(__webpack_require__.bind(__webpack_require__, "./src/core/index.ts"));
2146
+ const { createRstest } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "./src/core/index.ts"));
2059
2147
  const rstest = createRstest({
2060
2148
  config,
2061
2149
  configFilePath,
@@ -2074,6 +2162,175 @@ ${section.body}` : section.body).join("\n\n"));
2074
2162
  cli.parse();
2075
2163
  }
2076
2164
  },
2165
+ "./src/cli/index.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
2166
+ __webpack_require__.d(__webpack_exports__, {
2167
+ G: ()=>runCLI,
2168
+ X: ()=>_init__WEBPACK_IMPORTED_MODULE_3__.initCli
2169
+ });
2170
+ var _utils_logger__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./src/utils/logger.ts");
2171
+ var _commands__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("./src/cli/commands.ts");
2172
+ var _prepare__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("./src/cli/prepare.ts");
2173
+ var _init__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("./src/cli/init.ts");
2174
+ async function runCLI() {
2175
+ (0, _prepare__WEBPACK_IMPORTED_MODULE_2__.k)();
2176
+ try {
2177
+ (0, _commands__WEBPACK_IMPORTED_MODULE_1__.Q)();
2178
+ } catch (err) {
2179
+ _utils_logger__WEBPACK_IMPORTED_MODULE_0__.vF.error('Failed to start Rstest CLI.');
2180
+ _utils_logger__WEBPACK_IMPORTED_MODULE_0__.vF.error(err);
2181
+ }
2182
+ }
2183
+ },
2184
+ "./src/cli/init.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
2185
+ __webpack_require__.d(__webpack_exports__, {
2186
+ initCli: ()=>initCli
2187
+ });
2188
+ var external_node_fs_ = __webpack_require__("node:fs");
2189
+ var pathe_M_eThtNZ = __webpack_require__("../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs");
2190
+ var dist = __webpack_require__("../../node_modules/.pnpm/tinyglobby@0.2.15/node_modules/tinyglobby/dist/index.mjs");
2191
+ var src_config = __webpack_require__("./src/config.ts");
2192
+ var utils = __webpack_require__("./src/utils/index.ts");
2193
+ async function resolveConfig(options) {
2194
+ const { content: config, filePath: configFilePath } = await (0, src_config.Z9)({
2195
+ cwd: options.root,
2196
+ path: options.config,
2197
+ configLoader: options.configLoader
2198
+ });
2199
+ const keys = [
2200
+ 'root',
2201
+ 'globals',
2202
+ 'isolate',
2203
+ 'passWithNoTests',
2204
+ 'update',
2205
+ 'testNamePattern',
2206
+ 'testTimeout',
2207
+ 'hookTimeout',
2208
+ 'clearMocks',
2209
+ 'resetMocks',
2210
+ 'restoreMocks',
2211
+ 'unstubEnvs',
2212
+ 'unstubGlobals',
2213
+ 'retry',
2214
+ 'slowTestThreshold',
2215
+ 'maxConcurrency',
2216
+ 'printConsoleTrace',
2217
+ 'disableConsoleIntercept',
2218
+ 'testEnvironment'
2219
+ ];
2220
+ for (const key of keys)if (void 0 !== options[key]) config[key] = options[key];
2221
+ if (options.reporter) config.reporters = (0, utils.bg)(options.reporter);
2222
+ if (void 0 !== options.coverage) {
2223
+ config.coverage ??= {};
2224
+ config.coverage.enabled = options.coverage;
2225
+ }
2226
+ if (options.exclude) config.exclude = (0, utils.bg)(options.exclude);
2227
+ if (options.include) config.include = (0, utils.bg)(options.include);
2228
+ return {
2229
+ config,
2230
+ configFilePath: configFilePath ?? void 0
2231
+ };
2232
+ }
2233
+ async function resolveProjects({ config, root, options }) {
2234
+ if (!config.projects) return [];
2235
+ const getDefaultProjectName = (dir)=>{
2236
+ const pkgJsonPath = (0, pathe_M_eThtNZ.r)(dir, 'package.json');
2237
+ const name = (0, external_node_fs_.existsSync)(pkgJsonPath) ? JSON.parse((0, external_node_fs_.readFileSync)(pkgJsonPath, 'utf-8')).name : '';
2238
+ if ('string' != typeof name || !name) return (0, pathe_M_eThtNZ.c)(dir);
2239
+ return name;
2240
+ };
2241
+ const globProjects = async (patterns)=>{
2242
+ const globOptions = {
2243
+ absolute: true,
2244
+ dot: true,
2245
+ onlyFiles: false,
2246
+ cwd: root,
2247
+ expandDirectories: false,
2248
+ ignore: [
2249
+ '**/node_modules/**',
2250
+ '**/.DS_Store'
2251
+ ]
2252
+ };
2253
+ return (0, dist.glob)(patterns, globOptions);
2254
+ };
2255
+ const { projectPaths, projectPatterns, projectConfigs } = (config.projects || []).reduce((total, p)=>{
2256
+ if ('object' == typeof p) {
2257
+ const projectRoot = p.root ? (0, utils.tS)(p.root, root) : root;
2258
+ total.projectConfigs.push({
2259
+ config: {
2260
+ root: projectRoot,
2261
+ name: p.name ? p.name : getDefaultProjectName(projectRoot),
2262
+ ...p
2263
+ },
2264
+ configFilePath: void 0
2265
+ });
2266
+ return total;
2267
+ }
2268
+ const projectStr = (0, utils.tS)(p, root);
2269
+ if ((0, dist.ey)(projectStr)) total.projectPatterns.push(projectStr);
2270
+ else {
2271
+ const absolutePath = (0, utils.FI)(root, projectStr);
2272
+ if (!(0, external_node_fs_.existsSync)(absolutePath)) throw `Can't resolve project "${p}", please make sure "${p}" is a existing file or a directory.`;
2273
+ total.projectPaths.push(absolutePath);
2274
+ }
2275
+ return total;
2276
+ }, {
2277
+ projectPaths: [],
2278
+ projectPatterns: [],
2279
+ projectConfigs: []
2280
+ });
2281
+ projectPaths.push(...await globProjects(projectPatterns));
2282
+ const projects = await Promise.all(projectPaths.map(async (project)=>{
2283
+ const isDirectory = (0, external_node_fs_.statSync)(project).isDirectory();
2284
+ const { config, configFilePath } = await resolveConfig({
2285
+ ...options,
2286
+ config: isDirectory ? void 0 : project,
2287
+ root: isDirectory ? project : (0, pathe_M_eThtNZ.d)(project)
2288
+ });
2289
+ config.name ??= getDefaultProjectName(project);
2290
+ if (config.projects?.length && config.root !== root) utils.vF.warn(`Projects cannot have nested projects, the "projects" field in project "${config.name}" will be ignored.`);
2291
+ return {
2292
+ config,
2293
+ configFilePath
2294
+ };
2295
+ })).then((projects)=>(0, utils.zz)(projects.concat(projectConfigs), options));
2296
+ if (!projects.length) {
2297
+ let errorMsg = `No projects found, please make sure you have at least one valid project.
2298
+ ${utils.yW.gray('projects:')} ${JSON.stringify(config.projects, null, 2)}`;
2299
+ if (options.project) errorMsg += `\n${utils.yW.gray('projectName filter:')} ${JSON.stringify(options.project, null, 2)}`;
2300
+ throw errorMsg;
2301
+ }
2302
+ const names = new Set();
2303
+ projects.forEach((project)=>{
2304
+ if (names.has(project.config.name)) {
2305
+ const conflictProjects = projects.filter((p)=>p.config.name === project.config.name);
2306
+ throw `Project name "${project.config.name}" is already used. Please ensure all projects have unique names.
2307
+ Conflicting projects:
2308
+ ${conflictProjects.map((p)=>`- ${p.configFilePath || p.config.root}`).join('\n')}
2309
+ `;
2310
+ }
2311
+ names.add(project.config.name);
2312
+ });
2313
+ return projects;
2314
+ }
2315
+ async function initCli(options) {
2316
+ const cwd = process.cwd();
2317
+ const root = options.root ? (0, utils.FI)(cwd, options.root) : cwd;
2318
+ const { config, configFilePath } = await resolveConfig({
2319
+ ...options,
2320
+ root
2321
+ });
2322
+ const projects = await resolveProjects({
2323
+ config,
2324
+ root,
2325
+ options
2326
+ });
2327
+ return {
2328
+ config,
2329
+ configFilePath,
2330
+ projects
2331
+ };
2332
+ }
2333
+ },
2077
2334
  "./src/cli/prepare.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
2078
2335
  __webpack_require__.d(__webpack_exports__, {
2079
2336
  N: ()=>showRstest,
@@ -2090,7 +2347,7 @@ ${section.body}` : section.body).join("\n\n"));
2090
2347
  if (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) console.log();
2091
2348
  }
2092
2349
  function showRstest() {
2093
- _utils_logger__WEBPACK_IMPORTED_MODULE_0__.vF.greet(" Rstest v0.5.0");
2350
+ _utils_logger__WEBPACK_IMPORTED_MODULE_0__.vF.greet(" Rstest v0.5.2");
2094
2351
  _utils_logger__WEBPACK_IMPORTED_MODULE_0__.vF.log('');
2095
2352
  }
2096
2353
  },
@@ -2193,6 +2450,8 @@ ${section.body}` : section.body).join("\n\n"));
2193
2450
  maxConcurrency: 5,
2194
2451
  printConsoleTrace: false,
2195
2452
  disableConsoleIntercept: false,
2453
+ snapshotFormat: {},
2454
+ env: {},
2196
2455
  coverage: {
2197
2456
  exclude: [
2198
2457
  '**/node_modules/**',
@@ -2216,7 +2475,8 @@ ${section.body}` : section.body).join("\n\n"));
2216
2475
  'json'
2217
2476
  ],
2218
2477
  reportsDirectory: './coverage',
2219
- clean: true
2478
+ clean: true,
2479
+ reportOnFailure: false
2220
2480
  }
2221
2481
  });
2222
2482
  const withDefaultConfig = (config)=>{
@@ -2240,15 +2500,1063 @@ ${section.body}` : section.body).join("\n\n"));
2240
2500
  };
2241
2501
  };
2242
2502
  },
2503
+ "./src/core/index.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
2504
+ __webpack_require__.d(__webpack_exports__, {
2505
+ createRstest: ()=>createRstest
2506
+ });
2507
+ var external_node_fs_ = __webpack_require__("node:fs");
2508
+ var pathe_M_eThtNZ = __webpack_require__("../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs");
2509
+ class SnapshotManager {
2510
+ summary;
2511
+ extension = ".snap";
2512
+ constructor(options){
2513
+ this.options = options;
2514
+ this.clear();
2515
+ }
2516
+ clear() {
2517
+ this.summary = emptySummary(this.options);
2518
+ }
2519
+ add(result) {
2520
+ addSnapshotResult(this.summary, result);
2521
+ }
2522
+ resolvePath(testPath, context) {
2523
+ const resolver = this.options.resolveSnapshotPath || (()=>(0, pathe_M_eThtNZ.j)((0, pathe_M_eThtNZ.j)((0, pathe_M_eThtNZ.d)(testPath), "__snapshots__"), `${(0, pathe_M_eThtNZ.c)(testPath)}${this.extension}`));
2524
+ const path = resolver(testPath, this.extension, context);
2525
+ return path;
2526
+ }
2527
+ resolveRawPath(testPath, rawPath) {
2528
+ return (0, pathe_M_eThtNZ.i)(rawPath) ? rawPath : (0, pathe_M_eThtNZ.r)((0, pathe_M_eThtNZ.d)(testPath), rawPath);
2529
+ }
2530
+ }
2531
+ function emptySummary(options) {
2532
+ const summary = {
2533
+ added: 0,
2534
+ failure: false,
2535
+ filesAdded: 0,
2536
+ filesRemoved: 0,
2537
+ filesRemovedList: [],
2538
+ filesUnmatched: 0,
2539
+ filesUpdated: 0,
2540
+ matched: 0,
2541
+ total: 0,
2542
+ unchecked: 0,
2543
+ uncheckedKeysByFile: [],
2544
+ unmatched: 0,
2545
+ updated: 0,
2546
+ didUpdate: "all" === options.updateSnapshot
2547
+ };
2548
+ return summary;
2549
+ }
2550
+ function addSnapshotResult(summary, result) {
2551
+ if (result.added) summary.filesAdded++;
2552
+ if (result.fileDeleted) summary.filesRemoved++;
2553
+ if (result.unmatched) summary.filesUnmatched++;
2554
+ if (result.updated) summary.filesUpdated++;
2555
+ summary.added += result.added;
2556
+ summary.matched += result.matched;
2557
+ summary.unchecked += result.unchecked;
2558
+ if (result.uncheckedKeys && result.uncheckedKeys.length > 0) summary.uncheckedKeysByFile.push({
2559
+ filePath: result.filepath,
2560
+ keys: result.uncheckedKeys
2561
+ });
2562
+ summary.unmatched += result.unmatched;
2563
+ summary.updated += result.updated;
2564
+ summary.total += result.added + result.matched + result.unmatched + result.updated;
2565
+ }
2566
+ const dist_r = Object.create(null), dist_i = (e)=>globalThis.process?.env || {
2567
+ MODE: "production",
2568
+ DEV: false,
2569
+ PROD: true,
2570
+ BASE_URL: "/",
2571
+ ASSET_PREFIX: "auto"
2572
+ }, o = new Proxy(dist_r, {
2573
+ get (e, s) {
2574
+ return dist_i()[s] ?? dist_r[s];
2575
+ },
2576
+ has (e, s) {
2577
+ const E = dist_i();
2578
+ return s in E || s in dist_r;
2579
+ },
2580
+ set (e, s, E) {
2581
+ const B = dist_i(!0);
2582
+ return B[s] = E, !0;
2583
+ },
2584
+ deleteProperty (e, s) {
2585
+ if (!s) return !1;
2586
+ const E = dist_i(!0);
2587
+ return delete E[s], !0;
2588
+ },
2589
+ ownKeys () {
2590
+ const e = dist_i(!0);
2591
+ return Object.keys(e);
2592
+ }
2593
+ }), t = typeof process < "u" && process.env && process.env.NODE_ENV || "", f = [
2594
+ [
2595
+ "APPVEYOR"
2596
+ ],
2597
+ [
2598
+ "AWS_AMPLIFY",
2599
+ "AWS_APP_ID",
2600
+ {
2601
+ ci: !0
2602
+ }
2603
+ ],
2604
+ [
2605
+ "AZURE_PIPELINES",
2606
+ "SYSTEM_TEAMFOUNDATIONCOLLECTIONURI"
2607
+ ],
2608
+ [
2609
+ "AZURE_STATIC",
2610
+ "INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN"
2611
+ ],
2612
+ [
2613
+ "APPCIRCLE",
2614
+ "AC_APPCIRCLE"
2615
+ ],
2616
+ [
2617
+ "BAMBOO",
2618
+ "bamboo_planKey"
2619
+ ],
2620
+ [
2621
+ "BITBUCKET",
2622
+ "BITBUCKET_COMMIT"
2623
+ ],
2624
+ [
2625
+ "BITRISE",
2626
+ "BITRISE_IO"
2627
+ ],
2628
+ [
2629
+ "BUDDY",
2630
+ "BUDDY_WORKSPACE_ID"
2631
+ ],
2632
+ [
2633
+ "BUILDKITE"
2634
+ ],
2635
+ [
2636
+ "CIRCLE",
2637
+ "CIRCLECI"
2638
+ ],
2639
+ [
2640
+ "CIRRUS",
2641
+ "CIRRUS_CI"
2642
+ ],
2643
+ [
2644
+ "CLOUDFLARE_PAGES",
2645
+ "CF_PAGES",
2646
+ {
2647
+ ci: !0
2648
+ }
2649
+ ],
2650
+ [
2651
+ "CLOUDFLARE_WORKERS",
2652
+ "WORKERS_CI",
2653
+ {
2654
+ ci: !0
2655
+ }
2656
+ ],
2657
+ [
2658
+ "CODEBUILD",
2659
+ "CODEBUILD_BUILD_ARN"
2660
+ ],
2661
+ [
2662
+ "CODEFRESH",
2663
+ "CF_BUILD_ID"
2664
+ ],
2665
+ [
2666
+ "DRONE"
2667
+ ],
2668
+ [
2669
+ "DRONE",
2670
+ "DRONE_BUILD_EVENT"
2671
+ ],
2672
+ [
2673
+ "DSARI"
2674
+ ],
2675
+ [
2676
+ "GITHUB_ACTIONS"
2677
+ ],
2678
+ [
2679
+ "GITLAB",
2680
+ "GITLAB_CI"
2681
+ ],
2682
+ [
2683
+ "GITLAB",
2684
+ "CI_MERGE_REQUEST_ID"
2685
+ ],
2686
+ [
2687
+ "GOCD",
2688
+ "GO_PIPELINE_LABEL"
2689
+ ],
2690
+ [
2691
+ "LAYERCI"
2692
+ ],
2693
+ [
2694
+ "HUDSON",
2695
+ "HUDSON_URL"
2696
+ ],
2697
+ [
2698
+ "JENKINS",
2699
+ "JENKINS_URL"
2700
+ ],
2701
+ [
2702
+ "MAGNUM"
2703
+ ],
2704
+ [
2705
+ "NETLIFY"
2706
+ ],
2707
+ [
2708
+ "NETLIFY",
2709
+ "NETLIFY_LOCAL",
2710
+ {
2711
+ ci: !1
2712
+ }
2713
+ ],
2714
+ [
2715
+ "NEVERCODE"
2716
+ ],
2717
+ [
2718
+ "RENDER"
2719
+ ],
2720
+ [
2721
+ "SAIL",
2722
+ "SAILCI"
2723
+ ],
2724
+ [
2725
+ "SEMAPHORE"
2726
+ ],
2727
+ [
2728
+ "SCREWDRIVER"
2729
+ ],
2730
+ [
2731
+ "SHIPPABLE"
2732
+ ],
2733
+ [
2734
+ "SOLANO",
2735
+ "TDDIUM"
2736
+ ],
2737
+ [
2738
+ "STRIDER"
2739
+ ],
2740
+ [
2741
+ "TEAMCITY",
2742
+ "TEAMCITY_VERSION"
2743
+ ],
2744
+ [
2745
+ "TRAVIS"
2746
+ ],
2747
+ [
2748
+ "VERCEL",
2749
+ "NOW_BUILDER"
2750
+ ],
2751
+ [
2752
+ "VERCEL",
2753
+ "VERCEL",
2754
+ {
2755
+ ci: !1
2756
+ }
2757
+ ],
2758
+ [
2759
+ "VERCEL",
2760
+ "VERCEL_ENV",
2761
+ {
2762
+ ci: !1
2763
+ }
2764
+ ],
2765
+ [
2766
+ "APPCENTER",
2767
+ "APPCENTER_BUILD_ID"
2768
+ ],
2769
+ [
2770
+ "CODESANDBOX",
2771
+ "CODESANDBOX_SSE",
2772
+ {
2773
+ ci: !1
2774
+ }
2775
+ ],
2776
+ [
2777
+ "CODESANDBOX",
2778
+ "CODESANDBOX_HOST",
2779
+ {
2780
+ ci: !1
2781
+ }
2782
+ ],
2783
+ [
2784
+ "STACKBLITZ"
2785
+ ],
2786
+ [
2787
+ "STORMKIT"
2788
+ ],
2789
+ [
2790
+ "CLEAVR"
2791
+ ],
2792
+ [
2793
+ "ZEABUR"
2794
+ ],
2795
+ [
2796
+ "CODESPHERE",
2797
+ "CODESPHERE_APP_ID",
2798
+ {
2799
+ ci: !0
2800
+ }
2801
+ ],
2802
+ [
2803
+ "RAILWAY",
2804
+ "RAILWAY_PROJECT_ID"
2805
+ ],
2806
+ [
2807
+ "RAILWAY",
2808
+ "RAILWAY_SERVICE_ID"
2809
+ ],
2810
+ [
2811
+ "DENO-DEPLOY",
2812
+ "DENO_DEPLOYMENT_ID"
2813
+ ],
2814
+ [
2815
+ "FIREBASE_APP_HOSTING",
2816
+ "FIREBASE_APP_HOSTING",
2817
+ {
2818
+ ci: !0
2819
+ }
2820
+ ]
2821
+ ];
2822
+ function b() {
2823
+ if (globalThis.process?.env) for (const e of f){
2824
+ const s = e[1] || e[0];
2825
+ if (globalThis.process?.env[s]) return {
2826
+ name: e[0].toLowerCase(),
2827
+ ...e[2]
2828
+ };
2829
+ }
2830
+ return globalThis.process?.env?.SHELL === "/bin/jsh" && globalThis.process?.versions?.webcontainer ? {
2831
+ name: "stackblitz",
2832
+ ci: !1
2833
+ } : {
2834
+ name: "",
2835
+ ci: !1
2836
+ };
2837
+ }
2838
+ const l = b();
2839
+ l.name;
2840
+ function n(e) {
2841
+ return e ? "false" !== e : !1;
2842
+ }
2843
+ const I = globalThis.process?.platform || "", T = n(o.CI) || !1 !== l.ci, R = n(globalThis.process?.stdout && globalThis.process?.stdout.isTTY), A = (n(o.DEBUG), "test" === t || n(o.TEST), n(o.MINIMAL), /^win/i.test(I)), C = (/^linux/i.test(I), /^darwin/i.test(I), !n(o.NO_COLOR) && (n(o.FORCE_COLOR) || (R || A) && o.TERM), (globalThis.process?.versions?.node || "").replace(/^v/, "") || null), W = (Number(C?.split(".")[0]), globalThis.process || Object.create(null)), dist_ = {
2844
+ versions: {}
2845
+ }, O = (new Proxy(W, {
2846
+ get (e, s) {
2847
+ if ("env" === s) return o;
2848
+ if (s in e) return e[s];
2849
+ if (s in dist_) return dist_[s];
2850
+ }
2851
+ }), globalThis.process?.release?.name === "node"), c = !!globalThis.Bun || !!globalThis.process?.versions?.bun, D = !!globalThis.Deno, L = !!globalThis.fastly, S = !!globalThis.Netlify, u = !!globalThis.EdgeRuntime, N = globalThis.navigator?.userAgent === "Cloudflare-Workers", F = [
2852
+ [
2853
+ S,
2854
+ "netlify"
2855
+ ],
2856
+ [
2857
+ u,
2858
+ "edge-light"
2859
+ ],
2860
+ [
2861
+ N,
2862
+ "workerd"
2863
+ ],
2864
+ [
2865
+ L,
2866
+ "fastly"
2867
+ ],
2868
+ [
2869
+ D,
2870
+ "deno"
2871
+ ],
2872
+ [
2873
+ c,
2874
+ "bun"
2875
+ ],
2876
+ [
2877
+ O,
2878
+ "node"
2879
+ ]
2880
+ ];
2881
+ function G() {
2882
+ const e = F.find((s)=>s[0]);
2883
+ if (e) return {
2884
+ name: e[1]
2885
+ };
2886
+ }
2887
+ const P = G();
2888
+ P?.name;
2889
+ var src_config = __webpack_require__("./src/config.ts");
2890
+ var stack_trace_parser_esm = __webpack_require__("../../node_modules/.pnpm/stacktrace-parser@0.1.11/node_modules/stacktrace-parser/dist/stack-trace-parser.esm.js");
2891
+ var utils = __webpack_require__("./src/utils/index.ts");
2892
+ const DEFAULT_RENDER_INTERVAL_MS = 1000;
2893
+ const ESC = '\x1B[';
2894
+ const CLEAR_LINE = `${ESC}K`;
2895
+ const MOVE_CURSOR_ONE_ROW_UP = `${ESC}1A`;
2896
+ const SYNC_START = `${ESC}?2026h`;
2897
+ const SYNC_END = `${ESC}?2026l`;
2898
+ class WindowRenderer {
2899
+ options;
2900
+ streams;
2901
+ buffer = [];
2902
+ renderInterval = void 0;
2903
+ renderScheduled = false;
2904
+ windowHeight = 0;
2905
+ finished = false;
2906
+ cleanups = [];
2907
+ constructor(options){
2908
+ this.options = {
2909
+ interval: DEFAULT_RENDER_INTERVAL_MS,
2910
+ ...options
2911
+ };
2912
+ this.streams = {
2913
+ output: options.logger.outputStream.write.bind(options.logger.outputStream),
2914
+ error: options.logger.errorStream.write.bind(options.logger.errorStream)
2915
+ };
2916
+ this.cleanups.push(this.interceptStream(process.stdout, 'output'), this.interceptStream(process.stderr, 'error'));
2917
+ this.start();
2918
+ }
2919
+ start() {
2920
+ this.finished = false;
2921
+ this.renderInterval = setInterval(()=>this.schedule(), this.options.interval).unref();
2922
+ }
2923
+ stop() {
2924
+ this.cleanups.splice(0).map((fn)=>fn());
2925
+ clearInterval(this.renderInterval);
2926
+ }
2927
+ finish() {
2928
+ this.finished = true;
2929
+ this.flushBuffer();
2930
+ clearInterval(this.renderInterval);
2931
+ }
2932
+ schedule() {
2933
+ if (!this.renderScheduled) {
2934
+ this.renderScheduled = true;
2935
+ this.flushBuffer();
2936
+ setTimeout(()=>{
2937
+ this.renderScheduled = false;
2938
+ }, 100).unref();
2939
+ }
2940
+ }
2941
+ flushBuffer() {
2942
+ if (0 === this.buffer.length) return this.render();
2943
+ let current;
2944
+ for (const next of this.buffer.splice(0)){
2945
+ if (!current) {
2946
+ current = next;
2947
+ continue;
2948
+ }
2949
+ if (current.type !== next.type) {
2950
+ this.render(current.message, current.type);
2951
+ current = next;
2952
+ continue;
2953
+ }
2954
+ current.message += next.message;
2955
+ }
2956
+ if (current) this.render(current?.message, current?.type);
2957
+ }
2958
+ render(message, type = 'output') {
2959
+ if (this.finished) {
2960
+ this.clearWindow();
2961
+ return this.write(message || '', type);
2962
+ }
2963
+ const windowContent = this.options.getWindow();
2964
+ const rowCount = getRenderedRowCount(windowContent, this.options.logger.getColumns());
2965
+ let padding = this.windowHeight - rowCount;
2966
+ if (padding > 0 && message) padding -= getRenderedRowCount([
2967
+ message
2968
+ ], this.options.logger.getColumns());
2969
+ this.write(SYNC_START);
2970
+ this.clearWindow();
2971
+ if (message) this.write(message, type);
2972
+ if (padding > 0) this.write('\n'.repeat(padding));
2973
+ this.write(windowContent.join('\n'));
2974
+ this.write(SYNC_END);
2975
+ this.windowHeight = rowCount + Math.max(0, padding);
2976
+ }
2977
+ clearWindow() {
2978
+ if (0 === this.windowHeight) return;
2979
+ this.write(CLEAR_LINE);
2980
+ for(let i = 1; i < this.windowHeight; i++)this.write(`${MOVE_CURSOR_ONE_ROW_UP}${CLEAR_LINE}`);
2981
+ this.windowHeight = 0;
2982
+ }
2983
+ interceptStream(stream, type) {
2984
+ const original = stream.write.bind(stream);
2985
+ stream.write = (chunk, _, callback)=>{
2986
+ if (chunk) if (this.finished) this.write(chunk.toString(), type);
2987
+ else this.buffer.push({
2988
+ type,
2989
+ message: chunk.toString()
2990
+ });
2991
+ callback?.();
2992
+ };
2993
+ return function restore() {
2994
+ stream.write = original;
2995
+ };
2996
+ }
2997
+ write(message, type = 'output') {
2998
+ this.streams[type](message);
2999
+ }
3000
+ }
3001
+ function getRenderedRowCount(rows, columns) {
3002
+ let count = 0;
3003
+ for (const row of rows){
3004
+ const text = (0, __WEBPACK_EXTERNAL_MODULE_node_util_1b29d436__.stripVTControlCharacters)(row);
3005
+ count += Math.max(1, Math.ceil(text.length / columns));
3006
+ }
3007
+ return count;
3008
+ }
3009
+ class StatusRenderer {
3010
+ rootPath;
3011
+ renderer;
3012
+ runningModules = new Set();
3013
+ constructor(rootPath){
3014
+ this.rootPath = rootPath;
3015
+ this.renderer = new WindowRenderer({
3016
+ getWindow: ()=>this.getContent(),
3017
+ logger: {
3018
+ outputStream: process.stdout,
3019
+ errorStream: process.stderr,
3020
+ getColumns: ()=>'columns' in process.stdout ? process.stdout.columns : 80
3021
+ }
3022
+ });
3023
+ }
3024
+ getContent() {
3025
+ const summary = [];
3026
+ for (const module of this.runningModules){
3027
+ const relativePath = (0, pathe_M_eThtNZ.b)(this.rootPath, module);
3028
+ summary.push(`${utils.yW.bgYellow(utils.yW.bold(' RUNS '))} ${(0, utils.EQ)(relativePath)}`);
3029
+ }
3030
+ summary.push('');
3031
+ return summary;
3032
+ }
3033
+ addRunningModule(testPath) {
3034
+ this.runningModules.add(testPath);
3035
+ this.renderer?.schedule();
3036
+ }
3037
+ removeRunningModule(testPath) {
3038
+ this.runningModules.delete(testPath);
3039
+ this.renderer?.schedule();
3040
+ }
3041
+ clear() {
3042
+ this.runningModules.clear();
3043
+ this.renderer?.finish();
3044
+ }
3045
+ }
3046
+ var dist = __webpack_require__("../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/index.mjs");
3047
+ const getSummaryStatusString = (tasks, name = 'tests', showTotal = true)=>{
3048
+ if (0 === tasks.length) return utils.yW.dim(`no ${name}`);
3049
+ const passed = tasks.filter((result)=>'pass' === result.status);
3050
+ const failed = tasks.filter((result)=>'fail' === result.status);
3051
+ const skipped = tasks.filter((result)=>'skip' === result.status);
3052
+ const todo = tasks.filter((result)=>'todo' === result.status);
3053
+ const status = [
3054
+ failed.length ? utils.yW.bold(utils.yW.red(`${failed.length} failed`)) : null,
3055
+ passed.length ? utils.yW.bold(utils.yW.green(`${passed.length} passed`)) : null,
3056
+ skipped.length ? utils.yW.yellow(`${skipped.length} skipped`) : null,
3057
+ todo.length ? utils.yW.gray(`${todo.length} todo`) : null
3058
+ ].filter(Boolean);
3059
+ return status.join(utils.yW.dim(' | ')) + (showTotal && status.length > 1 ? utils.yW.gray(` (${tasks.length})`) : '');
3060
+ };
3061
+ const printSnapshotSummaryLog = (snapshots, rootDir)=>{
3062
+ const summary = [];
3063
+ if (snapshots.added) summary.push(utils.yW.bold(utils.yW.green(`${snapshots.added} written`)));
3064
+ if (snapshots.unmatched) summary.push(utils.yW.bold(utils.yW.red(`${snapshots.unmatched} failed`)));
3065
+ if (snapshots.updated) summary.push(utils.yW.bold(utils.yW.green(`${snapshots.updated} updated `)));
3066
+ if (snapshots.filesRemoved) if (snapshots.didUpdate) summary.push(utils.yW.bold(utils.yW.green(`${snapshots.filesRemoved} files removed `)));
3067
+ else summary.push(utils.yW.bold(utils.yW.yellow(`${snapshots.filesRemoved} files obsolete `)));
3068
+ const POINTER = '➜';
3069
+ if (snapshots.filesRemovedList?.length) {
3070
+ const [head, ...tail] = snapshots.filesRemovedList;
3071
+ summary.push(`${utils.yW.gray(POINTER)} ${(0, utils.XJ)(rootDir, head)}`);
3072
+ for (const key of tail)summary.push(` ${(0, utils.XJ)(rootDir, key)}`);
3073
+ }
3074
+ if (snapshots.unchecked) {
3075
+ if (snapshots.didUpdate) summary.push(utils.yW.bold(utils.yW.green(`${snapshots.unchecked} removed`)));
3076
+ else summary.push(utils.yW.bold(utils.yW.yellow(`${snapshots.unchecked} obsolete`)));
3077
+ for (const uncheckedFile of snapshots.uncheckedKeysByFile){
3078
+ summary.push(`${utils.yW.gray(POINTER)} ${(0, utils.XJ)(rootDir, uncheckedFile.filePath)}`);
3079
+ for (const key of uncheckedFile.keys)summary.push(` ${key}`);
3080
+ }
3081
+ }
3082
+ for (const [index, snapshot] of summary.entries()){
3083
+ const title = 0 === index ? 'Snapshots' : '';
3084
+ utils.vF.log(`${utils.yW.gray(title.padStart(12))} ${snapshot}`);
3085
+ }
3086
+ };
3087
+ const printSummaryLog = ({ results, testResults, snapshotSummary, duration, rootPath })=>{
3088
+ utils.vF.log('');
3089
+ printSnapshotSummaryLog(snapshotSummary, rootPath);
3090
+ utils.vF.log(`${utils.yW.gray('Test Files'.padStart(11))} ${getSummaryStatusString(results)}`);
3091
+ utils.vF.log(`${utils.yW.gray('Tests'.padStart(11))} ${getSummaryStatusString(testResults)}`);
3092
+ utils.vF.log(`${utils.yW.gray('Duration'.padStart(11))} ${(0, utils.kV)(duration.totalTime)} ${utils.yW.gray(`(build ${(0, utils.kV)(duration.buildTime)}, tests ${(0, utils.kV)(duration.testTime)})`)}`);
3093
+ utils.vF.log('');
3094
+ };
3095
+ const printSummaryErrorLogs = async ({ testResults, results, rootPath, getSourcemap, filterRerunTestPaths })=>{
3096
+ const failedTests = [
3097
+ ...results.filter((i)=>'fail' === i.status && i.errors?.length && (filterRerunTestPaths ? filterRerunTestPaths.includes(i.testPath) : true)),
3098
+ ...testResults.filter((i)=>'fail' === i.status && (filterRerunTestPaths ? filterRerunTestPaths.includes(i.testPath) : true))
3099
+ ];
3100
+ if (0 === failedTests.length) return;
3101
+ utils.vF.log('');
3102
+ utils.vF.log(utils.yW.bold('Summary of all failing tests:'));
3103
+ utils.vF.log('');
3104
+ for (const test of failedTests){
3105
+ const relativePath = dist.Ay.relative(rootPath, test.testPath);
3106
+ const nameStr = (0, utils.fN)(test);
3107
+ utils.vF.log(`${utils.yW.bgRed(' FAIL ')} ${(0, utils.EQ)(relativePath)} ${nameStr.length ? `${utils.yW.dim(utils.vO)} ${nameStr}` : ''}`);
3108
+ if (test.errors) {
3109
+ const { printError } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "./src/utils/error.ts"));
3110
+ for (const error of test.errors)await printError(error, getSourcemap, rootPath);
3111
+ }
3112
+ }
3113
+ };
3114
+ const statusStr = {
3115
+ fail: '✗',
3116
+ pass: '✓',
3117
+ todo: '-',
3118
+ skip: '-'
3119
+ };
3120
+ const statusColorfulStr = {
3121
+ fail: utils.yW.red(statusStr.fail),
3122
+ pass: utils.yW.green(statusStr.pass),
3123
+ todo: utils.yW.gray(statusStr.todo),
3124
+ skip: utils.yW.gray(statusStr.skip)
3125
+ };
3126
+ const logCase = (result, slowTestThreshold)=>{
3127
+ const isSlowCase = (result.duration || 0) > slowTestThreshold;
3128
+ const icon = isSlowCase && 'pass' === result.status ? utils.yW.yellow(statusStr[result.status]) : statusColorfulStr[result.status];
3129
+ const nameStr = (0, utils.fN)(result);
3130
+ const duration = void 0 !== result.duration ? ` (${(0, utils.kV)(result.duration)})` : '';
3131
+ const retry = result.retryCount ? utils.yW.yellow(` (retry x${result.retryCount})`) : '';
3132
+ utils.vF.log(` ${icon} ${nameStr}${utils.yW.gray(duration)}${retry}`);
3133
+ if (result.errors) for (const error of result.errors)console.error(utils.yW.red(` ${error.message}`));
3134
+ };
3135
+ const logFileTitle = (test, relativePath, slowTestThreshold, alwaysShowTime = false)=>{
3136
+ let title = ` ${utils.yW.bold(statusColorfulStr[test.status])} ${(0, utils.EQ)(relativePath)}`;
3137
+ const formatDuration = (duration)=>utils.yW[duration > slowTestThreshold ? 'yellow' : 'green']((0, utils.kV)(duration));
3138
+ title += ` ${utils.yW.gray(`(${test.results.length})`)}`;
3139
+ const isTooSlow = test.duration && test.duration > slowTestThreshold;
3140
+ if (alwaysShowTime || isTooSlow) title += ` ${formatDuration(test.duration)}`;
3141
+ utils.vF.log(title);
3142
+ };
3143
+ class DefaultReporter {
3144
+ rootPath;
3145
+ config;
3146
+ options = {};
3147
+ statusRenderer;
3148
+ constructor({ rootPath, options, config }){
3149
+ this.rootPath = rootPath;
3150
+ this.config = config;
3151
+ this.options = options;
3152
+ if (!T) this.statusRenderer = new StatusRenderer(rootPath);
3153
+ }
3154
+ onTestFileStart(test) {
3155
+ this.statusRenderer?.addRunningModule(test.testPath);
3156
+ }
3157
+ onTestFileResult(test) {
3158
+ this.statusRenderer?.removeRunningModule(test.testPath);
3159
+ const relativePath = (0, pathe_M_eThtNZ.b)(this.rootPath, test.testPath);
3160
+ const { slowTestThreshold } = this.config;
3161
+ logFileTitle(test, relativePath, slowTestThreshold);
3162
+ const isTooSlow = test.duration && test.duration > slowTestThreshold;
3163
+ const hasRetryCase = test.results.some((result)=>(result.retryCount || 0) > 0);
3164
+ if ('fail' !== test.status && !isTooSlow && !hasRetryCase) return;
3165
+ const showAllCases = isTooSlow && !test.results.some((result)=>(result.duration || 0) > slowTestThreshold);
3166
+ for (const result of test.results){
3167
+ const isSlowCase = (result.duration || 0) > slowTestThreshold;
3168
+ const retried = (result.retryCount || 0) > 0;
3169
+ if (showAllCases || 'fail' === result.status || isSlowCase || retried) logCase(result, slowTestThreshold);
3170
+ }
3171
+ }
3172
+ onTestCaseResult(_result) {}
3173
+ onUserConsoleLog(log) {
3174
+ const shouldLog = this.config.onConsoleLog?.(log.content) ?? true;
3175
+ if (!shouldLog) return;
3176
+ const titles = [
3177
+ log.name
3178
+ ];
3179
+ const testPath = (0, pathe_M_eThtNZ.b)(this.rootPath, log.testPath);
3180
+ if (log.trace) {
3181
+ const [frame] = (0, stack_trace_parser_esm.q)(log.trace);
3182
+ const filePath = (0, pathe_M_eThtNZ.b)(this.rootPath, frame.file || '');
3183
+ if (filePath !== testPath) titles.push((0, utils.EQ)(testPath));
3184
+ titles.push((0, utils.EQ)(filePath) + utils.yW.gray(`:${frame.lineNumber}:${frame.column}`));
3185
+ } else titles.push((0, utils.EQ)(testPath));
3186
+ utils.vF.log(titles.join(utils.yW.gray(' | ')));
3187
+ utils.vF.log(log.content);
3188
+ utils.vF.log('');
3189
+ }
3190
+ async onExit() {
3191
+ this.statusRenderer?.clear();
3192
+ }
3193
+ async onTestRunEnd({ results, testResults, duration, getSourcemap, snapshotSummary, filterRerunTestPaths }) {
3194
+ this.statusRenderer?.clear();
3195
+ if (false === this.options.summary) return;
3196
+ await printSummaryErrorLogs({
3197
+ testResults,
3198
+ results,
3199
+ rootPath: this.rootPath,
3200
+ getSourcemap,
3201
+ filterRerunTestPaths
3202
+ });
3203
+ printSummaryLog({
3204
+ results,
3205
+ testResults,
3206
+ duration,
3207
+ rootPath: this.rootPath,
3208
+ snapshotSummary
3209
+ });
3210
+ }
3211
+ }
3212
+ class GithubActionsReporter {
3213
+ onWritePath;
3214
+ rootPath;
3215
+ constructor({ options, rootPath }){
3216
+ this.onWritePath = options.onWritePath;
3217
+ this.rootPath = rootPath;
3218
+ }
3219
+ log(message) {
3220
+ console.log(`${message}\n`);
3221
+ }
3222
+ async onTestRunEnd({ results, testResults, getSourcemap }) {
3223
+ const failedTests = [
3224
+ ...results.filter((i)=>'fail' === i.status && i.errors?.length),
3225
+ ...testResults.filter((i)=>'fail' === i.status)
3226
+ ];
3227
+ if (0 === failedTests.length) return;
3228
+ const { parseErrorStacktrace } = await Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "./src/utils/error.ts"));
3229
+ const logs = [];
3230
+ for (const test of failedTests){
3231
+ const { testPath } = test;
3232
+ const nameStr = (0, utils.fN)(test);
3233
+ const shortPath = (0, pathe_M_eThtNZ.b)(this.rootPath, testPath);
3234
+ const title = `${shortPath} ${utils.vO} ${nameStr}`;
3235
+ for (const error of test.errors || []){
3236
+ let file = testPath;
3237
+ let line = 1;
3238
+ let column = 1;
3239
+ const message = `${error.message}${error.diff ? `\n${error.diff}` : ''}`;
3240
+ const type = 'error';
3241
+ if (error.stack) {
3242
+ const stackFrames = await parseErrorStacktrace({
3243
+ stack: error.stack,
3244
+ fullStack: error.fullStack,
3245
+ getSourcemap
3246
+ });
3247
+ if (stackFrames[0]) {
3248
+ file = stackFrames[0].file || test.testPath;
3249
+ line = stackFrames[0].lineNumber || 1;
3250
+ column = stackFrames[0].column || 1;
3251
+ }
3252
+ }
3253
+ logs.push(`::${type} file=${this.onWritePath?.(file) || file},line=${line},col=${column},title=${escapeData(title)}::${escapeData(message)}`);
3254
+ }
3255
+ }
3256
+ this.log('::group::error for github actions');
3257
+ for (const log of logs)this.log(log);
3258
+ this.log('::endgroup::');
3259
+ }
3260
+ }
3261
+ function escapeData(s) {
3262
+ return s.replace(/%/g, '%25').replace(/\r/g, '%0D').replace(/\n/g, '%0A').replace(/:/g, '%3A').replace(/,/g, '%2C');
3263
+ }
3264
+ var promises_ = __webpack_require__("node:fs/promises");
3265
+ function ansiRegex({ onlyFirst = false } = {}) {
3266
+ const ST = '(?:\\u0007|\\u001B\\u005C|\\u009C)';
3267
+ const pattern = [
3268
+ `[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?${ST})`,
3269
+ '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))'
3270
+ ].join('|');
3271
+ return new RegExp(pattern, onlyFirst ? void 0 : 'g');
3272
+ }
3273
+ const regex = ansiRegex();
3274
+ function stripAnsi(string) {
3275
+ if ('string' != typeof string) throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
3276
+ return string.replace(regex, '');
3277
+ }
3278
+ var utils_error = __webpack_require__("./src/utils/error.ts");
3279
+ class JUnitReporter {
3280
+ rootPath;
3281
+ outputPath;
3282
+ constructor({ rootPath, options: { outputPath } = {} }){
3283
+ this.rootPath = rootPath;
3284
+ this.outputPath = outputPath;
3285
+ }
3286
+ sanitizeXml(text) {
3287
+ let result = '';
3288
+ for (const ch of stripAnsi(text)){
3289
+ const cp = ch.codePointAt(0);
3290
+ const valid = 0x09 === cp || 0x0a === cp || 0x0d === cp || cp >= 0x20 && cp <= 0xd7ff || cp >= 0xe000 && cp <= 0xfffd || cp >= 0x10000 && cp <= 0x10ffff;
3291
+ if (valid) result += ch;
3292
+ }
3293
+ return result;
3294
+ }
3295
+ escapeXml(text) {
3296
+ const sanitized = this.sanitizeXml(text);
3297
+ return sanitized.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&apos;');
3298
+ }
3299
+ async createJUnitTestCase(test, getSourcemap) {
3300
+ const testCase = {
3301
+ name: (0, utils.fN)(test),
3302
+ classname: (0, pathe_M_eThtNZ.b)(this.rootPath, test.testPath),
3303
+ time: (test.duration || 0) / 1000,
3304
+ status: test.status
3305
+ };
3306
+ if (test.errors && test.errors.length > 0) testCase.errors = await Promise.all(test.errors.map(async (error)=>{
3307
+ let details = `${error.message}${error.diff ? `\n${error.diff}` : ''}`;
3308
+ const stackFrames = error.stack ? await (0, utils_error.parseErrorStacktrace)({
3309
+ stack: error.stack,
3310
+ fullStack: error.fullStack,
3311
+ getSourcemap
3312
+ }) : [];
3313
+ if (stackFrames[0]) details += `\n${(0, utils_error.C)(stackFrames[0], this.rootPath)}`;
3314
+ return {
3315
+ message: this.escapeXml(error.message),
3316
+ type: error.name || 'Error',
3317
+ details: this.escapeXml(details)
3318
+ };
3319
+ }));
3320
+ return testCase;
3321
+ }
3322
+ async createJUnitTestSuite(fileResult, getSourcemap) {
3323
+ const testCases = await Promise.all(fileResult.results.map(async (test)=>this.createJUnitTestCase(test, getSourcemap)));
3324
+ const failures = testCases.filter((test)=>'fail' === test.status).length;
3325
+ const errors = 0;
3326
+ const skipped = testCases.filter((test)=>'skip' === test.status || 'todo' === test.status).length;
3327
+ const totalTime = testCases.reduce((sum, test)=>sum + test.time, 0);
3328
+ return {
3329
+ name: (0, pathe_M_eThtNZ.b)(this.rootPath, fileResult.testPath),
3330
+ tests: testCases.length,
3331
+ failures,
3332
+ errors,
3333
+ skipped,
3334
+ time: totalTime,
3335
+ timestamp: new Date().toISOString(),
3336
+ testcases: testCases
3337
+ };
3338
+ }
3339
+ generateJUnitXml(report) {
3340
+ const xmlDeclaration = '<?xml version="1.0" encoding="UTF-8"?>';
3341
+ const testsuitesXml = `
3342
+ <testsuites name="${this.escapeXml(report.testsuites.name)}" tests="${report.testsuites.tests}" failures="${report.testsuites.failures}" errors="${report.testsuites.errors}" skipped="${report.testsuites.skipped}" time="${report.testsuites.time}" timestamp="${this.escapeXml(report.testsuites.timestamp)}">`;
3343
+ const testsuiteXmls = report.testsuites.testsuite.map((suite)=>{
3344
+ const testsuiteStart = `
3345
+ <testsuite name="${this.escapeXml(suite.name)}" tests="${suite.tests}" failures="${suite.failures}" errors="${suite.errors}" skipped="${suite.skipped}" time="${suite.time}" timestamp="${this.escapeXml(suite.timestamp)}">`;
3346
+ const testcaseXmls = suite.testcases.map((testcase)=>{
3347
+ let testcaseXml = `
3348
+ <testcase name="${this.escapeXml(testcase.name)}" classname="${this.escapeXml(testcase.classname)}" time="${testcase.time}">`;
3349
+ if ('skip' === testcase.status || 'todo' === testcase.status) testcaseXml += `
3350
+ <skipped/>`;
3351
+ else if ('fail' === testcase.status && testcase.errors) testcase.errors.forEach((error)=>{
3352
+ testcaseXml += `
3353
+ <failure message="${error.message}" type="${error.type}">${error.details || ''}</failure>`;
3354
+ });
3355
+ testcaseXml += `
3356
+ </testcase>`;
3357
+ return testcaseXml;
3358
+ }).join('');
3359
+ const testsuiteEnd = `
3360
+ </testsuite>`;
3361
+ return testsuiteStart + testcaseXmls + testsuiteEnd;
3362
+ }).join('');
3363
+ const testsuitesEnd = `
3364
+ </testsuites>`;
3365
+ return xmlDeclaration + testsuitesXml + testsuiteXmls + testsuitesEnd;
3366
+ }
3367
+ async onTestRunEnd({ results, testResults, duration, getSourcemap }) {
3368
+ const testSuites = await Promise.all(results.map(async (fileResult)=>this.createJUnitTestSuite(fileResult, getSourcemap)));
3369
+ const totalTests = testResults.length;
3370
+ const totalFailures = testResults.filter((test)=>'fail' === test.status).length;
3371
+ const totalErrors = 0;
3372
+ const totalSkipped = testResults.filter((test)=>'skip' === test.status || 'todo' === test.status).length;
3373
+ const totalTime = duration.testTime / 1000;
3374
+ const report = {
3375
+ testsuites: {
3376
+ name: 'rstest tests',
3377
+ tests: totalTests,
3378
+ failures: totalFailures,
3379
+ errors: totalErrors,
3380
+ skipped: totalSkipped,
3381
+ time: totalTime,
3382
+ timestamp: new Date().toISOString(),
3383
+ testsuite: testSuites
3384
+ }
3385
+ };
3386
+ const xmlContent = this.generateJUnitXml(report);
3387
+ if (this.outputPath) try {
3388
+ await (0, promises_.writeFile)(this.outputPath, xmlContent, 'utf-8');
3389
+ console.log(`JUnit XML report written to: ${this.outputPath}`);
3390
+ } catch (error) {
3391
+ console.error(`Failed to write JUnit XML report to ${this.outputPath}:`, error);
3392
+ console.log('JUnit XML Report:');
3393
+ console.log(xmlContent);
3394
+ }
3395
+ else console.log(xmlContent);
3396
+ }
3397
+ }
3398
+ class VerboseReporter extends DefaultReporter {
3399
+ onTestFileResult(test) {
3400
+ this.statusRenderer?.removeRunningModule(test.testPath);
3401
+ const relativePath = (0, pathe_M_eThtNZ.b)(this.rootPath, test.testPath);
3402
+ const { slowTestThreshold } = this.config;
3403
+ logFileTitle(test, relativePath, slowTestThreshold, true);
3404
+ for (const result of test.results)logCase(result, slowTestThreshold);
3405
+ }
3406
+ }
3407
+ function formatEnvironmentName(name) {
3408
+ return name.replace(/[^a-zA-Z0-9\-_$]/g, '_');
3409
+ }
3410
+ class Rstest {
3411
+ cwd;
3412
+ command;
3413
+ fileFilters;
3414
+ configFilePath;
3415
+ reporters;
3416
+ snapshotManager;
3417
+ version;
3418
+ rootPath;
3419
+ originalConfig;
3420
+ normalizedConfig;
3421
+ idMap = new Map();
3422
+ reporterResults = {
3423
+ results: [],
3424
+ testResults: []
3425
+ };
3426
+ projects = [];
3427
+ constructor({ cwd = process.cwd(), command, fileFilters, configFilePath, projects }, userConfig){
3428
+ this.cwd = cwd;
3429
+ this.command = command;
3430
+ this.fileFilters = fileFilters;
3431
+ this.configFilePath = configFilePath;
3432
+ const rootPath = userConfig.root ? (0, utils.FI)(cwd, userConfig.root) : cwd;
3433
+ const rstestConfig = (0, src_config.wX)({
3434
+ ...userConfig,
3435
+ root: rootPath
3436
+ });
3437
+ const reporters = 'list' !== command ? createReporters(rstestConfig.reporters, {
3438
+ rootPath,
3439
+ config: rstestConfig
3440
+ }) : [];
3441
+ const snapshotManager = new SnapshotManager({
3442
+ updateSnapshot: rstestConfig.update ? 'all' : T ? 'none' : 'new'
3443
+ });
3444
+ this.reporters = reporters;
3445
+ this.snapshotManager = snapshotManager;
3446
+ this.version = "0.5.2";
3447
+ this.rootPath = rootPath;
3448
+ this.originalConfig = userConfig;
3449
+ this.normalizedConfig = rstestConfig;
3450
+ this.projects = projects.length ? projects.map((project)=>{
3451
+ const config = (0, src_config.wX)(project.config);
3452
+ config.isolate = rstestConfig.isolate;
3453
+ config.source ??= {};
3454
+ config.coverage = rstestConfig.coverage;
3455
+ if (!config.source.tsconfigPath) {
3456
+ const tsconfigPath = (0, pathe_M_eThtNZ.j)(config.root, utils.WB);
3457
+ if ((0, external_node_fs_.existsSync)(tsconfigPath)) config.source.tsconfigPath = tsconfigPath;
3458
+ }
3459
+ return {
3460
+ configFilePath: project.configFilePath,
3461
+ rootPath: config.root,
3462
+ name: config.name,
3463
+ environmentName: formatEnvironmentName(config.name),
3464
+ normalizedConfig: config
3465
+ };
3466
+ }) : [
3467
+ {
3468
+ configFilePath,
3469
+ rootPath,
3470
+ name: rstestConfig.name,
3471
+ environmentName: formatEnvironmentName(rstestConfig.name),
3472
+ normalizedConfig: rstestConfig
3473
+ }
3474
+ ];
3475
+ }
3476
+ updateReporterResultState(results, testResults, deletedEntries = []) {
3477
+ results.forEach((item)=>{
3478
+ const existingIndex = this.reporterResults.results.findIndex((r)=>r.testPath === item.testPath);
3479
+ if (-1 !== existingIndex) this.reporterResults.results[existingIndex] = item;
3480
+ else this.reporterResults.results.push(item);
3481
+ });
3482
+ const testPathsToUpdate = new Set(testResults.map((r)=>r.testPath));
3483
+ this.reporterResults.testResults = this.reporterResults.testResults.filter((r)=>!testPathsToUpdate.has(r.testPath));
3484
+ this.reporterResults.testResults.push(...testResults);
3485
+ if (deletedEntries.length > 0) {
3486
+ const deletedPathsSet = new Set(deletedEntries);
3487
+ this.reporterResults.results = this.reporterResults.results.filter((r)=>!deletedPathsSet.has(r.testPath));
3488
+ this.reporterResults.testResults = this.reporterResults.testResults.filter((r)=>!deletedPathsSet.has(r.testPath));
3489
+ }
3490
+ }
3491
+ }
3492
+ const reportersMap = {
3493
+ default: DefaultReporter,
3494
+ verbose: VerboseReporter,
3495
+ 'github-actions': GithubActionsReporter,
3496
+ junit: JUnitReporter
3497
+ };
3498
+ function createReporters(reporters, initOptions = {}) {
3499
+ const result = (0, utils.bg)(reporters).map((reporter)=>{
3500
+ if ('string' == typeof reporter || Array.isArray(reporter)) {
3501
+ const [name, options = {}] = 'string' == typeof reporter ? [
3502
+ reporter,
3503
+ {}
3504
+ ] : reporter;
3505
+ if (name in reportersMap) {
3506
+ const Reporter = reportersMap[name];
3507
+ return new Reporter({
3508
+ ...initOptions,
3509
+ options
3510
+ });
3511
+ }
3512
+ throw new Error(`Reporter ${reporter} not found. Please install it or use a built-in reporter.`);
3513
+ }
3514
+ return reporter;
3515
+ });
3516
+ return result;
3517
+ }
3518
+ __webpack_require__("./src/cli/index.ts");
3519
+ function createRstest({ config, projects, configFilePath }, command, fileFilters) {
3520
+ const context = new Rstest({
3521
+ cwd: process.cwd(),
3522
+ command,
3523
+ fileFilters,
3524
+ configFilePath,
3525
+ projects
3526
+ }, config);
3527
+ const runTests = async ()=>{
3528
+ const { runTests } = await Promise.all([
3529
+ __webpack_require__.e("816"),
3530
+ __webpack_require__.e("33")
3531
+ ]).then(__webpack_require__.bind(__webpack_require__, "./src/core/runTests.ts"));
3532
+ await runTests(context);
3533
+ };
3534
+ const listTests = async (options)=>{
3535
+ const { listTests } = await Promise.all([
3536
+ __webpack_require__.e("816"),
3537
+ __webpack_require__.e("971")
3538
+ ]).then(__webpack_require__.bind(__webpack_require__, "./src/core/listTests.ts"));
3539
+ await listTests(context, options);
3540
+ };
3541
+ return {
3542
+ context,
3543
+ runTests,
3544
+ listTests
3545
+ };
3546
+ }
3547
+ },
2243
3548
  "./src/utils/constants.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
2244
3549
  __webpack_require__.d(__webpack_exports__, {
2245
3550
  EJ: ()=>TEMP_RSTEST_OUTPUT_DIR_GLOB,
3551
+ TE: ()=>globalApis,
2246
3552
  WB: ()=>TS_CONFIG_FILE,
2247
3553
  kv: ()=>DEFAULT_CONFIG_EXTENSIONS,
2248
3554
  t: ()=>DEFAULT_CONFIG_NAME,
3555
+ vO: ()=>TEST_DELIMITER,
2249
3556
  zZ: ()=>TEMP_RSTEST_OUTPUT_DIR
2250
3557
  });
2251
3558
  const DEFAULT_CONFIG_NAME = 'rstest.config';
3559
+ const TEST_DELIMITER = '>';
2252
3560
  const TEMP_RSTEST_OUTPUT_DIR = 'dist/.rstest-temp';
2253
3561
  const TEMP_RSTEST_OUTPUT_DIR_GLOB = '**/dist/.rstest-temp';
2254
3562
  const DEFAULT_CONFIG_EXTENSIONS = [
@@ -2259,16 +3567,542 @@ ${section.body}` : section.body).join("\n\n"));
2259
3567
  '.cjs',
2260
3568
  '.cts'
2261
3569
  ];
3570
+ const globalApis = [
3571
+ 'test',
3572
+ 'describe',
3573
+ 'it',
3574
+ 'expect',
3575
+ 'afterAll',
3576
+ 'afterEach',
3577
+ 'beforeAll',
3578
+ 'beforeEach',
3579
+ 'rstest',
3580
+ 'rs',
3581
+ 'assert',
3582
+ 'onTestFinished',
3583
+ 'onTestFailed'
3584
+ ];
2262
3585
  const TS_CONFIG_FILE = 'tsconfig.json';
2263
3586
  },
3587
+ "./src/utils/error.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
3588
+ __webpack_require__.d(__webpack_exports__, {
3589
+ printError: ()=>printError,
3590
+ C: ()=>formatStack,
3591
+ parseErrorStacktrace: ()=>parseErrorStacktrace
3592
+ });
3593
+ var external_node_fs_ = __webpack_require__("node:fs");
3594
+ var comma = ",".charCodeAt(0);
3595
+ var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
3596
+ var intToChar = new Uint8Array(64);
3597
+ var charToInt = new Uint8Array(128);
3598
+ for(let i = 0; i < chars.length; i++){
3599
+ const c = chars.charCodeAt(i);
3600
+ intToChar[i] = c;
3601
+ charToInt[c] = i;
3602
+ }
3603
+ function decodeInteger(reader, relative) {
3604
+ let value = 0;
3605
+ let shift = 0;
3606
+ let integer = 0;
3607
+ do {
3608
+ const c = reader.next();
3609
+ integer = charToInt[c];
3610
+ value |= (31 & integer) << shift;
3611
+ shift += 5;
3612
+ }while (32 & integer);
3613
+ const shouldNegate = 1 & value;
3614
+ value >>>= 1;
3615
+ if (shouldNegate) value = -2147483648 | -value;
3616
+ return relative + value;
3617
+ }
3618
+ function hasMoreVlq(reader, max) {
3619
+ if (reader.pos >= max) return false;
3620
+ return reader.peek() !== comma;
3621
+ }
3622
+ typeof TextDecoder;
3623
+ var StringReader = class {
3624
+ constructor(buffer){
3625
+ this.pos = 0;
3626
+ this.buffer = buffer;
3627
+ }
3628
+ next() {
3629
+ return this.buffer.charCodeAt(this.pos++);
3630
+ }
3631
+ peek() {
3632
+ return this.buffer.charCodeAt(this.pos);
3633
+ }
3634
+ indexOf(char) {
3635
+ const { buffer, pos } = this;
3636
+ const idx = buffer.indexOf(char, pos);
3637
+ return -1 === idx ? buffer.length : idx;
3638
+ }
3639
+ };
3640
+ function decode(mappings) {
3641
+ const { length } = mappings;
3642
+ const reader = new StringReader(mappings);
3643
+ const decoded = [];
3644
+ let genColumn = 0;
3645
+ let sourcesIndex = 0;
3646
+ let sourceLine = 0;
3647
+ let sourceColumn = 0;
3648
+ let namesIndex = 0;
3649
+ do {
3650
+ const semi = reader.indexOf(";");
3651
+ const line = [];
3652
+ let sorted = true;
3653
+ let lastCol = 0;
3654
+ genColumn = 0;
3655
+ while(reader.pos < semi){
3656
+ let seg;
3657
+ genColumn = decodeInteger(reader, genColumn);
3658
+ if (genColumn < lastCol) sorted = false;
3659
+ lastCol = genColumn;
3660
+ if (hasMoreVlq(reader, semi)) {
3661
+ sourcesIndex = decodeInteger(reader, sourcesIndex);
3662
+ sourceLine = decodeInteger(reader, sourceLine);
3663
+ sourceColumn = decodeInteger(reader, sourceColumn);
3664
+ if (hasMoreVlq(reader, semi)) {
3665
+ namesIndex = decodeInteger(reader, namesIndex);
3666
+ seg = [
3667
+ genColumn,
3668
+ sourcesIndex,
3669
+ sourceLine,
3670
+ sourceColumn,
3671
+ namesIndex
3672
+ ];
3673
+ } else seg = [
3674
+ genColumn,
3675
+ sourcesIndex,
3676
+ sourceLine,
3677
+ sourceColumn
3678
+ ];
3679
+ } else seg = [
3680
+ genColumn
3681
+ ];
3682
+ line.push(seg);
3683
+ reader.pos++;
3684
+ }
3685
+ if (!sorted) sort(line);
3686
+ decoded.push(line);
3687
+ reader.pos = semi + 1;
3688
+ }while (reader.pos <= length);
3689
+ return decoded;
3690
+ }
3691
+ function sort(line) {
3692
+ line.sort(sortComparator);
3693
+ }
3694
+ function sortComparator(a, b) {
3695
+ return a[0] - b[0];
3696
+ }
3697
+ const schemeRegex = /^[\w+.-]+:\/\//;
3698
+ const urlRegex = /^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/;
3699
+ const fileRegex = /^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;
3700
+ function isAbsoluteUrl(input) {
3701
+ return schemeRegex.test(input);
3702
+ }
3703
+ function isSchemeRelativeUrl(input) {
3704
+ return input.startsWith('//');
3705
+ }
3706
+ function isAbsolutePath(input) {
3707
+ return input.startsWith('/');
3708
+ }
3709
+ function isFileUrl(input) {
3710
+ return input.startsWith('file:');
3711
+ }
3712
+ function isRelative(input) {
3713
+ return /^[.?#]/.test(input);
3714
+ }
3715
+ function parseAbsoluteUrl(input) {
3716
+ const match = urlRegex.exec(input);
3717
+ return makeUrl(match[1], match[2] || '', match[3], match[4] || '', match[5] || '/', match[6] || '', match[7] || '');
3718
+ }
3719
+ function parseFileUrl(input) {
3720
+ const match = fileRegex.exec(input);
3721
+ const path = match[2];
3722
+ return makeUrl('file:', '', match[1] || '', '', isAbsolutePath(path) ? path : '/' + path, match[3] || '', match[4] || '');
3723
+ }
3724
+ function makeUrl(scheme, user, host, port, path, query, hash) {
3725
+ return {
3726
+ scheme,
3727
+ user,
3728
+ host,
3729
+ port,
3730
+ path,
3731
+ query,
3732
+ hash,
3733
+ type: 7
3734
+ };
3735
+ }
3736
+ function parseUrl(input) {
3737
+ if (isSchemeRelativeUrl(input)) {
3738
+ const url = parseAbsoluteUrl('http:' + input);
3739
+ url.scheme = '';
3740
+ url.type = 6;
3741
+ return url;
3742
+ }
3743
+ if (isAbsolutePath(input)) {
3744
+ const url = parseAbsoluteUrl('http://foo.com' + input);
3745
+ url.scheme = '';
3746
+ url.host = '';
3747
+ url.type = 5;
3748
+ return url;
3749
+ }
3750
+ if (isFileUrl(input)) return parseFileUrl(input);
3751
+ if (isAbsoluteUrl(input)) return parseAbsoluteUrl(input);
3752
+ const url = parseAbsoluteUrl('http://foo.com/' + input);
3753
+ url.scheme = '';
3754
+ url.host = '';
3755
+ url.type = input ? input.startsWith('?') ? 3 : input.startsWith('#') ? 2 : 4 : 1;
3756
+ return url;
3757
+ }
3758
+ function stripPathFilename(path) {
3759
+ if (path.endsWith('/..')) return path;
3760
+ const index = path.lastIndexOf('/');
3761
+ return path.slice(0, index + 1);
3762
+ }
3763
+ function mergePaths(url, base) {
3764
+ normalizePath(base, base.type);
3765
+ if ('/' === url.path) url.path = base.path;
3766
+ else url.path = stripPathFilename(base.path) + url.path;
3767
+ }
3768
+ function normalizePath(url, type) {
3769
+ const rel = type <= 4;
3770
+ const pieces = url.path.split('/');
3771
+ let pointer = 1;
3772
+ let positive = 0;
3773
+ let addTrailingSlash = false;
3774
+ for(let i = 1; i < pieces.length; i++){
3775
+ const piece = pieces[i];
3776
+ if (!piece) {
3777
+ addTrailingSlash = true;
3778
+ continue;
3779
+ }
3780
+ addTrailingSlash = false;
3781
+ if ('.' !== piece) {
3782
+ if ('..' === piece) {
3783
+ if (positive) {
3784
+ addTrailingSlash = true;
3785
+ positive--;
3786
+ pointer--;
3787
+ } else if (rel) pieces[pointer++] = piece;
3788
+ continue;
3789
+ }
3790
+ pieces[pointer++] = piece;
3791
+ positive++;
3792
+ }
3793
+ }
3794
+ let path = '';
3795
+ for(let i = 1; i < pointer; i++)path += '/' + pieces[i];
3796
+ if (!path || addTrailingSlash && !path.endsWith('/..')) path += '/';
3797
+ url.path = path;
3798
+ }
3799
+ function resolve_uri_resolve(input, base) {
3800
+ if (!input && !base) return '';
3801
+ const url = parseUrl(input);
3802
+ let inputType = url.type;
3803
+ if (base && 7 !== inputType) {
3804
+ const baseUrl = parseUrl(base);
3805
+ const baseType = baseUrl.type;
3806
+ switch(inputType){
3807
+ case 1:
3808
+ url.hash = baseUrl.hash;
3809
+ case 2:
3810
+ url.query = baseUrl.query;
3811
+ case 3:
3812
+ case 4:
3813
+ mergePaths(url, baseUrl);
3814
+ case 5:
3815
+ url.user = baseUrl.user;
3816
+ url.host = baseUrl.host;
3817
+ url.port = baseUrl.port;
3818
+ case 6:
3819
+ url.scheme = baseUrl.scheme;
3820
+ }
3821
+ if (baseType > inputType) inputType = baseType;
3822
+ }
3823
+ normalizePath(url, inputType);
3824
+ const queryHash = url.query + url.hash;
3825
+ switch(inputType){
3826
+ case 2:
3827
+ case 3:
3828
+ return queryHash;
3829
+ case 4:
3830
+ {
3831
+ const path = url.path.slice(1);
3832
+ if (!path) return queryHash || '.';
3833
+ if (isRelative(base || input) && !isRelative(path)) return './' + path + queryHash;
3834
+ return path + queryHash;
3835
+ }
3836
+ case 5:
3837
+ return url.path + queryHash;
3838
+ default:
3839
+ return url.scheme + '//' + url.user + url.host + url.port + url.path + queryHash;
3840
+ }
3841
+ }
3842
+ function stripFilename(path) {
3843
+ if (!path) return "";
3844
+ const index = path.lastIndexOf("/");
3845
+ return path.slice(0, index + 1);
3846
+ }
3847
+ function resolver(mapUrl, sourceRoot) {
3848
+ const from = stripFilename(mapUrl);
3849
+ const prefix = sourceRoot ? sourceRoot + "/" : "";
3850
+ return (source)=>resolve_uri_resolve(prefix + (source || ""), from);
3851
+ }
3852
+ var COLUMN = 0;
3853
+ var SOURCES_INDEX = 1;
3854
+ var SOURCE_LINE = 2;
3855
+ var SOURCE_COLUMN = 3;
3856
+ var NAMES_INDEX = 4;
3857
+ function maybeSort(mappings, owned) {
3858
+ const unsortedIndex = nextUnsortedSegmentLine(mappings, 0);
3859
+ if (unsortedIndex === mappings.length) return mappings;
3860
+ if (!owned) mappings = mappings.slice();
3861
+ for(let i = unsortedIndex; i < mappings.length; i = nextUnsortedSegmentLine(mappings, i + 1))mappings[i] = sortSegments(mappings[i], owned);
3862
+ return mappings;
3863
+ }
3864
+ function nextUnsortedSegmentLine(mappings, start) {
3865
+ for(let i = start; i < mappings.length; i++)if (!isSorted(mappings[i])) return i;
3866
+ return mappings.length;
3867
+ }
3868
+ function isSorted(line) {
3869
+ for(let j = 1; j < line.length; j++)if (line[j][COLUMN] < line[j - 1][COLUMN]) return false;
3870
+ return true;
3871
+ }
3872
+ function sortSegments(line, owned) {
3873
+ if (!owned) line = line.slice();
3874
+ return line.sort(trace_mapping_sortComparator);
3875
+ }
3876
+ function trace_mapping_sortComparator(a, b) {
3877
+ return a[COLUMN] - b[COLUMN];
3878
+ }
3879
+ var found = false;
3880
+ function binarySearch(haystack, needle, low, high) {
3881
+ while(low <= high){
3882
+ const mid = low + (high - low >> 1);
3883
+ const cmp = haystack[mid][COLUMN] - needle;
3884
+ if (0 === cmp) {
3885
+ found = true;
3886
+ return mid;
3887
+ }
3888
+ if (cmp < 0) low = mid + 1;
3889
+ else high = mid - 1;
3890
+ }
3891
+ found = false;
3892
+ return low - 1;
3893
+ }
3894
+ function upperBound(haystack, needle, index) {
3895
+ for(let i = index + 1; i < haystack.length && haystack[i][COLUMN] === needle; index = i++);
3896
+ return index;
3897
+ }
3898
+ function lowerBound(haystack, needle, index) {
3899
+ for(let i = index - 1; i >= 0 && haystack[i][COLUMN] === needle; index = i--);
3900
+ return index;
3901
+ }
3902
+ function memoizedState() {
3903
+ return {
3904
+ lastKey: -1,
3905
+ lastNeedle: -1,
3906
+ lastIndex: -1
3907
+ };
3908
+ }
3909
+ function memoizedBinarySearch(haystack, needle, state, key) {
3910
+ const { lastKey, lastNeedle, lastIndex } = state;
3911
+ let low = 0;
3912
+ let high = haystack.length - 1;
3913
+ if (key === lastKey) {
3914
+ if (needle === lastNeedle) {
3915
+ found = -1 !== lastIndex && haystack[lastIndex][COLUMN] === needle;
3916
+ return lastIndex;
3917
+ }
3918
+ if (needle >= lastNeedle) low = -1 === lastIndex ? 0 : lastIndex;
3919
+ else high = lastIndex;
3920
+ }
3921
+ state.lastKey = key;
3922
+ state.lastNeedle = needle;
3923
+ return state.lastIndex = binarySearch(haystack, needle, low, high);
3924
+ }
3925
+ function parse(map) {
3926
+ return "string" == typeof map ? JSON.parse(map) : map;
3927
+ }
3928
+ var LINE_GTR_ZERO = "`line` must be greater than 0 (lines start at line 1)";
3929
+ var COL_GTR_EQ_ZERO = "`column` must be greater than or equal to 0 (columns start at column 0)";
3930
+ var LEAST_UPPER_BOUND = -1;
3931
+ var GREATEST_LOWER_BOUND = 1;
3932
+ var TraceMap = class {
3933
+ constructor(map, mapUrl){
3934
+ const isString = "string" == typeof map;
3935
+ if (!isString && map._decodedMemo) return map;
3936
+ const parsed = parse(map);
3937
+ const { version, file, names, sourceRoot, sources, sourcesContent } = parsed;
3938
+ this.version = version;
3939
+ this.file = file;
3940
+ this.names = names || [];
3941
+ this.sourceRoot = sourceRoot;
3942
+ this.sources = sources;
3943
+ this.sourcesContent = sourcesContent;
3944
+ this.ignoreList = parsed.ignoreList || parsed.x_google_ignoreList || void 0;
3945
+ const resolve = resolver(mapUrl, sourceRoot);
3946
+ this.resolvedSources = sources.map(resolve);
3947
+ const { mappings } = parsed;
3948
+ if ("string" == typeof mappings) {
3949
+ this._encoded = mappings;
3950
+ this._decoded = void 0;
3951
+ } else if (Array.isArray(mappings)) {
3952
+ this._encoded = void 0;
3953
+ this._decoded = maybeSort(mappings, isString);
3954
+ } else if (parsed.sections) throw new Error("TraceMap passed sectioned source map, please use FlattenMap export instead");
3955
+ else throw new Error(`invalid source map: ${JSON.stringify(parsed)}`);
3956
+ this._decodedMemo = memoizedState();
3957
+ this._bySources = void 0;
3958
+ this._bySourceMemos = void 0;
3959
+ }
3960
+ };
3961
+ function cast(map) {
3962
+ return map;
3963
+ }
3964
+ function decodedMappings(map) {
3965
+ var _a;
3966
+ return (_a = cast(map))._decoded || (_a._decoded = decode(cast(map)._encoded));
3967
+ }
3968
+ function originalPositionFor(map, needle) {
3969
+ let { line, column, bias } = needle;
3970
+ line--;
3971
+ if (line < 0) throw new Error(LINE_GTR_ZERO);
3972
+ if (column < 0) throw new Error(COL_GTR_EQ_ZERO);
3973
+ const decoded = decodedMappings(map);
3974
+ if (line >= decoded.length) return OMapping(null, null, null, null);
3975
+ const segments = decoded[line];
3976
+ const index = traceSegmentInternal(segments, cast(map)._decodedMemo, line, column, bias || GREATEST_LOWER_BOUND);
3977
+ if (-1 === index) return OMapping(null, null, null, null);
3978
+ const segment = segments[index];
3979
+ if (1 === segment.length) return OMapping(null, null, null, null);
3980
+ const { names, resolvedSources } = map;
3981
+ return OMapping(resolvedSources[segment[SOURCES_INDEX]], segment[SOURCE_LINE] + 1, segment[SOURCE_COLUMN], 5 === segment.length ? names[segment[NAMES_INDEX]] : null);
3982
+ }
3983
+ function OMapping(source, line, column, name) {
3984
+ return {
3985
+ source,
3986
+ line,
3987
+ column,
3988
+ name
3989
+ };
3990
+ }
3991
+ function traceSegmentInternal(segments, memo, line, column, bias) {
3992
+ let index = memoizedBinarySearch(segments, column, memo, line);
3993
+ if (found) index = (bias === LEAST_UPPER_BOUND ? upperBound : lowerBound)(segments, column, index);
3994
+ else if (bias === LEAST_UPPER_BOUND) index++;
3995
+ if (-1 === index || index === segments.length) return -1;
3996
+ return index;
3997
+ }
3998
+ var stack_trace_parser_esm = __webpack_require__("../../node_modules/.pnpm/stacktrace-parser@0.1.11/node_modules/stacktrace-parser/dist/stack-trace-parser.esm.js");
3999
+ var utils = __webpack_require__("./src/utils/index.ts");
4000
+ async function printError(error, getSourcemap, rootPath) {
4001
+ const errorName = error.name || 'Unknown Error';
4002
+ if (error.message.includes('Vitest failed to access its internal state')) {
4003
+ const tips = [
4004
+ 'Error: not support import `vitest` in Rstest test environment.\n',
4005
+ 'Solution:',
4006
+ ` - Update your code to use imports from "${utils.yW.yellow('@rstest/core')}" instead of "${utils.yW.yellow('vitest')}".`,
4007
+ ' - Enable `globals` configuration and use global API.'
4008
+ ];
4009
+ utils.vF.log(`${utils.yW.red(tips.join('\n'))}\n`);
4010
+ return;
4011
+ }
4012
+ if (error.message.includes('is not defined')) {
4013
+ const [, varName] = error.message.match(/(.*) is not defined/) || [];
4014
+ if (varName) {
4015
+ if (utils.TE.includes(varName)) error.message = error.message.replace(`${varName} is not defined`, `${varName} is not defined. Did you forget to enable "globals" configuration?`);
4016
+ else if ([
4017
+ 'jest',
4018
+ 'vitest'
4019
+ ].includes(varName)) error.message = error.message.replace(`${varName} is not defined`, `${varName} is not defined. Did you mean rstest?`);
4020
+ }
4021
+ }
4022
+ utils.vF.log(`${utils.yW.red(utils.yW.bold(errorName))}${utils.yW.red(`: ${error.message}`)}\n`);
4023
+ if (error.diff) {
4024
+ utils.vF.log(error.diff);
4025
+ utils.vF.log();
4026
+ }
4027
+ if (error.stack) {
4028
+ const stackFrames = await parseErrorStacktrace({
4029
+ stack: error.stack,
4030
+ fullStack: error.fullStack,
4031
+ getSourcemap
4032
+ });
4033
+ if (!stackFrames.length && error.stack.length) utils.vF.log(utils.yW.gray("No error stack found, set 'DEBUG=rstest' to show fullStack."));
4034
+ if (stackFrames[0]) await printCodeFrame(stackFrames[0]);
4035
+ printStack(stackFrames, rootPath);
4036
+ }
4037
+ }
4038
+ async function printCodeFrame(frame) {
4039
+ const filePath = frame.file?.startsWith('file') ? new URL(frame.file) : frame.file;
4040
+ if (!filePath) return;
4041
+ const source = external_node_fs_["default"].existsSync(filePath) ? external_node_fs_["default"].readFileSync(filePath, 'utf-8') : void 0;
4042
+ if (!source) return;
4043
+ const { codeFrameColumns } = await __webpack_require__.e("171").then(__webpack_require__.bind(__webpack_require__, "../../node_modules/.pnpm/@babel+code-frame@7.27.1/node_modules/@babel/code-frame/lib/index.js"));
4044
+ const result = codeFrameColumns(source, {
4045
+ start: {
4046
+ line: frame.lineNumber,
4047
+ column: frame.column
4048
+ }
4049
+ }, {
4050
+ highlightCode: true,
4051
+ linesBelow: 2
4052
+ });
4053
+ utils.vF.log(result);
4054
+ utils.vF.log('');
4055
+ }
4056
+ function formatStack(frame, rootPath) {
4057
+ return '<unknown>' !== frame.methodName ? `at ${frame.methodName} (${(0, utils.XJ)(rootPath, frame.file)}:${frame.lineNumber}:${frame.column})` : `at ${(0, utils.XJ)(rootPath, frame.file)}:${frame.lineNumber}:${frame.column}`;
4058
+ }
4059
+ function printStack(stackFrames, rootPath) {
4060
+ for (const frame of stackFrames)utils.vF.log(utils.yW.gray(` ${formatStack(frame, rootPath)}`));
4061
+ stackFrames.length && utils.vF.log();
4062
+ }
4063
+ const stackIgnores = [
4064
+ /\/@rstest\/core/,
4065
+ /rstest\/packages\/core\/dist/,
4066
+ /node_modules\/tinypool/,
4067
+ /node_modules\/chai/,
4068
+ /node_modules\/@vitest\/expect/,
4069
+ /node_modules\/@vitest\/snapshot/,
4070
+ /node:\w+/,
4071
+ /webpack\/runtime/,
4072
+ /webpack\\runtime/,
4073
+ '<anonymous>'
4074
+ ];
4075
+ async function parseErrorStacktrace({ stack, getSourcemap, fullStack = (0, utils._o)() }) {
4076
+ const stackFrames = await Promise.all((0, stack_trace_parser_esm.q)(stack).filter((frame)=>fullStack ? true : frame.file && !stackIgnores.some((entry)=>frame.file?.match(entry))).map(async (frame)=>{
4077
+ const sourcemap = await getSourcemap(frame.file);
4078
+ if (sourcemap) {
4079
+ const traceMap = new TraceMap(sourcemap);
4080
+ const { line, column, source, name } = originalPositionFor(traceMap, {
4081
+ line: frame.lineNumber,
4082
+ column: frame.column
4083
+ });
4084
+ if (!source) return null;
4085
+ return {
4086
+ ...frame,
4087
+ file: source,
4088
+ lineNumber: line,
4089
+ name,
4090
+ column
4091
+ };
4092
+ }
4093
+ return frame;
4094
+ })).then((frames)=>frames.filter((frame)=>null !== frame));
4095
+ return stackFrames;
4096
+ }
4097
+ },
2264
4098
  "./src/utils/helper.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
2265
4099
  __webpack_require__.d(__webpack_exports__, {
2266
4100
  C3: ()=>needFlagExperimentalDetectModule,
2267
4101
  FI: ()=>getAbsolutePath,
2268
- Kv: ()=>NODE_BUILTINS,
2269
4102
  Ok: ()=>serializableConfig,
2270
4103
  P2: ()=>parsePosix,
2271
4104
  Un: ()=>isTTY,
4105
+ Uq: ()=>ADDITIONAL_NODE_BUILTINS,
2272
4106
  Wk: ()=>formatError,
2273
4107
  bg: ()=>castArray,
2274
4108
  fN: ()=>getTaskNameWithPrefix,
@@ -2279,7 +4113,7 @@ ${section.body}` : section.body).join("\n\n"));
2279
4113
  var pathe__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs");
2280
4114
  var picocolors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
2281
4115
  var picocolors__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/ __webpack_require__.n(picocolors__WEBPACK_IMPORTED_MODULE_1__);
2282
- __webpack_require__("./src/utils/constants.ts");
4116
+ var _constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("./src/utils/constants.ts");
2283
4117
  const formatRootStr = (rootStr, root)=>rootStr.replace('<rootDir>', root);
2284
4118
  function getAbsolutePath(base, filepath) {
2285
4119
  return (0, pathe__WEBPACK_IMPORTED_MODULE_2__.i)(filepath) ? filepath : (0, pathe__WEBPACK_IMPORTED_MODULE_2__.j)(base, filepath);
@@ -2327,7 +4161,7 @@ ${section.body}` : section.body).join("\n\n"));
2327
4161
  return time;
2328
4162
  };
2329
4163
  const getTaskNames = (test)=>(test.parentNames || []).concat(test.name).filter(Boolean);
2330
- const getTaskNameWithPrefix = (test, delimiter = ">")=>getTaskNames(test).join(` ${delimiter} `);
4164
+ const getTaskNameWithPrefix = (test, delimiter = _constants__WEBPACK_IMPORTED_MODULE_0__.vO)=>getTaskNames(test).join(` ${delimiter} `);
2331
4165
  const REGEXP_FLAG_PREFIX = 'RSTEST_REGEXP:';
2332
4166
  const wrapRegex = (value)=>`${REGEXP_FLAG_PREFIX}${value.toString()}`;
2333
4167
  const serializableConfig = (normalizedConfig)=>{
@@ -2358,61 +4192,7 @@ ${section.body}` : section.body).join("\n\n"));
2358
4192
  if (22 === major && minor < 7) return true;
2359
4193
  return false;
2360
4194
  };
2361
- const NODE_BUILTINS = [
2362
- 'assert',
2363
- 'assert/strict',
2364
- 'async_hooks',
2365
- 'buffer',
2366
- 'child_process',
2367
- 'cluster',
2368
- 'console',
2369
- 'constants',
2370
- 'crypto',
2371
- 'dgram',
2372
- 'diagnostics_channel',
2373
- 'dns',
2374
- 'dns/promises',
2375
- 'domain',
2376
- 'events',
2377
- 'fs',
2378
- 'fs/promises',
2379
- 'http',
2380
- 'http2',
2381
- 'https',
2382
- 'inspector',
2383
- 'inspector/promises',
2384
- 'module',
2385
- 'net',
2386
- 'os',
2387
- 'path',
2388
- 'path/posix',
2389
- 'path/win32',
2390
- 'perf_hooks',
2391
- 'process',
2392
- 'punycode',
2393
- 'querystring',
2394
- 'readline',
2395
- 'readline/promises',
2396
- 'repl',
2397
- 'stream',
2398
- 'stream/consumers',
2399
- 'stream/promises',
2400
- 'stream/web',
2401
- 'string_decoder',
2402
- 'sys',
2403
- 'timers',
2404
- 'timers/promises',
2405
- 'tls',
2406
- 'trace_events',
2407
- 'tty',
2408
- 'url',
2409
- 'util',
2410
- 'util/types',
2411
- 'v8',
2412
- 'vm',
2413
- 'wasi',
2414
- 'worker_threads',
2415
- 'zlib',
4195
+ const ADDITIONAL_NODE_BUILTINS = [
2416
4196
  /^node:/,
2417
4197
  'pnpapi'
2418
4198
  ];
@@ -2420,22 +4200,23 @@ ${section.body}` : section.body).join("\n\n"));
2420
4200
  },
2421
4201
  "./src/utils/index.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
2422
4202
  __webpack_require__.d(__webpack_exports__, {
4203
+ TE: ()=>constants.TE,
2423
4204
  C3: ()=>helper.C3,
2424
- Ok: ()=>helper.Ok,
2425
4205
  XJ: ()=>formatTestPath,
2426
4206
  zZ: ()=>constants.zZ,
2427
4207
  fN: ()=>helper.fN,
2428
4208
  vF: ()=>logger.vF,
2429
- vO: ()=>">",
4209
+ Ok: ()=>helper.Ok,
4210
+ vO: ()=>constants.vO,
2430
4211
  tG: ()=>getTestEntries,
2431
4212
  FI: ()=>helper.FI,
2432
- kv: ()=>constants.kv,
4213
+ Uq: ()=>helper.Uq,
2433
4214
  yW: ()=>helper.yW,
4215
+ kv: ()=>constants.kv,
2434
4216
  WB: ()=>constants.WB,
2435
- _o: ()=>logger._o,
2436
4217
  pr: ()=>getSetupFiles,
4218
+ _o: ()=>logger._o,
2437
4219
  EQ: ()=>prettyTestPath,
2438
- Kv: ()=>helper.Kv,
2439
4220
  zz: ()=>filterProjects,
2440
4221
  mT: ()=>logger.mT,
2441
4222
  t: ()=>constants.t,
@@ -2563,15 +4344,16 @@ ${section.body}` : section.body).join("\n\n"));
2563
4344
  mT: ()=>clearScreen,
2564
4345
  vF: ()=>src_logger
2565
4346
  });
4347
+ var external_node_process_ = __webpack_require__("node:process");
2566
4348
  var external_node_os_ = __webpack_require__("node:os");
2567
4349
  var external_node_tty_ = __webpack_require__("node:tty");
2568
- function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : __WEBPACK_EXTERNAL_MODULE_node_process_786449bf__["default"].argv) {
4350
+ function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : external_node_process_["default"].argv) {
2569
4351
  const prefix = flag.startsWith('-') ? '' : 1 === flag.length ? '-' : '--';
2570
4352
  const position = argv.indexOf(prefix + flag);
2571
4353
  const terminatorPosition = argv.indexOf('--');
2572
4354
  return -1 !== position && (-1 === terminatorPosition || position < terminatorPosition);
2573
4355
  }
2574
- const { env } = __WEBPACK_EXTERNAL_MODULE_node_process_786449bf__["default"];
4356
+ const { env } = external_node_process_["default"];
2575
4357
  let flagForceColor;
2576
4358
  if (hasFlag('no-color') || hasFlag('no-colors') || hasFlag('color=false') || hasFlag('color=never')) flagForceColor = 0;
2577
4359
  else if (hasFlag('color') || hasFlag('colors') || hasFlag('color=true') || hasFlag('color=always')) flagForceColor = 1;
@@ -2611,7 +4393,7 @@ ${section.body}` : section.body).join("\n\n"));
2611
4393
  if (haveStream && !streamIsTTY && void 0 === forceColor) return 0;
2612
4394
  const min = forceColor || 0;
2613
4395
  if ('dumb' === env.TERM) return min;
2614
- if ('win32' === __WEBPACK_EXTERNAL_MODULE_node_process_786449bf__["default"].platform) {
4396
+ if ('win32' === external_node_process_["default"].platform) {
2615
4397
  const osRelease = external_node_os_["default"].release().split('.');
2616
4398
  if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2;
2617
4399
  return 1;
@@ -2858,9 +4640,12 @@ ${section.body}` : section.body).join("\n\n"));
2858
4640
  "node:os": function(module) {
2859
4641
  module.exports = __WEBPACK_EXTERNAL_MODULE_node_os_74b4b876__;
2860
4642
  },
2861
- path: function(module) {
4643
+ "node:path": function(module) {
2862
4644
  module.exports = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__;
2863
4645
  },
4646
+ "node:process": function(module) {
4647
+ module.exports = __WEBPACK_EXTERNAL_MODULE_node_process_786449bf__;
4648
+ },
2864
4649
  "node:tty": function(module) {
2865
4650
  module.exports = __WEBPACK_EXTERNAL_MODULE_node_tty_c64aab7e__;
2866
4651
  },
@@ -3352,7 +5137,7 @@ ${section.body}` : section.body).join("\n\n"));
3352
5137
  glob: ()=>glob
3353
5138
  });
3354
5139
  var external_node_fs_ = __webpack_require__("node:fs");
3355
- var external_node_path_ = __webpack_require__("path");
5140
+ var external_node_path_ = __webpack_require__("node:path");
3356
5141
  var __require = /* @__PURE__ */ (0, __WEBPACK_EXTERNAL_MODULE_module__.createRequire)(import.meta.url);
3357
5142
  function cleanPath(path) {
3358
5143
  let normalized = (0, external_node_path_.normalize)(path);
@@ -4196,19 +5981,9 @@ __webpack_require__.m = __webpack_modules__;
4196
5981
  }
4197
5982
  };
4198
5983
  })();
4199
- var logger = __webpack_require__("./src/utils/logger.ts");
4200
- var commands = __webpack_require__("./src/cli/commands.ts");
4201
- var prepare = __webpack_require__("./src/cli/prepare.ts");
4202
- async function runCLI() {
4203
- (0, prepare.k)();
4204
- try {
4205
- (0, commands.Q)();
4206
- } catch (err) {
4207
- logger.vF.error('Failed to start Rstest CLI.');
4208
- logger.vF.error(err);
4209
- }
4210
- }
5984
+ var cli = __webpack_require__("./src/cli/index.ts");
4211
5985
  var src_config = __webpack_require__("./src/config.ts");
5986
+ var core = __webpack_require__("./src/core/index.ts");
4212
5987
  const check = (name)=>{
4213
5988
  if (!globalThis.RSTEST_API?.[name]) throw new Error(`Rstest API '${name}' is not registered yet, please make sure you are running in a rstest environment.`);
4214
5989
  };
@@ -4246,5 +6021,9 @@ const onTestFailed = wrapRstestAPI('onTestFailed');
4246
6021
  function defineConfig(config) {
4247
6022
  return config;
4248
6023
  }
6024
+ var __webpack_exports__createRstest = core.createRstest;
6025
+ var __webpack_exports__initCli = cli.X;
6026
+ var __webpack_exports__loadConfig = src_config.Z9;
4249
6027
  var __webpack_exports__mergeRstestConfig = src_config.ST;
4250
- export { afterAll, afterEach, assert, beforeAll, beforeEach, defineConfig, describe, expect, it, onTestFailed, onTestFinished, rs, rstest, runCLI, test, __webpack_exports__mergeRstestConfig as mergeRstestConfig };
6028
+ var __webpack_exports__runCLI = cli.G;
6029
+ export { afterAll, afterEach, assert, beforeAll, beforeEach, defineConfig, describe, expect, it, onTestFailed, onTestFinished, rs, rstest, test, __webpack_exports__createRstest as createRstest, __webpack_exports__initCli as initCli, __webpack_exports__loadConfig as loadConfig, __webpack_exports__mergeRstestConfig as mergeRstestConfig, __webpack_exports__runCLI as runCLI };