@rstest/core 0.7.4 → 0.7.5

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/0~130.js CHANGED
@@ -3,7 +3,7 @@ import 'module';
3
3
  import { __webpack_require__ } from "./rslib-runtime.js";
4
4
  import { AssertionError, strict } from "node:assert";
5
5
  import { Console } from "node:console";
6
- import "./664.js";
6
+ import "./693.js";
7
7
  import { prettyTime } from "./157.js";
8
8
  const external_node_util_ = __webpack_require__("node:util");
9
9
  const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
package/dist/0~151.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import 'module';
3
3
  /*#__PURE__*/ import.meta.url;
4
4
  import { __webpack_require__ } from "./rslib-runtime.js";
5
- import "./664.js";
5
+ import "./693.js";
6
6
  import { resolve as pathe_M_eThtNZ_resolve } from "./278.js";
7
7
  import { getTaskNameWithPrefix, isObject as helper_isObject, castArray, ROOT_SUITE_NAME } from "./157.js";
8
8
  import { getRealTimers, TestRegisterError, formatTestError, formatName } from "./913.js";
package/dist/0~173.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import 'module';
2
2
  /*#__PURE__*/ import.meta.url;
3
3
  import { __webpack_require__ } from "./rslib-runtime.js";
4
- import "./664.js";
5
- import { getTestEntries, getSetupFiles, isTTY } from "./157.js";
4
+ import "./693.js";
5
+ import { getTestEntries, isTTY } from "./157.js";
6
6
  import { createCoverageProvider } from "./734.js";
7
7
  import { prepareRsbuild, createPool, createRsbuildServer, runGlobalTeardown, runGlobalSetup } from "./0~89.js";
8
8
  import { clearScreen, logger_logger } from "./278.js";
@@ -168,6 +168,9 @@ async function runTests(context) {
168
168
  });
169
169
  return entries;
170
170
  };
171
+ const { getSetupFiles } = await import("./0~973.js").then((mod)=>({
172
+ getSetupFiles: mod.getSetupFiles
173
+ }));
171
174
  const setupFiles = Object.fromEntries(context.projects.map((project)=>{
172
175
  const { environmentName, rootPath, normalizedConfig: { setupFiles } } = project;
173
176
  return [
@@ -183,12 +186,14 @@ async function runTests(context) {
183
186
  ];
184
187
  }));
185
188
  const rsbuildInstance = await prepareRsbuild(context, globTestSourceEntries, setupFiles, globalSetupFiles);
189
+ const isWatchMode = 'watch' === command;
186
190
  const { getRsbuildStats, closeServer } = await createRsbuildServer({
187
191
  inspectedConfig: {
188
192
  ...context.normalizedConfig,
189
193
  projects: context.projects.map((p)=>p.normalizedConfig)
190
194
  },
191
- globTestSourceEntries: 'watch' === command ? globTestSourceEntries : async (name)=>{
195
+ isWatchMode,
196
+ globTestSourceEntries: isWatchMode ? globTestSourceEntries : async (name)=>{
192
197
  if (entriesCache.has(name)) return entriesCache.get(name).entries;
193
198
  return globTestSourceEntries(name);
194
199
  },
package/dist/0~255.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import 'module';
2
2
  /*#__PURE__*/ import.meta.url;
3
3
  import { __webpack_require__ } from "./rslib-runtime.js";
4
- import "./664.js";
5
- const external_node_fs_ = __webpack_require__("fs");
4
+ import "./693.js";
5
+ const external_node_fs_ = __webpack_require__("node:fs");
6
6
  const pluginCoverageCore = (coverageOptions)=>({
7
7
  name: 'rstest:coverage-core',
8
8
  setup: (api)=>{
package/dist/0~426.js CHANGED
@@ -2,7 +2,7 @@ import 'module';
2
2
  /*#__PURE__*/ import.meta.url;
3
3
  import { __webpack_require__ } from "./rslib-runtime.js";
4
4
  import "./157.js";
5
- import "./664.js";
5
+ import "./693.js";
6
6
  import { relative } from "./278.js";
7
7
  const picomatch = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/index.js");
8
8
  var picomatch_default = /*#__PURE__*/ __webpack_require__.n(picomatch);
package/dist/0~583.js CHANGED
@@ -4,7 +4,7 @@ import 'module';
4
4
  import { __webpack_require__ } from "./rslib-runtime.js";
5
5
  import { lstat, open as promises_open, readdir, realpath as promises_realpath, stat as promises_stat } from "fs/promises";
6
6
  import { Readable } from "node:stream";
7
- import "./664.js";
7
+ import "./693.js";
8
8
  import { readdir as promises_readdir, lstat as promises_lstat, promises_stat as promises_promises_stat, realpath as external_node_fs_promises_realpath } from "./157.js";
9
9
  import { EventEmitter } from "./131.js";
10
10
  const external_node_path_ = __webpack_require__("node:path");
@@ -221,7 +221,7 @@ function readdirp(root, options = {}) {
221
221
  options.root = root;
222
222
  return new ReaddirpStream(options);
223
223
  }
224
- const external_node_fs_ = __webpack_require__("fs");
224
+ const external_node_fs_ = __webpack_require__("node:fs");
225
225
  const external_node_os_ = __webpack_require__("node:os");
226
226
  const STR_DATA = 'data';
227
227
  const STR_END = 'end';
package/dist/0~588.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import 'module';
2
2
  /*#__PURE__*/ import.meta.url;
3
3
  import { __webpack_require__ } from "./rslib-runtime.js";
4
- import "./664.js";
4
+ import "./693.js";
5
5
  import { runRest } from "./131.js";
6
6
  import { isTTY } from "./157.js";
7
7
  import { logger_logger } from "./278.js";
package/dist/0~634.js CHANGED
@@ -1,15 +1,18 @@
1
1
  import 'module';
2
2
  /*#__PURE__*/ import.meta.url;
3
3
  import { __webpack_require__ } from "./rslib-runtime.js";
4
- import "./664.js";
4
+ import "./693.js";
5
5
  import { prepareRsbuild, createPool, createRsbuildServer, runGlobalTeardown, runGlobalSetup } from "./0~89.js";
6
- import { getTestEntries, getSetupFiles, getTaskNameWithPrefix, prettyTestPath, ROOT_SUITE_NAME, bgColor } from "./157.js";
6
+ import { getTestEntries, getTaskNameWithPrefix, prettyTestPath, ROOT_SUITE_NAME, bgColor } from "./157.js";
7
7
  import { logger_logger } from "./278.js";
8
- const external_node_fs_ = __webpack_require__("fs");
8
+ const external_node_fs_ = __webpack_require__("node:fs");
9
9
  const external_node_path_ = __webpack_require__("node:path");
10
10
  const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
11
11
  var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
12
12
  const collectTests = async ({ context, globTestSourceEntries })=>{
13
+ const { getSetupFiles } = await import("./0~973.js").then((mod)=>({
14
+ getSetupFiles: mod.getSetupFiles
15
+ }));
13
16
  const setupFiles = Object.fromEntries(context.projects.map((project)=>{
14
17
  const { environmentName, rootPath, normalizedConfig: { setupFiles } } = project;
15
18
  return [
@@ -28,6 +31,7 @@ const collectTests = async ({ context, globTestSourceEntries })=>{
28
31
  const { getRsbuildStats, closeServer } = await createRsbuildServer({
29
32
  globTestSourceEntries,
30
33
  globalSetupFiles,
34
+ isWatchMode: false,
31
35
  inspectedConfig: {
32
36
  ...context.normalizedConfig,
33
37
  projects: context.projects.map((p)=>p.normalizedConfig)
package/dist/0~835.js CHANGED
@@ -1,7 +1,8 @@
1
1
  import 'module';
2
2
  /*#__PURE__*/ import.meta.url;
3
3
  import { __webpack_require__ } from "./rslib-runtime.js";
4
- import { createRequire as external_node_module_createRequire } from "./664.js";
4
+ import "./693.js";
5
+ import { createRequire as external_node_module_createRequire } from "./881.js";
5
6
  import { pathToFileURL } from "./198.js";
6
7
  import { node_vm, asModule, shouldInterop, interopModule } from "./0~346.js";
7
8
  import { posix, logger_logger } from "./278.js";
package/dist/0~89.js CHANGED
@@ -4,11 +4,12 @@ import { __webpack_require__ } from "./rslib-runtime.js";
4
4
  import node_events from "node:events";
5
5
  import { Tinypool } from "tinypool";
6
6
  import node_inspector from "node:inspector";
7
- import { isBuiltin } from "./664.js";
7
+ import "./693.js";
8
8
  import { node_process, basename, isDebug, dirname, posix, resolve as pathe_M_eThtNZ_resolve, join } from "./278.js";
9
9
  import { fileURLToPath } from "./198.js";
10
10
  import { node_v8, createBirpc } from "./216.js";
11
11
  import { serializableConfig, bgColor, TEMP_RSTEST_OUTPUT_DIR, TEMP_RSTEST_OUTPUT_DIR_GLOB, castArray, ADDITIONAL_NODE_BUILTINS, needFlagExperimentalDetectModule } from "./157.js";
12
+ import { isBuiltin } from "./881.js";
12
13
  import { core_logger, createRsbuild } from "./131.js";
13
14
  const DefaultMaxHeapSize = 1073741824;
14
15
  function memory_isMemorySufficient(options) {
@@ -663,7 +664,7 @@ const pluginInspect = ()=>enable ? {
663
664
  });
664
665
  }
665
666
  } : null;
666
- const external_node_fs_ = __webpack_require__("fs");
667
+ const external_node_fs_ = __webpack_require__("node:fs");
667
668
  const mockRuntime_dirname = external_node_path_["default"].dirname(fileURLToPath(import.meta.url));
668
669
  class MockRuntimeRspackPlugin {
669
670
  outputModule;
@@ -849,50 +850,79 @@ const prepareRsbuild = async (context, globTestSourceEntries, setupFiles, global
849
850
  }
850
851
  return rsbuildInstance;
851
852
  };
852
- const calcEntriesToRerun = (entries, chunks, buildData, runtimeChunkName)=>{
853
- const entryToChunkHashesMap = new Map();
854
- const buildChunkHashes = (entry)=>{
853
+ const calcEntriesToRerun = (entries, chunks, buildData, runtimeChunkName, setupEntries)=>{
854
+ const buildChunkHashes = (entry, map)=>{
855
855
  const validChunks = (entry.chunks || []).filter((chunk)=>chunk !== runtimeChunkName);
856
856
  validChunks.forEach((chunkName)=>{
857
857
  const chunkInfo = chunks?.find((c)=>c.names?.includes(chunkName));
858
858
  if (chunkInfo) {
859
- const existing = entryToChunkHashesMap.get(entry.testPath) || {};
859
+ const existing = map.get(entry.testPath) || {};
860
860
  existing[chunkName] = chunkInfo.hash ?? '';
861
- entryToChunkHashesMap.set(entry.testPath, existing);
861
+ map.set(entry.testPath, existing);
862
862
  }
863
863
  });
864
864
  };
865
- (entries || []).forEach(buildChunkHashes);
865
+ const processEntryChanges = (_entries, prevHashes, currentHashesMap)=>{
866
+ const affectedPaths = new Set();
867
+ const deletedPaths = [];
868
+ if (prevHashes) {
869
+ const prevMap = new Map(prevHashes.map((e)=>[
870
+ e.name,
871
+ e.chunks
872
+ ]));
873
+ const currentNames = new Set(currentHashesMap.keys());
874
+ deletedPaths.push(...Array.from(prevMap.keys()).filter((name)=>!currentNames.has(name)));
875
+ const findAffectedEntry = (testPath)=>{
876
+ const currentChunks = currentHashesMap.get(testPath);
877
+ const prevChunks = prevMap.get(testPath);
878
+ if (!currentChunks) return;
879
+ if (!prevChunks) return void affectedPaths.add(testPath);
880
+ const hasChanges = Object.entries(currentChunks).some(([chunkName, hash])=>prevChunks[chunkName] !== hash);
881
+ if (hasChanges) affectedPaths.add(testPath);
882
+ };
883
+ currentHashesMap.forEach((_, testPath)=>{
884
+ findAffectedEntry(testPath);
885
+ });
886
+ }
887
+ return {
888
+ affectedPaths,
889
+ deletedPaths
890
+ };
891
+ };
892
+ const previousSetupHashes = buildData.setupEntryToChunkHashes;
893
+ const previousEntryHashes = buildData.entryToChunkHashes;
894
+ const setupEntryToChunkHashesMap = new Map();
895
+ setupEntries.forEach((entry)=>{
896
+ buildChunkHashes(entry, setupEntryToChunkHashesMap);
897
+ });
898
+ const setupEntryToChunkHashes = Array.from(setupEntryToChunkHashesMap.entries()).map(([name, chunks])=>({
899
+ name,
900
+ chunks
901
+ }));
902
+ buildData.setupEntryToChunkHashes = setupEntryToChunkHashes;
903
+ const entryToChunkHashesMap = new Map();
904
+ (entries || []).forEach((entry)=>{
905
+ buildChunkHashes(entry, entryToChunkHashesMap);
906
+ });
866
907
  const entryToChunkHashes = Array.from(entryToChunkHashesMap.entries()).map(([name, chunks])=>({
867
908
  name,
868
909
  chunks
869
910
  }));
870
- const affectedTestPaths = new Set();
871
- const deletedEntries = [];
872
- if (buildData.entryToChunkHashes) {
873
- const prevMap = new Map(buildData.entryToChunkHashes.map((e)=>[
874
- e.name,
875
- e.chunks
876
- ]));
877
- const currentNames = new Set(entryToChunkHashesMap.keys());
878
- deletedEntries.push(...Array.from(prevMap.keys()).filter((name)=>!currentNames.has(name)));
879
- const findAffectedEntry = (testPath)=>{
880
- const currentChunks = entryToChunkHashesMap.get(testPath);
881
- const prevChunks = prevMap.get(testPath);
882
- if (!currentChunks) return;
883
- if (!prevChunks) return void affectedTestPaths.add(testPath);
884
- const hasChanges = Object.entries(currentChunks).some(([chunkName, hash])=>prevChunks[chunkName] !== hash);
885
- if (hasChanges) affectedTestPaths.add(testPath);
886
- };
887
- entryToChunkHashesMap.forEach((_, testPath)=>{
888
- findAffectedEntry(testPath);
889
- });
890
- }
891
911
  buildData.entryToChunkHashes = entryToChunkHashes;
912
+ const isSetupChanged = ()=>{
913
+ const { affectedPaths: affectedSetupPaths, deletedPaths: deletedSetups } = processEntryChanges(setupEntries, previousSetupHashes, setupEntryToChunkHashesMap);
914
+ const affectedSetups = Array.from(affectedSetupPaths).map((testPath)=>setupEntries.find((e)=>e.testPath === testPath)).filter((entry)=>void 0 !== entry);
915
+ return affectedSetups.length > 0 || deletedSetups.length > 0;
916
+ };
917
+ if (isSetupChanged()) return {
918
+ affectedEntries: entries,
919
+ deletedEntries: []
920
+ };
921
+ const { affectedPaths: affectedTestPaths, deletedPaths } = processEntryChanges(entries, previousEntryHashes, entryToChunkHashesMap);
892
922
  const affectedEntries = Array.from(affectedTestPaths).map((testPath)=>entries.find((e)=>e.testPath === testPath)).filter((entry)=>void 0 !== entry);
893
923
  return {
894
924
  affectedEntries,
895
- deletedEntries
925
+ deletedEntries: deletedPaths
896
926
  };
897
927
  };
898
928
  class AssetsMemorySafeMap extends Map {
@@ -902,7 +932,7 @@ class AssetsMemorySafeMap extends Map {
902
932
  return super.set(key, value);
903
933
  }
904
934
  }
905
- const createRsbuildServer = async ({ globTestSourceEntries, setupFiles, globalSetupFiles, rsbuildInstance, inspectedConfig })=>{
935
+ const createRsbuildServer = async ({ globTestSourceEntries, setupFiles, globalSetupFiles, rsbuildInstance, inspectedConfig, isWatchMode })=>{
906
936
  let rspackCompiler;
907
937
  const rstestCompilerPlugin = {
908
938
  name: 'rstest:compiler',
@@ -1015,7 +1045,10 @@ const createRsbuildServer = async ({ globTestSourceEntries, setupFiles, globalSe
1015
1045
  ];
1016
1046
  }));
1017
1047
  buildData[environmentName] ??= {};
1018
- const { affectedEntries, deletedEntries } = calcEntriesToRerun(entries, chunks, buildData[environmentName], `${environmentName}-${RUNTIME_CHUNK_NAME}`);
1048
+ const { affectedEntries, deletedEntries } = isWatchMode ? calcEntriesToRerun(entries, chunks, buildData[environmentName], `${environmentName}-${RUNTIME_CHUNK_NAME}`, setupEntries) : {
1049
+ affectedEntries: [],
1050
+ deletedEntries: []
1051
+ };
1019
1052
  const cachedAssetFiles = new AssetsMemorySafeMap();
1020
1053
  const cachedSourceMaps = new AssetsMemorySafeMap();
1021
1054
  const readFileWithCache = async (name)=>{
package/dist/0~919.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import 'module';
2
2
  /*#__PURE__*/ import.meta.url;
3
3
  import { __webpack_require__ } from "./rslib-runtime.js";
4
- import "./664.js";
4
+ import "./693.js";
5
5
  __webpack_require__.add({
6
6
  "../../node_modules/.pnpm/js-tokens@4.0.0/node_modules/js-tokens/index.js" (__unused_rspack_module, exports) {
7
7
  Object.defineProperty(exports, "__esModule", {
package/dist/0~923.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import 'module';
2
2
  /*#__PURE__*/ import.meta.url;
3
3
  import { __webpack_require__ } from "./rslib-runtime.js";
4
- import "./664.js";
4
+ import "./693.js";
5
5
  import { pathToFileURL } from "./198.js";
6
6
  import { node_vm, interopModule, shouldInterop } from "./0~346.js";
7
7
  import { posix, logger_logger } from "./278.js";
package/dist/0~973.js ADDED
@@ -0,0 +1,50 @@
1
+ import 'module';
2
+ /*#__PURE__*/ import.meta.url;
3
+ import { __webpack_require__ } from "./rslib-runtime.js";
4
+ import "./693.js";
5
+ import { fileURLToPath } from "./198.js";
6
+ import { rspack } from "./131.js";
7
+ import { getAbsolutePath, formatTestEntryName } from "./157.js";
8
+ import { posix } from "./278.js";
9
+ const external_node_fs_ = __webpack_require__("node:fs");
10
+ const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
11
+ var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
12
+ const tryResolve = (request, rootPath)=>{
13
+ const { resolver } = rspack.experiments;
14
+ const esmFirstResolver = new resolver.ResolverFactory({
15
+ conditionNames: [
16
+ 'node',
17
+ 'import',
18
+ 'require'
19
+ ]
20
+ });
21
+ const { path: resolvedPath } = esmFirstResolver.sync(rootPath, request);
22
+ return resolvedPath;
23
+ };
24
+ const getSetupFiles = (setups, rootPath)=>{
25
+ if (!setups.length) return {};
26
+ return Object.fromEntries(setups.map((filePath)=>{
27
+ const setupFile = filePath.startsWith('file://') ? fileURLToPath(filePath) : filePath;
28
+ const setupFilePath = getAbsolutePath(rootPath, setupFile);
29
+ try {
30
+ if (!(0, external_node_fs_.existsSync)(setupFilePath)) {
31
+ let errorMessage = `Setup file ${picocolors_default().red(setupFile)} not found`;
32
+ if (setupFilePath !== setupFile) errorMessage += picocolors_default().gray(` (resolved path: ${setupFilePath})`);
33
+ throw errorMessage;
34
+ }
35
+ const relativePath = posix.relative(rootPath, setupFilePath);
36
+ return [
37
+ formatTestEntryName(relativePath),
38
+ setupFilePath
39
+ ];
40
+ } catch (err) {
41
+ const resolvedPath = tryResolve(setupFile, rootPath);
42
+ if (resolvedPath) return [
43
+ formatTestEntryName(setupFile),
44
+ resolvedPath
45
+ ];
46
+ throw err;
47
+ }
48
+ }));
49
+ };
50
+ export { getSetupFiles };
package/dist/131.js CHANGED
@@ -2,8 +2,8 @@ import 'module';
2
2
  /*#__PURE__*/ import.meta.url;
3
3
  import { __webpack_require__ } from "./rslib-runtime.js";
4
4
  import { EventEmitter } from "events";
5
- import { createRsbuild, loadConfig, logger as core_logger, mergeRsbuildConfig } from "@rsbuild/core";
6
- import "./664.js";
5
+ import { createRsbuild, loadConfig, logger as core_logger, mergeRsbuildConfig, rspack } from "@rsbuild/core";
6
+ import "./693.js";
7
7
  import { basename, logger_logger, dirname, posix, resolve as pathe_M_eThtNZ_resolve, isDebug, isAbsolute, relative, join, normalize } from "./278.js";
8
8
  import { isTTY, DEFAULT_CONFIG_NAME, globalApis, filterProjects, getAbsolutePath, bgColor, formatRootStr, isDynamicPattern, glob, writeFile, castArray, prettyTestPath, prettyTime, TEMP_RSTEST_OUTPUT_DIR_GLOB, getTaskNameWithPrefix, formatTestPath, formatError, DEFAULT_CONFIG_EXTENSIONS, TS_CONFIG_FILE } from "./157.js";
9
9
  import { parse as stack_trace_parser_esm_parse } from "./672.js";
@@ -503,7 +503,7 @@ function prepareCli() {
503
503
  if (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) logger_logger.log();
504
504
  }
505
505
  function showRstest() {
506
- logger_logger.greet(" Rstest v0.7.4");
506
+ logger_logger.greet(" Rstest v0.7.5");
507
507
  logger_logger.log('');
508
508
  }
509
509
  const applyCommonOptions = (cli)=>{
@@ -547,7 +547,7 @@ const runRest = async ({ options, filters, command })=>{
547
547
  function setupCommands() {
548
548
  const cli = dist('rstest');
549
549
  cli.help();
550
- cli.version("0.7.4");
550
+ cli.version("0.7.5");
551
551
  applyCommonOptions(cli);
552
552
  cli.command('[...filters]', 'run tests').option('-w, --watch', 'Run tests in watch mode').action(async (filters, options)=>{
553
553
  showRstest();
@@ -607,7 +607,7 @@ function setupCommands() {
607
607
  });
608
608
  cli.parse();
609
609
  }
610
- const external_node_fs_ = __webpack_require__("fs");
610
+ const external_node_fs_ = __webpack_require__("node:fs");
611
611
  const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
612
612
  var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
613
613
  const findConfig = (basePath)=>DEFAULT_CONFIG_EXTENSIONS.map((ext)=>basePath + ext).find(external_node_fs_["default"].existsSync);
@@ -793,12 +793,14 @@ function mergeWithCLIOptions(config, options) {
793
793
  }
794
794
  async function resolveConfig(options) {
795
795
  const { content: config, filePath: configFilePath } = await config_loadConfig({
796
- cwd: options.root,
796
+ cwd: options.cwd,
797
797
  path: options.config,
798
798
  configLoader: options.configLoader
799
799
  });
800
+ const mergedConfig = mergeWithCLIOptions(config, options);
801
+ if (!mergedConfig.root) mergedConfig.root = options.cwd;
800
802
  return {
801
- config: mergeWithCLIOptions(config, options),
803
+ config: mergedConfig,
802
804
  configFilePath: configFilePath ?? void 0
803
805
  };
804
806
  }
@@ -860,7 +862,7 @@ async function resolveProjects({ config, root, options }) {
860
862
  const { config, configFilePath } = await resolveConfig({
861
863
  ...options,
862
864
  config: isDirectory ? void 0 : project,
863
- root: projectRoot
865
+ cwd: projectRoot
864
866
  });
865
867
  if (configFilePath) {
866
868
  if (resolvedProjectPaths.has(configFilePath)) return;
@@ -902,7 +904,7 @@ async function init_initCli(options) {
902
904
  const root = options.root ? getAbsolutePath(cwd, options.root) : cwd;
903
905
  const { config, configFilePath } = await resolveConfig({
904
906
  ...options,
905
- root
907
+ cwd: options.root ? getAbsolutePath(cwd, options.root) : cwd
906
908
  });
907
909
  const projects = await resolveProjects({
908
910
  config,
@@ -2362,7 +2364,7 @@ class Rstest {
2362
2364
  });
2363
2365
  this.reporters = reporters;
2364
2366
  this.snapshotManager = snapshotManager;
2365
- this.version = "0.7.4";
2367
+ this.version = "0.7.5";
2366
2368
  this.rootPath = rootPath;
2367
2369
  this.originalConfig = userConfig;
2368
2370
  this.normalizedConfig = rstestConfig;
@@ -2507,4 +2509,4 @@ function defineConfig(config) {
2507
2509
  function defineProject(config) {
2508
2510
  return config;
2509
2511
  }
2510
- export { EventEmitter, afterAll, afterEach, assert, beforeAll, beforeEach, config_loadConfig as loadConfig, core_createRstest as createRstest, core_logger, createRsbuild, defineConfig, defineProject, describe, error_printError, expect, init_initCli as initCli, it, mergeProjectConfig, mergeRstestConfig, onTestFailed, onTestFinished, public_rstest as rstest, public_test as test, rs, runCLI, runRest };
2512
+ export { EventEmitter, afterAll, afterEach, assert, beforeAll, beforeEach, config_loadConfig as loadConfig, core_createRstest as createRstest, core_logger, createRsbuild, defineConfig, defineProject, describe, error_printError, expect, init_initCli as initCli, it, mergeProjectConfig, mergeRstestConfig, onTestFailed, onTestFinished, public_rstest as rstest, public_test as test, rs, rspack, runCLI, runRest };
package/dist/157.js CHANGED
@@ -4,7 +4,7 @@ import { __webpack_require__ } from "./rslib-runtime.js";
4
4
  import { fileURLToPath } from "url";
5
5
  import { createRequire } from "module";
6
6
  import promises, { lstat, readdir, realpath, stat as promises_stat, writeFile } from "node:fs/promises";
7
- import { createRequire as external_node_module_createRequire } from "./664.js";
7
+ import "./693.js";
8
8
  import { normalize, isAbsolute, posix, join, parse } from "./278.js";
9
9
  __webpack_require__.add({
10
10
  "../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/index.js" (module, __unused_rspack_exports, __webpack_require__) {
@@ -1526,7 +1526,7 @@ const bgColor = (background, str)=>{
1526
1526
  };
1527
1527
  const isTTY = (type = 'stdout')=>('stdin' === type ? process.stdin.isTTY : process.stdout.isTTY) && !process.env.CI;
1528
1528
  const external_node_path_ = __webpack_require__("node:path");
1529
- const external_node_fs_ = __webpack_require__("fs");
1529
+ const external_node_fs_ = __webpack_require__("node:fs");
1530
1530
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
1531
1531
  function cleanPath(path) {
1532
1532
  let normalized = (0, external_node_path_.normalize)(path);
@@ -2375,43 +2375,6 @@ const getTestEntries = async ({ include, exclude, rootPath, projectRoot, fileFil
2375
2375
  ];
2376
2376
  }));
2377
2377
  };
2378
- const tryResolve = (request, rootPath)=>{
2379
- try {
2380
- const require = external_node_module_createRequire(rootPath);
2381
- return require.resolve(request, {
2382
- paths: [
2383
- rootPath
2384
- ]
2385
- });
2386
- } catch (_err) {
2387
- return;
2388
- }
2389
- };
2390
- const getSetupFiles = (setups, rootPath)=>{
2391
- if (!setups.length) return {};
2392
- return Object.fromEntries(setups.map((setupFile)=>{
2393
- const setupFilePath = getAbsolutePath(rootPath, setupFile);
2394
- try {
2395
- if (!(0, external_node_fs_.existsSync)(setupFilePath)) {
2396
- let errorMessage = `Setup file ${picocolors_default().red(setupFile)} not found`;
2397
- if (setupFilePath !== setupFile) errorMessage += picocolors_default().gray(` (resolved path: ${setupFilePath})`);
2398
- throw errorMessage;
2399
- }
2400
- const relativePath = posix.relative(rootPath, setupFilePath);
2401
- return [
2402
- formatTestEntryName(relativePath),
2403
- setupFilePath
2404
- ];
2405
- } catch (err) {
2406
- const resolvedPath = tryResolve(setupFile, rootPath);
2407
- if (resolvedPath) return [
2408
- formatTestEntryName(setupFile),
2409
- resolvedPath
2410
- ];
2411
- throw err;
2412
- }
2413
- }));
2414
- };
2415
2378
  const prettyTestPath = (testPath)=>{
2416
2379
  const { dir, base } = parsePosix(testPath);
2417
2380
  return `${'.' !== dir ? picocolors_default().gray(`${dir}/`) : ''}${picocolors_default().cyan(base)}`;
@@ -2422,4 +2385,4 @@ const formatTestPath = (root, testFilePath)=>{
2422
2385
  return prettyTestPath(testPath);
2423
2386
  };
2424
2387
  const picomatch = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/index.js");
2425
- export { ADDITIONAL_NODE_BUILTINS, DEFAULT_CONFIG_EXTENSIONS, DEFAULT_CONFIG_NAME, ROOT_SUITE_NAME, TEMP_RSTEST_OUTPUT_DIR, TEMP_RSTEST_OUTPUT_DIR_GLOB, TS_CONFIG_FILE, bgColor, castArray, filterProjects, formatError, formatRootStr, formatTestPath, getAbsolutePath, getSetupFiles, getTaskNameWithPrefix, getTestEntries, glob, globalApis, isDynamicPattern, isObject, isTTY, lstat, needFlagExperimentalDetectModule, prettyTestPath, prettyTime, promises_stat, readdir, realpath, serializableConfig, undoSerializableConfig, writeFile };
2388
+ export { ADDITIONAL_NODE_BUILTINS, DEFAULT_CONFIG_EXTENSIONS, DEFAULT_CONFIG_NAME, ROOT_SUITE_NAME, TEMP_RSTEST_OUTPUT_DIR, TEMP_RSTEST_OUTPUT_DIR_GLOB, TS_CONFIG_FILE, bgColor, castArray, filterProjects, formatError, formatRootStr, formatTestEntryName, formatTestPath, getAbsolutePath, getTaskNameWithPrefix, getTestEntries, glob, globalApis, isDynamicPattern, isObject, isTTY, lstat, needFlagExperimentalDetectModule, prettyTestPath, prettyTime, promises_stat, readdir, realpath, serializableConfig, undoSerializableConfig, writeFile };
package/dist/278.js CHANGED
@@ -2,7 +2,7 @@ import 'module';
2
2
  /*#__PURE__*/ import.meta.url;
3
3
  import { __webpack_require__ } from "./rslib-runtime.js";
4
4
  import node_process from "node:process";
5
- import "./664.js";
5
+ import "./693.js";
6
6
  const external_node_os_ = __webpack_require__("node:os");
7
7
  const external_node_tty_ = __webpack_require__("node:tty");
8
8
  function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : node_process.argv) {
package/dist/554.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import __rslib_shim_module__ from 'module';
2
2
  const require = /*#__PURE__*/ __rslib_shim_module__.createRequire(import.meta.url);
3
3
  import { __webpack_require__ } from "./rslib-runtime.js";
4
- import "./664.js";
4
+ import "./693.js";
5
5
  import { formatTestError, setRealTimers, getRealTimers } from "./913.js";
6
6
  import { node_v8, createBirpc } from "./216.js";
7
7
  import { basename, isAbsolute, dirname, resolve as pathe_M_eThtNZ_resolve, join } from "./278.js";
@@ -65,7 +65,7 @@ function createRuntimeRpc(options, { originalConsole }) {
65
65
  rpc
66
66
  };
67
67
  }
68
- const external_node_fs_ = __webpack_require__("fs");
68
+ const external_node_fs_ = __webpack_require__("node:fs");
69
69
  class NodeSnapshotEnvironment {
70
70
  constructor(options = {}){
71
71
  this.options = options;
@@ -6,7 +6,6 @@ import * as __rspack_external_node_path_c5b9b54f from "node:path";
6
6
  import * as __rspack_external_node_tty_c64aab7e from "node:tty";
7
7
  import * as __rspack_external_node_util_1b29d436 from "node:util";
8
8
  import { __webpack_require__ } from "./rslib-runtime.js";
9
- import { createRequire, isBuiltin } from "node:module";
10
9
  __webpack_require__.add({
11
10
  "../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js" (module) {
12
11
  let p = process || {}, argv = p.argv || [], env = p.env || {};
@@ -74,7 +73,7 @@ __webpack_require__.add({
74
73
  module.exports = createColors();
75
74
  module.exports.createColors = createColors;
76
75
  },
77
- fs (module) {
76
+ "node:fs" (module) {
78
77
  module.exports = __rspack_external_node_fs_5ea92f0c;
79
78
  },
80
79
  "node:os" (module) {
@@ -90,4 +89,3 @@ __webpack_require__.add({
90
89
  module.exports = __rspack_external_node_util_1b29d436;
91
90
  }
92
91
  });
93
- export { createRequire, isBuiltin };
package/dist/734.js CHANGED
@@ -1,7 +1,8 @@
1
1
  import 'module';
2
2
  /*#__PURE__*/ import.meta.url;
3
3
  import { __webpack_require__ } from "./rslib-runtime.js";
4
- import { createRequire } from "./664.js";
4
+ import "./693.js";
5
+ import { createRequire } from "./881.js";
5
6
  import { pathToFileURL } from "./198.js";
6
7
  import "./157.js";
7
8
  const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
package/dist/881.js ADDED
@@ -0,0 +1,4 @@
1
+ import 'module';
2
+ /*#__PURE__*/ import.meta.url;
3
+ import { createRequire, isBuiltin } from "node:module";
4
+ export { createRequire, isBuiltin };
package/dist/913.js CHANGED
@@ -2,7 +2,8 @@
2
2
  import 'module';
3
3
  /*#__PURE__*/ import.meta.url;
4
4
  import { __webpack_require__ } from "./rslib-runtime.js";
5
- import { createRequire } from "./664.js";
5
+ import "./693.js";
6
+ import { createRequire } from "./881.js";
6
7
  __webpack_require__.add({
7
8
  "../../node_modules/.pnpm/@jest+diff-sequences@30.0.1/node_modules/@jest/diff-sequences/build/index.js" (module) {
8
9
  /*!
@@ -4856,7 +4857,7 @@ __webpack_require__.add({
4856
4857
  var path = __webpack_require__("node:path");
4857
4858
  var fs;
4858
4859
  try {
4859
- fs = __webpack_require__("fs");
4860
+ fs = __webpack_require__("node:fs");
4860
4861
  if (!fs.existsSync || !fs.readFileSync) fs = null;
4861
4862
  } catch (err) {}
4862
4863
  var bufferFrom = __webpack_require__("../../node_modules/.pnpm/buffer-from@1.1.2/node_modules/buffer-from/index.js");
@@ -2,7 +2,7 @@ import 'module';
2
2
  /*#__PURE__*/ import.meta.url;
3
3
  import { __webpack_require__ } from "./rslib-runtime.js";
4
4
  import { formatTestError } from "./913.js";
5
- import "./664.js";
5
+ import "./693.js";
6
6
  const source_map_support = __webpack_require__("../../node_modules/.pnpm/source-map-support@0.5.21/node_modules/source-map-support/source-map-support.js");
7
7
  const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
8
8
  var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
package/dist/index.d.ts CHANGED
@@ -482,9 +482,19 @@ export declare type CoverageOptions = {
482
482
  provider?: 'istanbul';
483
483
  /**
484
484
  * The reporters to use for coverage collection.
485
+ * Supports built-in istanbul reporters and custom reporters (e.g., '@canyonjs/report-html').
485
486
  * @default ['text', 'html', 'clover', 'json']
487
+ * @example
488
+ * // Built-in reporters
489
+ * reporters: ['text', 'html', ['json', { file: 'coverage.json' }]]
490
+ *
491
+ * // Custom reporters
492
+ * reporters: ['@canyonjs/report-html', ['custom-reporter', { outputDir: './reports' }]]
493
+ *
494
+ * // Mixed usage
495
+ * reporters: ['text', '@canyonjs/report-html', ['html', { subdir: 'html-report' }]]
486
496
  */
487
- reporters?: (keyof ReportOptions | ReportWithOptions | ReportBase)[];
497
+ reporters?: SupportedReporter[];
488
498
  /**
489
499
  * The directory to store coverage reports.
490
500
  * @default './coverage'
@@ -600,6 +610,9 @@ declare interface CustomMatcher {
600
610
  toBeOneOf: <T>(sample: Array<T>) => any;
601
611
  }
602
612
 
613
+ /** Custom reporter configuration for non-istanbul reporters */
614
+ declare type CustomReporter = string | [string, Record<string, unknown>];
615
+
603
616
  declare interface DecodedSourceMap extends SourceMapV3 {
604
617
  mappings: SourceMapSegment[][];
605
618
  }
@@ -2916,6 +2929,9 @@ declare type SuiteContext = {
2916
2929
 
2917
2930
  declare type Summarizers = "flat" | "nested" | "pkg" | "defaultSummarizer";
2918
2931
 
2932
+ /** Union type for all supported reporter types */
2933
+ declare type SupportedReporter = keyof ReportOptions | ReportWithOptions | ReportBase | CustomReporter;
2934
+
2919
2935
  declare interface SyncExpectationResult {
2920
2936
  pass: boolean;
2921
2937
  message: () => string;
package/dist/worker.d.ts CHANGED
@@ -425,9 +425,19 @@ declare type CoverageOptions = {
425
425
  provider?: 'istanbul';
426
426
  /**
427
427
  * The reporters to use for coverage collection.
428
+ * Supports built-in istanbul reporters and custom reporters (e.g., '@canyonjs/report-html').
428
429
  * @default ['text', 'html', 'clover', 'json']
430
+ * @example
431
+ * // Built-in reporters
432
+ * reporters: ['text', 'html', ['json', { file: 'coverage.json' }]]
433
+ *
434
+ * // Custom reporters
435
+ * reporters: ['@canyonjs/report-html', ['custom-reporter', { outputDir: './reports' }]]
436
+ *
437
+ * // Mixed usage
438
+ * reporters: ['text', '@canyonjs/report-html', ['html', { subdir: 'html-report' }]]
429
439
  */
430
- reporters?: (keyof ReportOptions | ReportWithOptions | ReportBase)[];
440
+ reporters?: SupportedReporter[];
431
441
  /**
432
442
  * The directory to store coverage reports.
433
443
  * @default './coverage'
@@ -506,6 +516,9 @@ declare interface CustomMatcher {
506
516
  toBeOneOf: <T>(sample: Array<T>) => any;
507
517
  }
508
518
 
519
+ /** Custom reporter configuration for non-istanbul reporters */
520
+ declare type CustomReporter = string | [string, Record<string, unknown>];
521
+
509
522
  declare interface DecodedSourceMap extends SourceMapV3 {
510
523
  mappings: SourceMapSegment[][];
511
524
  }
@@ -2422,6 +2435,9 @@ declare type SuiteContext = {
2422
2435
 
2423
2436
  declare type Summarizers = "flat" | "nested" | "pkg" | "defaultSummarizer";
2424
2437
 
2438
+ /** Union type for all supported reporter types */
2439
+ declare type SupportedReporter = keyof ReportOptions | ReportWithOptions | ReportBase | CustomReporter;
2440
+
2425
2441
  declare interface SyncExpectationResult {
2426
2442
  pass: boolean;
2427
2443
  message: () => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rstest/core",
3
- "version": "0.7.4",
3
+ "version": "0.7.5",
4
4
  "description": "The Rsbuild-based test tool.",
5
5
  "bugs": {
6
6
  "url": "https://github.com/web-infra-dev/rstest/issues"
@@ -47,7 +47,7 @@
47
47
  ],
48
48
  "dependencies": {
49
49
  "@types/chai": "^5.2.3",
50
- "@rsbuild/core": "1.6.12-canary-20251204065915",
50
+ "@rsbuild/core": "1.7.0-beta.0",
51
51
  "tinypool": "^1.1.1"
52
52
  },
53
53
  "devDependencies": {