@rstest/core 0.9.1 → 0.9.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.
Files changed (54) hide show
  1. package/LICENSE.md +1 -1
  2. package/dist/{0~89.js → 0~8843.js} +24 -28
  3. package/dist/{0~1472.js → 0~browserLoader.js} +11 -11
  4. package/dist/{0~7882.js → 0~browser~1.js} +60 -61
  5. package/dist/{0~8426.js → 0~checkThresholds.js} +6 -6
  6. package/dist/{0~7583.js → 0~chokidar.js} +113 -72
  7. package/dist/{0~130.js → 0~console.js} +19 -20
  8. package/dist/{0~9744.js → 0~dist.js} +57 -57
  9. package/dist/{0~4403.js → 0~generate.js} +9 -6
  10. package/dist/{0~4809.js → 0~happyDom.js} +2 -2
  11. package/dist/{0~3346.js → 0~interop.js} +0 -1
  12. package/dist/{0~62.js → 0~jsdom.js} +2 -2
  13. package/dist/{0~262.js → 0~lib.js} +4 -1
  14. package/dist/{0~9634.js → 0~listTests.js} +15 -24
  15. package/dist/{0~6923.js → 0~loadEsModule.js} +7 -7
  16. package/dist/{0~5835.js → 0~loadModule.js} +11 -11
  17. package/dist/{0~6907.js → 0~magic-string.es.js} +2 -1
  18. package/dist/0~mergeReports.js +127 -0
  19. package/dist/{0~2255.js → 0~plugin.js} +2 -4
  20. package/dist/{0~6588.js → 0~restart.js} +8 -12
  21. package/dist/{0~2173.js → 0~runTests.js} +51 -60
  22. package/dist/{487.js → 1255.js} +22 -15
  23. package/dist/{6151.js → 1949.js} +41 -25
  24. package/dist/{6973.js → 255.js} +9 -10
  25. package/dist/{9131.js → 3145.js} +229 -479
  26. package/dist/{1157.js → 4411.js} +37 -37
  27. package/dist/{4484.js → 5040.js} +1 -2
  28. package/dist/{3160.js → 6830.js} +429 -106
  29. package/dist/7011.js +1 -1
  30. package/dist/{1294.js → 7552.js} +106 -83
  31. package/dist/{5734.js → 7704.js} +7 -6
  32. package/dist/browser-runtime/{2~907.js → 2~magic-string.es.js} +18 -11
  33. package/dist/browser-runtime/{389.js → 723.js} +178 -134
  34. package/dist/browser-runtime/{389.js.LICENSE.txt → 723.js.LICENSE.txt} +0 -22
  35. package/dist/browser-runtime/index.d.ts +40 -5
  36. package/dist/browser-runtime/index.js +1 -1
  37. package/dist/browser-runtime/rslib-runtime.js +11 -3
  38. package/dist/browser.d.ts +40 -5
  39. package/dist/browser.js +9 -7
  40. package/dist/globalSetupWorker.js +7 -14
  41. package/dist/index.d.ts +53 -6
  42. package/dist/index.js +2 -2
  43. package/dist/rslib-runtime.js +5 -8
  44. package/dist/worker.d.ts +30 -3
  45. package/dist/worker.js +20 -46
  46. package/package.json +19 -18
  47. package/dist/3160.js.LICENSE.txt +0 -21
  48. package/dist/4881.js +0 -2
  49. package/dist/6198.js +0 -2
  50. /package/dist/{0~7583.js.LICENSE.txt → 0~chokidar.js.LICENSE.txt} +0 -0
  51. /package/dist/{0~3062.js → 0~utils.js} +0 -0
  52. /package/dist/{6151.js.LICENSE.txt → 1949.js.LICENSE.txt} +0 -0
  53. /package/dist/{4597.js → 1983.js} +0 -0
  54. /package/dist/{1294.js.LICENSE.txt → 7552.js.LICENSE.txt} +0 -0
@@ -1,10 +1,12 @@
1
1
  import "node:module";
2
2
  import { __webpack_require__ } from "./rslib-runtime.js";
3
- import promises, { lstat, readdir, realpath, stat as promises_stat } from "node:fs/promises";
3
+ import promises from "node:fs/promises";
4
+ import node_fs, * as __rspack_external_node_fs_5ea92f0c from "node:fs";
5
+ import node_path, { basename, dirname, normalize, posix, relative as external_node_path_relative, resolve, sep } from "node:path";
4
6
  import { fileURLToPath } from "url";
5
7
  import { createRequire } from "module";
6
- import { logger as logger_logger, parsePosix, color, castArray } from "./3160.js";
7
- import { posix } from "./7011.js";
8
+ import { logger as logger_logger, parsePosix, color as logger_color, castArray } from "./6830.js";
9
+ import { posix as dist_posix } from "./7011.js";
8
10
  __webpack_require__.add({
9
11
  "../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/index.js" (module, __unused_rspack_exports, __webpack_require__) {
10
12
  const pico = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/lib/picomatch.js");
@@ -1441,12 +1443,10 @@ const globalApis = [
1441
1443
  'onTestFailed'
1442
1444
  ];
1443
1445
  const TS_CONFIG_FILE = 'tsconfig.json';
1444
- const external_node_path_ = __webpack_require__("path");
1445
- const external_node_fs_ = __webpack_require__("node:fs");
1446
1446
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
1447
1447
  function cleanPath(path) {
1448
- let normalized = (0, external_node_path_.normalize)(path);
1449
- if (normalized.length > 1 && normalized[normalized.length - 1] === external_node_path_.sep) normalized = normalized.substring(0, normalized.length - 1);
1448
+ let normalized = normalize(path);
1449
+ if (normalized.length > 1 && normalized[normalized.length - 1] === sep) normalized = normalized.substring(0, normalized.length - 1);
1450
1450
  return normalized;
1451
1451
  }
1452
1452
  const SLASHES_REGEX = /[\\/]/g;
@@ -1460,7 +1460,7 @@ function isRootDirectory(path) {
1460
1460
  function normalizePath(path, options) {
1461
1461
  const { resolvePaths, normalizePath: normalizePath$1, pathSeparator } = options;
1462
1462
  const pathNeedsCleaning = "win32" === process.platform && path.includes("/") || path.startsWith(".");
1463
- if (resolvePaths) path = (0, external_node_path_.resolve)(path);
1463
+ if (resolvePaths) path = resolve(path);
1464
1464
  if (normalizePath$1 || pathNeedsCleaning) path = cleanPath(path);
1465
1465
  if ("." === path) return "";
1466
1466
  const needsSeperator = path[path.length - 1] !== pathSeparator;
@@ -1473,7 +1473,7 @@ function joinPathWithRelativePath(root, options) {
1473
1473
  return function(filename, directoryPath) {
1474
1474
  const sameRoot = directoryPath.startsWith(root);
1475
1475
  if (sameRoot) return directoryPath.slice(root.length) + filename;
1476
- return convertSlashes((0, external_node_path_.relative)(root, directoryPath), options.pathSeparator) + options.pathSeparator + filename;
1476
+ return convertSlashes(external_node_path_relative(root, directoryPath), options.pathSeparator) + options.pathSeparator + filename;
1477
1477
  };
1478
1478
  }
1479
1479
  function joinPath(filename) {
@@ -1580,13 +1580,13 @@ function build$2(options, isSynchronous) {
1580
1580
  }
1581
1581
  function isRecursive(path, resolved, state) {
1582
1582
  if (state.options.useRealPaths) return isRecursiveUsingRealPaths(resolved, state);
1583
- let parent = (0, external_node_path_.dirname)(path);
1583
+ let parent = dirname(path);
1584
1584
  let depth = 1;
1585
1585
  while(parent !== state.root && depth < 2){
1586
1586
  const resolvedPath = state.symlinks.get(parent);
1587
1587
  const isSameRoot = !!resolvedPath && (resolvedPath === resolved || resolvedPath.startsWith(resolved) || resolved.startsWith(resolvedPath));
1588
1588
  if (isSameRoot) depth++;
1589
- else parent = (0, external_node_path_.dirname)(parent);
1589
+ else parent = dirname(parent);
1590
1590
  }
1591
1591
  state.symlinks.set(path, resolved);
1592
1592
  return depth > 1;
@@ -1728,7 +1728,7 @@ var Walker = class {
1728
1728
  ""
1729
1729
  ].slice(0, 0),
1730
1730
  controller: new Aborter(),
1731
- fs: options.fs || external_node_fs_
1731
+ fs: options.fs || __rspack_external_node_fs_5ea92f0c
1732
1732
  };
1733
1733
  this.joinPath = build$7(this.root, options);
1734
1734
  this.pushDirectory = build$6(this.root, options);
@@ -1766,8 +1766,8 @@ var Walker = class {
1766
1766
  this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath : path + pathSeparator, depth - 1, this.walk);
1767
1767
  } else {
1768
1768
  resolvedPath = useRealPaths ? resolvedPath : path;
1769
- const filename = (0, external_node_path_.basename)(resolvedPath);
1770
- const directoryPath$1 = normalizePath((0, external_node_path_.dirname)(resolvedPath), this.state.options);
1769
+ const filename = basename(resolvedPath);
1770
+ const directoryPath$1 = normalizePath(dirname(resolvedPath), this.state.options);
1771
1771
  resolvedPath = this.joinPath(filename, directoryPath$1);
1772
1772
  this.pushFile(resolvedPath, files, this.state.counts, filters);
1773
1773
  }
@@ -1818,7 +1818,7 @@ var Builder = class {
1818
1818
  options = {
1819
1819
  maxDepth: 1 / 0,
1820
1820
  suppressErrors: true,
1821
- pathSeparator: external_node_path_.sep,
1821
+ pathSeparator: sep,
1822
1822
  filters: []
1823
1823
  };
1824
1824
  globFunction;
@@ -1983,8 +1983,8 @@ function buildFormat(cwd, root, absolute) {
1983
1983
  };
1984
1984
  return (p, isDir)=>isDir && "." !== p ? p.slice(0, -1) : p;
1985
1985
  }
1986
- if (absolute) return (p)=>external_node_path_.posix.relative(cwd, p) || ".";
1987
- return (p)=>external_node_path_.posix.relative(cwd, `${root}/${p}`) || ".";
1986
+ if (absolute) return (p)=>posix.relative(cwd, p) || ".";
1987
+ return (p)=>posix.relative(cwd, `${root}/${p}`) || ".";
1988
1988
  }
1989
1989
  function buildRelative(cwd, root) {
1990
1990
  if (root.startsWith(`${cwd}/`)) {
@@ -1992,7 +1992,7 @@ function buildRelative(cwd, root) {
1992
1992
  return (p)=>`${prefix}/${p}`;
1993
1993
  }
1994
1994
  return (p)=>{
1995
- const result = external_node_path_.posix.relative(cwd, `${root}/${p}`);
1995
+ const result = posix.relative(cwd, `${root}/${p}`);
1996
1996
  if (p.endsWith("/") && "" !== result) return `${result}/`;
1997
1997
  return result || ".";
1998
1998
  };
@@ -2028,7 +2028,7 @@ function normalizePattern(pattern, expandDirectories, cwd, props, isIgnore) {
2028
2028
  if (pattern.endsWith("/")) result = pattern.slice(0, -1);
2029
2029
  if (!result.endsWith("*") && expandDirectories) result += "/**";
2030
2030
  const escapedCwd = escapePath(cwd);
2031
- result = external_node_path_["default"].isAbsolute(result.replace(ESCAPING_BACKSLASHES, "")) ? external_node_path_.posix.relative(escapedCwd, result) : external_node_path_.posix.normalize(result);
2031
+ result = node_path.isAbsolute(result.replace(ESCAPING_BACKSLASHES, "")) ? posix.relative(escapedCwd, result) : posix.normalize(result);
2032
2032
  const parentDirectoryMatch = PARENT_DIRECTORY.exec(result);
2033
2033
  const parts = splitPattern(result);
2034
2034
  if (null == parentDirectoryMatch ? void 0 : parentDirectoryMatch[0]) {
@@ -2039,7 +2039,7 @@ function normalizePattern(pattern, expandDirectories, cwd, props, isIgnore) {
2039
2039
  result = result.slice(0, (n - i - 1) * 3) + result.slice((n - i) * 3 + parts[i + n].length + 1) || ".";
2040
2040
  i++;
2041
2041
  }
2042
- const potentialRoot = external_node_path_.posix.join(cwd, parentDirectoryMatch[0].slice(3 * i));
2042
+ const potentialRoot = posix.join(cwd, parentDirectoryMatch[0].slice(3 * i));
2043
2043
  if (!potentialRoot.startsWith(".") && props.root.length > potentialRoot.length) {
2044
2044
  props.root = potentialRoot;
2045
2045
  props.depthOffset = -n + i;
@@ -2060,7 +2060,7 @@ function normalizePattern(pattern, expandDirectories, cwd, props, isIgnore) {
2060
2060
  }
2061
2061
  props.depthOffset = newCommonPath.length;
2062
2062
  props.commonPath = newCommonPath;
2063
- props.root = newCommonPath.length > 0 ? external_node_path_.posix.join(cwd, ...newCommonPath) : cwd;
2063
+ props.root = newCommonPath.length > 0 ? posix.join(cwd, ...newCommonPath) : cwd;
2064
2064
  }
2065
2065
  return result;
2066
2066
  }
@@ -2097,7 +2097,7 @@ function formatPaths(paths, relative) {
2097
2097
  function normalizeCwd(cwd) {
2098
2098
  if (!cwd) return process.cwd().replace(BACKSLASHES, "/");
2099
2099
  if (cwd instanceof URL) return fileURLToPath(cwd).replace(BACKSLASHES, "/");
2100
- return external_node_path_["default"].resolve(cwd).replace(BACKSLASHES, "/");
2100
+ return node_path.resolve(cwd).replace(BACKSLASHES, "/");
2101
2101
  }
2102
2102
  function getCrawler(patterns, inputOptions = {}) {
2103
2103
  const options = process.env.TINYGLOBBY_DEBUG ? {
@@ -2162,12 +2162,12 @@ function getCrawler(patterns, inputOptions = {}) {
2162
2162
  return "." !== relativePath && !partialMatcher(relativePath) || ignore(relativePath);
2163
2163
  },
2164
2164
  fs: options.fs ? {
2165
- readdir: options.fs.readdir || external_node_fs_["default"].readdir,
2166
- readdirSync: options.fs.readdirSync || external_node_fs_["default"].readdirSync,
2167
- realpath: options.fs.realpath || external_node_fs_["default"].realpath,
2168
- realpathSync: options.fs.realpathSync || external_node_fs_["default"].realpathSync,
2169
- stat: options.fs.stat || external_node_fs_["default"].stat,
2170
- statSync: options.fs.statSync || external_node_fs_["default"].statSync
2165
+ readdir: options.fs.readdir || node_fs.readdir,
2166
+ readdirSync: options.fs.readdirSync || node_fs.readdirSync,
2167
+ realpath: options.fs.realpath || node_fs.realpath,
2168
+ realpathSync: options.fs.realpathSync || node_fs.realpathSync,
2169
+ stat: options.fs.stat || node_fs.stat,
2170
+ statSync: options.fs.statSync || node_fs.statSync
2171
2171
  } : void 0,
2172
2172
  pathSeparator: "/",
2173
2173
  relativePaths: true,
@@ -2208,12 +2208,12 @@ async function glob(patternsOrOptions, options) {
2208
2208
  }
2209
2209
  const filterFiles = (testFiles, filters, dir)=>{
2210
2210
  if (!filters.length) return testFiles;
2211
- const fileFilters = 'win32' === process.platform ? filters.map((f)=>f.split(posix.sep).join('/')) : filters;
2211
+ const fileFilters = 'win32' === process.platform ? filters.map((f)=>f.split(dist_posix.sep).join('/')) : filters;
2212
2212
  return testFiles.filter((t)=>{
2213
- const testFile = posix.relative(dir, t).toLocaleLowerCase();
2213
+ const testFile = dist_posix.relative(dir, t).toLocaleLowerCase();
2214
2214
  return fileFilters.some((f)=>{
2215
- if (posix.isAbsolute(f) && t.startsWith(f)) return true;
2216
- const relativePath = f.endsWith('/') ? posix.join(posix.relative(dir, f), '/') : posix.relative(dir, f);
2215
+ if (dist_posix.isAbsolute(f) && t.startsWith(f)) return true;
2216
+ const relativePath = f.endsWith('/') ? dist_posix.join(dist_posix.relative(dir, f), '/') : dist_posix.relative(dir, f);
2217
2217
  return testFile.includes(f.toLocaleLowerCase()) || testFile.includes(relativePath.toLocaleLowerCase());
2218
2218
  });
2219
2219
  });
@@ -2257,7 +2257,7 @@ const getTestEntries = async ({ include, exclude, rootPath, projectRoot, fileFil
2257
2257
  }));
2258
2258
  }
2259
2259
  return Object.fromEntries(filterFiles(testFiles, fileFilters, rootPath).map((entry)=>{
2260
- const relativePath = posix.relative(rootPath, entry);
2260
+ const relativePath = dist_posix.relative(rootPath, entry);
2261
2261
  return [
2262
2262
  formatTestEntryName(relativePath),
2263
2263
  entry
@@ -2266,11 +2266,11 @@ const getTestEntries = async ({ include, exclude, rootPath, projectRoot, fileFil
2266
2266
  };
2267
2267
  const prettyTestPath = (testPath)=>{
2268
2268
  const { dir, base } = parsePosix(testPath);
2269
- return `${'.' !== dir ? color.gray(`${dir}/`) : ''}${color.cyan(base)}`;
2269
+ return `${'.' !== dir ? logger_color.gray(`${dir}/`) : ''}${logger_color.cyan(base)}`;
2270
2270
  };
2271
2271
  const formatTestPath = (root, testFilePath)=>{
2272
2272
  let testPath = testFilePath;
2273
- if (posix.isAbsolute(testPath) && testPath.includes(root)) testPath = posix.relative(root, testPath);
2273
+ if (dist_posix.isAbsolute(testPath) && testPath.includes(root)) testPath = dist_posix.relative(root, testPath);
2274
2274
  return prettyTestPath(testPath);
2275
2275
  };
2276
2276
  function getShardedFiles(files, shard) {
@@ -2304,7 +2304,7 @@ async function resolveShardedEntries(context) {
2304
2304
  const shardedEntries = getShardedFiles(allTestEntriesBeforeSharding, shard);
2305
2305
  const totalTestFileCount = allTestEntriesBeforeSharding.length;
2306
2306
  const testFilesInShardCount = shardedEntries.length;
2307
- logger_logger.log(color.green(`Running shard ${shard.index} of ${shard.count} (${testFilesInShardCount} of ${totalTestFileCount} test files)\n`));
2307
+ logger_logger.log(logger_color.green(`Running shard ${shard.index} of ${shard.count} (${testFilesInShardCount} of ${totalTestFileCount} test files)\n`));
2308
2308
  const shardedEntriesByProject = new Map();
2309
2309
  for (const { project, alias, testPath } of shardedEntries){
2310
2310
  if (!shardedEntriesByProject.has(project)) shardedEntriesByProject.set(project, {});
@@ -2317,4 +2317,4 @@ async function resolveShardedEntries(context) {
2317
2317
  });
2318
2318
  return entriesCache;
2319
2319
  }
2320
- export { DEFAULT_CONFIG_EXTENSIONS, DEFAULT_CONFIG_NAME, ROOT_SUITE_NAME, TEMP_RSTEST_OUTPUT_DIR, TEMP_RSTEST_OUTPUT_DIR_GLOB, TS_CONFIG_FILE, filterProjects, formatTestEntryName, formatTestPath, getTestEntries, glob, globalApis, isDynamicPattern, lstat, prettyTestPath, promises, promises_stat, readdir, realpath, resolveShardedEntries };
2320
+ export { DEFAULT_CONFIG_EXTENSIONS, DEFAULT_CONFIG_NAME, ROOT_SUITE_NAME, TEMP_RSTEST_OUTPUT_DIR, TEMP_RSTEST_OUTPUT_DIR_GLOB, TS_CONFIG_FILE, filterProjects, formatTestEntryName, formatTestPath, getTestEntries, glob, globalApis, isDynamicPattern, prettyTestPath, resolveShardedEntries };
@@ -1,5 +1,4 @@
1
1
  import "node:module";
2
- import * as __rspack_external__rsbuild_core_1b356efc from "@rsbuild/core";
3
2
  const check = (name)=>{
4
3
  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.`);
5
4
  };
@@ -34,4 +33,4 @@ const rstest = wrapRstestUtilitiesAPI('rstest');
34
33
  const rs = wrapRstestUtilitiesAPI('rs');
35
34
  const onTestFinished = wrapRstestAPI('onTestFinished');
36
35
  const onTestFailed = wrapRstestAPI('onTestFailed');
37
- export { __rspack_external__rsbuild_core_1b356efc as rsbuild, afterAll, afterEach, assert, beforeAll, beforeEach, describe, expect, it, onTestFailed, onTestFinished, rs, rstest, test };
36
+ export { afterAll, afterEach, assert, beforeAll, beforeEach, describe, expect, it, onTestFailed, onTestFinished, rs, rstest, test };