@rstest/core 0.8.2 → 0.8.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 (52) hide show
  1. package/dist/0~130.js +1 -2
  2. package/dist/0~1472.js +2 -3
  3. package/dist/0~1981.js +1 -2
  4. package/dist/0~2173.js +1 -2
  5. package/dist/0~2255.js +2 -3
  6. package/dist/0~3062.js +1 -2
  7. package/dist/0~3346.js +1 -2
  8. package/dist/0~3919.js +1 -2
  9. package/dist/0~4403.js +1 -2
  10. package/dist/0~4809.js +1 -2
  11. package/dist/0~5835.js +2 -3
  12. package/dist/0~62.js +1 -2
  13. package/dist/0~6588.js +5 -5
  14. package/dist/0~6907.js +1 -2
  15. package/dist/0~6923.js +2 -3
  16. package/dist/0~7583.js +3 -4
  17. package/dist/0~7882.js +7 -8
  18. package/dist/0~8426.js +1 -2
  19. package/dist/0~89.js +9 -10
  20. package/dist/0~9348.js +1 -2
  21. package/dist/0~9634.js +3 -4
  22. package/dist/1157.js +4 -97
  23. package/dist/1294.js +1 -2
  24. package/dist/1672.js +1 -2
  25. package/dist/3160.js +112 -9
  26. package/dist/3216.js +1 -2
  27. package/dist/4397.js +1 -2
  28. package/dist/4484.js +1 -2
  29. package/dist/487.js +3 -4
  30. package/dist/4881.js +1 -2
  31. package/dist/4899.js +2 -2
  32. package/dist/5734.js +1 -2
  33. package/dist/6151.js +1 -2
  34. package/dist/6198.js +1 -2
  35. package/dist/6973.js +2 -3
  36. package/dist/7011.js +1 -2
  37. package/dist/721.js +1 -2
  38. package/dist/9131.js +32 -19
  39. package/dist/browser-runtime/389.js +1 -0
  40. package/dist/browser-runtime/389.js.LICENSE.txt +22 -0
  41. package/dist/browser-runtime/index.d.ts +1 -1
  42. package/dist/browser.d.ts +1 -1
  43. package/dist/browser.js +1 -2
  44. package/dist/globalSetupWorker.js +1 -2
  45. package/dist/index.d.ts +1 -1
  46. package/dist/index.js +1 -2
  47. package/dist/mockRuntimeCode.js +63 -174
  48. package/dist/rslib-runtime.js +1 -2
  49. package/dist/worker.d.ts +1 -1
  50. package/dist/worker.js +2 -3
  51. package/package.json +4 -4
  52. /package/dist/{1157.js.LICENSE.txt → 3160.js.LICENSE.txt} +0 -0
package/dist/487.js CHANGED
@@ -1,5 +1,4 @@
1
- import 'module';
2
- /*#__PURE__*/ import.meta.url;
1
+ import "node:module";
3
2
  import { __webpack_require__ } from "./rslib-runtime.js";
4
3
  import "./3160.js";
5
4
  __webpack_require__.add({
@@ -36,10 +35,10 @@ __webpack_require__.add({
36
35
  "../../node_modules/.pnpm/source-map-support@0.5.21/node_modules/source-map-support/source-map-support.js" (module, exports, __webpack_require__) {
37
36
  module = __webpack_require__.nmd(module);
38
37
  var SourceMapConsumer = __webpack_require__("../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/source-map.js").SourceMapConsumer;
39
- var path = __webpack_require__("path");
38
+ var path = __webpack_require__("node:path");
40
39
  var fs;
41
40
  try {
42
- fs = __webpack_require__("fs");
41
+ fs = __webpack_require__("node:fs");
43
42
  if (!fs.existsSync || !fs.readFileSync) fs = null;
44
43
  } catch (err) {}
45
44
  var bufferFrom = __webpack_require__("../../node_modules/.pnpm/buffer-from@1.1.2/node_modules/buffer-from/index.js");
package/dist/4881.js CHANGED
@@ -1,3 +1,2 @@
1
- import 'module';
2
- /*#__PURE__*/ import.meta.url;
1
+ import "node:module";
3
2
  export { createRequire, isBuiltin } from "node:module";
package/dist/4899.js CHANGED
@@ -1,5 +1,5 @@
1
- import __rslib_shim_module__ from 'module';
2
- const require = /*#__PURE__*/ __rslib_shim_module__.createRequire(import.meta.url);
1
+ import __rslib_shim_module__ from "node:module";
2
+ const require = /*#__PURE__*/ __rslib_shim_module__.createRequire(/*#__PURE__*/ (()=>import.meta.url)());
3
3
  import { __webpack_require__ } from "./rslib-runtime.js";
4
4
  __webpack_require__.add({
5
5
  timers (module) {
package/dist/5734.js CHANGED
@@ -1,5 +1,4 @@
1
- import 'module';
2
- /*#__PURE__*/ import.meta.url;
1
+ import "node:module";
3
2
  import { createRequire } from "./4881.js";
4
3
  import { pathToFileURL } from "./6198.js";
5
4
  import "./1157.js";
package/dist/6151.js CHANGED
@@ -1,6 +1,5 @@
1
1
  /*! For license information please see 6151.js.LICENSE.txt */
2
- import 'module';
3
- /*#__PURE__*/ import.meta.url;
2
+ import "node:module";
4
3
  import { __webpack_require__ } from "./rslib-runtime.js";
5
4
  import { getTaskNameWithPrefix, isObject as helper_isObject, castArray, resolve as pathe_M_eThtNZ_resolve, normalize } from "./3160.js";
6
5
  import { getRealTimers, TestRegisterError, formatTestError, formatName } from "./1294.js";
package/dist/6198.js CHANGED
@@ -1,3 +1,2 @@
1
- import 'module';
2
- /*#__PURE__*/ import.meta.url;
1
+ import "node:module";
3
2
  export { fileURLToPath, pathToFileURL } from "node:url";
package/dist/6973.js CHANGED
@@ -1,12 +1,11 @@
1
- import 'module';
2
- /*#__PURE__*/ import.meta.url;
1
+ import "node:module";
3
2
  import { __webpack_require__ } from "./rslib-runtime.js";
4
3
  import { getAbsolutePath, color } from "./3160.js";
5
4
  import { fileURLToPath } from "./6198.js";
6
5
  import { rsbuild as __rspack_external__rsbuild_core_1b356efc } from "./4484.js";
7
6
  import { formatTestEntryName } from "./1157.js";
8
7
  import { posix } from "./7011.js";
9
- const external_node_fs_ = __webpack_require__("fs");
8
+ const external_node_fs_ = __webpack_require__("node:fs");
10
9
  const tryResolve = (request, rootPath)=>{
11
10
  const { resolver } = __rspack_external__rsbuild_core_1b356efc.rspack.experiments;
12
11
  const esmFirstResolver = new resolver.ResolverFactory({
package/dist/7011.js CHANGED
@@ -1,5 +1,4 @@
1
- import 'module';
2
- /*#__PURE__*/ import.meta.url;
1
+ import "node:module";
3
2
  import { _path } from "./3160.js";
4
3
  const delimiter = /* @__PURE__ */ (()=>globalThis.process?.platform === "win32" ? ";" : ":")();
5
4
  const _platforms = {
package/dist/721.js CHANGED
@@ -1,5 +1,4 @@
1
- import 'module';
2
- /*#__PURE__*/ import.meta.url;
1
+ import "node:module";
3
2
  import * as __rspack_external_node_util_1b29d436 from "node:util";
4
3
  import { __webpack_require__ } from "./rslib-runtime.js";
5
4
  __webpack_require__.add({
package/dist/9131.js CHANGED
@@ -1,10 +1,9 @@
1
- import 'module';
2
- /*#__PURE__*/ import.meta.url;
1
+ import "node:module";
3
2
  import { __webpack_require__ } from "./rslib-runtime.js";
4
3
  import { EventEmitter } from "events";
5
- import { basename, isTTY, dirname as pathe_M_eThtNZ_dirname, resolve as pathe_M_eThtNZ_resolve, node_process, relative, getAbsolutePath, join, bgColor, formatRootStr, logger as logger_logger, castArray, prettyTime, isDebug, color, isAbsolute, getTaskNameWithPrefix, normalize, formatError } from "./3160.js";
4
+ import { basename, isTTY, dirname as pathe_M_eThtNZ_dirname, resolve as pathe_M_eThtNZ_resolve, node_process, relative, getAbsolutePath, join, bgColor, formatRootStr, determineAgent, logger as logger_logger, castArray, prettyTime, isDebug, color, isAbsolute, getTaskNameWithPrefix, normalize, formatError } from "./3160.js";
6
5
  import "./721.js";
7
- import { isDynamicPattern, glob, DEFAULT_CONFIG_NAME, prettyTestPath, globalApis, promises, TEMP_RSTEST_OUTPUT_DIR_GLOB, formatTestPath, filterProjects, DEFAULT_CONFIG_EXTENSIONS, TS_CONFIG_FILE, determineAgent } from "./1157.js";
6
+ import { isDynamicPattern, glob, DEFAULT_CONFIG_NAME, prettyTestPath, globalApis, promises, TEMP_RSTEST_OUTPUT_DIR_GLOB, formatTestPath, filterProjects, DEFAULT_CONFIG_EXTENSIONS, TS_CONFIG_FILE } from "./1157.js";
8
7
  import { rsbuild as __rspack_external__rsbuild_core_1b356efc } from "./4484.js";
9
8
  import { posix } from "./7011.js";
10
9
  import { parse as stack_trace_parser_esm_parse } from "./1672.js";
@@ -505,7 +504,7 @@ function prepareCli() {
505
504
  if (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) logger_logger.log();
506
505
  }
507
506
  function showRstest() {
508
- logger_logger.greet(" Rstest v0.8.2");
507
+ logger_logger.greet(" Rstest v0.8.3");
509
508
  logger_logger.log('');
510
509
  }
511
510
  const applyCommonOptions = (cli)=>{
@@ -563,7 +562,7 @@ const runRest = async ({ options, filters, command })=>{
563
562
  function setupCommands() {
564
563
  const cli = dist('rstest');
565
564
  cli.help();
566
- cli.version("0.8.2");
565
+ cli.version("0.8.3");
567
566
  applyCommonOptions(cli);
568
567
  cli.command('[...filters]', 'run tests').option('-w, --watch', 'Run tests in watch mode').action(async (filters, options)=>{
569
568
  if (!determineAgent().isAgent) showRstest();
@@ -988,7 +987,7 @@ function G() {
988
987
  }
989
988
  const P = G();
990
989
  P?.name;
991
- const external_node_fs_ = __webpack_require__("fs");
990
+ const external_node_fs_ = __webpack_require__("node:fs");
992
991
  const findConfig = (basePath)=>DEFAULT_CONFIG_EXTENSIONS.map((ext)=>basePath + ext).find(external_node_fs_["default"].existsSync);
993
992
  const resolveConfigPath = (root, customConfig)=>{
994
993
  if (customConfig) {
@@ -1754,12 +1753,14 @@ const logFileTitle = (test, relativePath, alwaysShowTime = false, showProjectNam
1754
1753
  class DefaultReporter {
1755
1754
  rootPath;
1756
1755
  config;
1756
+ projectConfigs;
1757
1757
  options = {};
1758
1758
  statusRenderer;
1759
1759
  testState;
1760
- constructor({ rootPath, options, config, testState }){
1760
+ constructor({ rootPath, options, config, testState, projectConfigs }){
1761
1761
  this.rootPath = rootPath;
1762
1762
  this.config = config;
1763
+ this.projectConfigs = projectConfigs ?? new Map();
1763
1764
  this.options = options;
1764
1765
  this.testState = testState;
1765
1766
  }
@@ -1773,16 +1774,19 @@ class DefaultReporter {
1773
1774
  }
1774
1775
  onTestFileResult(test) {
1775
1776
  this.statusRenderer?.onTestFileResult();
1776
- if (this.config.hideSkippedTestFiles && 'skip' === test.status) return;
1777
+ const projectConfig = this.projectConfigs.get(test.project);
1778
+ const hideSkippedTestFiles = projectConfig?.hideSkippedTestFiles ?? this.config.hideSkippedTestFiles;
1779
+ if (hideSkippedTestFiles && 'skip' === test.status) return;
1777
1780
  const relativePath = relative(this.rootPath, test.testPath);
1778
- const { slowTestThreshold } = this.config;
1781
+ const slowTestThreshold = projectConfig?.slowTestThreshold ?? this.config.slowTestThreshold;
1779
1782
  logFileTitle(test, relativePath, false, this.options.showProjectName);
1780
1783
  const showAllCases = this.testState.getTestFiles()?.length === 1;
1784
+ const hideSkippedTests = projectConfig?.hideSkippedTests ?? this.config.hideSkippedTests;
1781
1785
  for (const result of test.results){
1782
1786
  const isDisplayed = showAllCases || 'fail' === result.status || (result.duration ?? 0) > slowTestThreshold || (result.retryCount ?? 0) > 0;
1783
1787
  isDisplayed && logCase(result, {
1784
1788
  slowTestThreshold,
1785
- hideSkippedTests: this.config.hideSkippedTests
1789
+ hideSkippedTests
1786
1790
  });
1787
1791
  }
1788
1792
  }
@@ -2197,7 +2201,7 @@ function traceSegmentInternal(segments, memo, line, column, bias) {
2197
2201
  if (-1 === index || index === segments.length) return -1;
2198
2202
  return index;
2199
2203
  }
2200
- const external_node_path_ = __webpack_require__("path");
2204
+ const external_node_path_ = __webpack_require__("node:path");
2201
2205
  const isRelativePath = (p)=>/^\.\.?\//.test(p);
2202
2206
  const hintNotDefinedError = (message)=>{
2203
2207
  const [, varName] = message.match(/(\w+) is not defined/) || [];
@@ -3458,7 +3462,7 @@ class MdReporter {
3458
3462
  }
3459
3463
  renderFrontMatter(lines) {
3460
3464
  const frontMatter = {
3461
- tool: "@rstest/core@0.8.2",
3465
+ tool: "@rstest/core@0.8.3",
3462
3466
  timestamp: new Date().toISOString()
3463
3467
  };
3464
3468
  if (this.options.header.env) frontMatter.runtime = {
@@ -3694,7 +3698,7 @@ class MdReporter {
3694
3698
  }
3695
3699
  class VerboseReporter extends DefaultReporter {
3696
3700
  verboseOptions = {};
3697
- constructor({ rootPath, options, config, testState }){
3701
+ constructor({ rootPath, options, config, testState, projectConfigs }){
3698
3702
  super({
3699
3703
  rootPath,
3700
3704
  options: {
@@ -3702,19 +3706,23 @@ class VerboseReporter extends DefaultReporter {
3702
3706
  summary: true
3703
3707
  },
3704
3708
  config,
3705
- testState
3709
+ testState,
3710
+ projectConfigs
3706
3711
  });
3707
3712
  this.verboseOptions = options;
3708
3713
  }
3709
3714
  onTestFileResult(test) {
3710
3715
  this.statusRenderer?.onTestFileResult();
3711
- if (this.config.hideSkippedTestFiles && 'skip' === test.status) return;
3716
+ const projectConfig = this.projectConfigs.get(test.project);
3717
+ const hideSkippedTestFiles = projectConfig?.hideSkippedTestFiles ?? this.config.hideSkippedTestFiles;
3718
+ if (hideSkippedTestFiles && 'skip' === test.status) return;
3712
3719
  const relativePath = relative(this.rootPath, test.testPath);
3713
- const { slowTestThreshold } = this.config;
3720
+ const slowTestThreshold = projectConfig?.slowTestThreshold ?? this.config.slowTestThreshold;
3721
+ const hideSkippedTests = projectConfig?.hideSkippedTests ?? this.config.hideSkippedTests;
3714
3722
  logFileTitle(test, relativePath, true, this.verboseOptions.showProjectName);
3715
3723
  for (const result of test.results)logCase(result, {
3716
3724
  slowTestThreshold,
3717
- hideSkippedTests: this.config.hideSkippedTests
3725
+ hideSkippedTests
3718
3726
  });
3719
3727
  }
3720
3728
  }
@@ -3824,7 +3832,7 @@ class Rstest {
3824
3832
  updateSnapshot: rstestConfig.update ? 'all' : T ? 'none' : 'new'
3825
3833
  });
3826
3834
  this.snapshotManager = snapshotManager;
3827
- this.version = "0.8.2";
3835
+ this.version = "0.8.3";
3828
3836
  this.rootPath = rootPath;
3829
3837
  this.originalConfig = userConfig;
3830
3838
  this.normalizedConfig = rstestConfig;
@@ -3864,11 +3872,16 @@ class Rstest {
3864
3872
  normalizedConfig: rstestConfig
3865
3873
  }
3866
3874
  ];
3875
+ const projectConfigs = new Map(this.projects.map((p)=>[
3876
+ p.name,
3877
+ p.normalizedConfig
3878
+ ]));
3867
3879
  const reporters = 'list' !== command ? createReporters(rstestConfig.reporters, {
3868
3880
  rootPath,
3869
3881
  config: rstestConfig,
3870
3882
  testState: this.testState,
3871
3883
  fileFilters: this.fileFilters,
3884
+ projectConfigs,
3872
3885
  options: {
3873
3886
  showProjectName: projects.length > 1
3874
3887
  }
@@ -18133,6 +18133,7 @@ let createLogger = (options = {})=>{
18133
18133
  return logger;
18134
18134
  };
18135
18135
  let src_logger = createLogger();
18136
+ __webpack_require__("../../node_modules/.pnpm/process@0.11.10/node_modules/process/browser.js");
18136
18137
  const picocolors_browser = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.browser.js");
18137
18138
  var logger_process = __webpack_require__("../../node_modules/.pnpm/process@0.11.10/node_modules/process/browser.js");
18138
18139
  const isDebug = ()=>{
@@ -135,6 +135,28 @@
135
135
  * MIT Licensed
136
136
  */
137
137
 
138
+ /*!
139
+ * Copyright 2017 Vercel, Inc.
140
+ *
141
+ * This file is derived from Vercel's detect-agent:
142
+ * https://github.com/vercel/vercel/tree/main/packages/detect-agent
143
+ *
144
+ * Licensed under the Apache License, Version 2.0 (the "License");
145
+ * you may not use this file except in compliance with the License.
146
+ * You may obtain a copy of the License at
147
+ *
148
+ * http://www.apache.org/licenses/LICENSE-2.0
149
+ *
150
+ * Unless required by applicable law or agreed to in writing, software
151
+ * distributed under the License is distributed on an "AS IS" BASIS,
152
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
153
+ * See the License for the specific language governing permissions and
154
+ * limitations under the License.
155
+ *
156
+ * Modifications in this derived work:
157
+ * - Removed async determine logic, kept only env detection.
158
+ */
159
+
138
160
  /*!
139
161
  * The buffer module from node.js, for the browser.
140
162
  *
@@ -1751,7 +1751,7 @@ declare function printWithType<T>(name: string, value: T, print: (value: T) => s
1751
1751
 
1752
1752
  declare type Procedure = (...args: any[]) => any;
1753
1753
 
1754
- declare type ProjectConfig = Omit<RstestConfig, 'projects' | 'reporters' | 'pool' | 'isolate' | 'coverage' | 'resolveSnapshotPath' | 'onConsoleLog' | 'hideSkippedTests' | 'hideSkippedTestFiles' | 'bail' | 'shard'>;
1754
+ declare type ProjectConfig = Omit<RstestConfig, 'projects' | 'reporters' | 'pool' | 'isolate' | 'coverage' | 'resolveSnapshotPath' | 'onConsoleLog' | 'bail' | 'shard'>;
1755
1755
 
1756
1756
  declare type ProjectContext = {
1757
1757
  name: string;
package/dist/browser.d.ts CHANGED
@@ -2321,7 +2321,7 @@ declare type Project = {
2321
2321
  configFilePath?: string;
2322
2322
  };
2323
2323
 
2324
- declare type ProjectConfig = Omit<RstestConfig, 'projects' | 'reporters' | 'pool' | 'isolate' | 'coverage' | 'resolveSnapshotPath' | 'onConsoleLog' | 'hideSkippedTests' | 'hideSkippedTestFiles' | 'bail' | 'shard'>;
2324
+ declare type ProjectConfig = Omit<RstestConfig, 'projects' | 'reporters' | 'pool' | 'isolate' | 'coverage' | 'resolveSnapshotPath' | 'onConsoleLog' | 'bail' | 'shard'>;
2325
2325
 
2326
2326
  export declare type ProjectContext = {
2327
2327
  name: string;
package/dist/browser.js CHANGED
@@ -1,5 +1,4 @@
1
- import 'module';
2
- /*#__PURE__*/ import.meta.url;
1
+ import "node:module";
3
2
  export { TEMP_RSTEST_OUTPUT_DIR, getTestEntries, globalApis } from "./1157.js";
4
3
  export { afterAll, afterEach, assert, beforeAll, beforeEach, describe, expect, it, onTestFailed, onTestFinished, rs, rsbuild, rstest, test } from "./4484.js";
5
4
  export { color, isDebug, logger, serializableConfig } from "./3160.js";
@@ -1,5 +1,4 @@
1
- import 'module';
2
- /*#__PURE__*/ import.meta.url;
1
+ import "node:module";
3
2
  import { __webpack_require__ } from "./rslib-runtime.js";
4
3
  import "./487.js";
5
4
  import { color } from "./3160.js";
package/dist/index.d.ts CHANGED
@@ -2333,7 +2333,7 @@ declare type Project = {
2333
2333
  configFilePath?: string;
2334
2334
  };
2335
2335
 
2336
- export declare type ProjectConfig = Omit<RstestConfig, 'projects' | 'reporters' | 'pool' | 'isolate' | 'coverage' | 'resolveSnapshotPath' | 'onConsoleLog' | 'hideSkippedTests' | 'hideSkippedTestFiles' | 'bail' | 'shard'>;
2336
+ export declare type ProjectConfig = Omit<RstestConfig, 'projects' | 'reporters' | 'pool' | 'isolate' | 'coverage' | 'resolveSnapshotPath' | 'onConsoleLog' | 'bail' | 'shard'>;
2337
2337
 
2338
2338
  declare type ProjectConfigAsyncFn = () => Promise<ProjectConfig | NestedProjectConfig>;
2339
2339
 
package/dist/index.js CHANGED
@@ -1,4 +1,3 @@
1
- import 'module';
2
- /*#__PURE__*/ import.meta.url;
1
+ import "node:module";
3
2
  export { afterAll, afterEach, assert, beforeAll, beforeEach, describe, expect, it, onTestFailed, onTestFinished, rs, rstest, test } from "./4484.js";
4
3
  export { createRstest, defineConfig, defineProject, initCli, loadConfig, mergeProjectConfig, mergeRstestConfig, runCLI } from "./9131.js";
@@ -28,187 +28,76 @@ __webpack_require__.rstest_unmock = (id)=>{
28
28
  __webpack_require__.rstest_do_unmock = __webpack_require__.rstest_unmock;
29
29
  __webpack_require__.rstest_require_actual = __webpack_require__.rstest_import_actual = (id)=>{
30
30
  const originalModule = __webpack_require__.rstest_original_modules[id];
31
- const fallbackMod = __webpack_require__(id);
32
- return originalModule ? originalModule : fallbackMod;
33
- };
34
- __webpack_require__.rstest_mock = (id, modFactory)=>{
35
- let requiredModule;
36
- try {
37
- requiredModule = __webpack_require__(id);
38
- } catch {} finally{
39
- __webpack_require__.rstest_original_modules[id] = requiredModule;
40
- __webpack_require__.rstest_original_module_factories[id] = __webpack_modules__[id];
41
- }
42
- if (modFactory && 'object' == typeof modFactory) {
43
- const isSpy = true === modFactory.spy;
44
- const isMock = true === modFactory.mock;
45
- if (!isSpy && !isMock) throw new Error('[Rstest] rs.mock() options must be { spy: true } or { mock: true }');
46
- if (!requiredModule) {
47
- const optionName = isSpy ? 'spy' : 'mock';
48
- throw new Error(`[Rstest] rs.mock('${id}', { ${optionName}: true }) failed: cannot load original module`);
49
- }
50
- const originalModule = requiredModule;
51
- const isEsModule = true === originalModule.__esModule;
52
- const mockedModule = globalThis.RSTEST_API?.rstest?.mockObject(originalModule, {
53
- spy: isSpy
54
- }) || originalModule;
55
- const finalModFactory = function(__unused_webpack_module, __webpack_exports__, __webpack_require__1) {
56
- __webpack_require__1.r(__webpack_exports__);
57
- for(const key in mockedModule)__webpack_require__1.d(__webpack_exports__, {
58
- [key]: ()=>mockedModule[key]
59
- });
60
- if (!isEsModule && !('default' in mockedModule)) __webpack_require__1.d(__webpack_exports__, {
61
- default: ()=>mockedModule
62
- });
63
- };
64
- __webpack_modules__[id] = finalModFactory;
65
- delete __webpack_module_cache__[id];
66
- return;
67
- }
68
- if ('string' == typeof modFactory || 'number' == typeof modFactory) __webpack_module_cache__[id] = {
69
- exports: __webpack_require__(modFactory)
70
- };
71
- else if ('function' == typeof modFactory) {
72
- const finalModFactory = function(__unused_webpack_module, __webpack_exports__, __webpack_require__1) {
73
- __webpack_require__1.r(__webpack_exports__);
74
- const res = modFactory();
75
- for(const key in res)__webpack_require__1.d(__webpack_exports__, {
76
- [key]: ()=>res[key]
77
- });
78
- };
79
- __webpack_modules__[id] = finalModFactory;
80
- delete __webpack_module_cache__[id];
81
- }
82
- };
83
- __webpack_require__.rstest_mock_require = (id, modFactory)=>{
84
- let requiredModule;
85
- try {
86
- requiredModule = __webpack_require__(id);
87
- } catch {} finally{
88
- __webpack_require__.rstest_original_modules[id] = requiredModule;
89
- __webpack_require__.rstest_original_module_factories[id] = __webpack_modules__[id];
90
- }
91
- if (modFactory && 'object' == typeof modFactory) {
92
- const isSpy = true === modFactory.spy;
93
- const isMock = true === modFactory.mock;
94
- if (!isSpy && !isMock) throw new Error('[Rstest] rs.mockRequire() options must be { spy: true } or { mock: true }');
95
- if (!requiredModule) {
96
- const optionName = isSpy ? 'spy' : 'mock';
97
- throw new Error(`[Rstest] rs.mockRequire('${id}', { ${optionName}: true }) failed: cannot load original module`);
98
- }
99
- const originalModule = requiredModule;
100
- const isEsModule = true === originalModule.__esModule;
101
- const mockedModule = globalThis.RSTEST_API?.rstest?.mockObject(originalModule, {
102
- spy: isSpy
103
- }) || originalModule;
104
- if (isEsModule) __webpack_require__.r(mockedModule);
105
- else if (!('default' in mockedModule)) mockedModule.default = mockedModule;
106
- __webpack_module_cache__[id] = {
107
- exports: mockedModule,
108
- id,
109
- loaded: true
110
- };
111
- return;
112
- }
113
- if ('string' == typeof modFactory || 'number' == typeof modFactory) __webpack_module_cache__[id] = {
114
- exports: __webpack_require__(modFactory)
115
- };
116
- else if ('function' == typeof modFactory) {
117
- const exports = modFactory();
118
- __webpack_require__.r(exports);
119
- __webpack_module_cache__[id] = {
120
- exports,
121
- id,
122
- loaded: true
31
+ if (originalModule) return originalModule;
32
+ if (id in __webpack_require__.rstest_original_module_factories) {
33
+ const mod = __webpack_require__.rstest_original_module_factories[id];
34
+ const moduleInstance = {
35
+ exports: {}
123
36
  };
37
+ mod(moduleInstance, moduleInstance.exports, __webpack_require__);
38
+ __webpack_require__.rstest_original_modules[id] = moduleInstance.exports;
39
+ return moduleInstance.exports;
124
40
  }
41
+ return __webpack_require__(id);
125
42
  };
126
- __webpack_require__.rstest_do_mock = (id, modFactory)=>{
127
- let requiredModule;
128
- try {
129
- requiredModule = __webpack_require__(id);
130
- } catch {} finally{
131
- __webpack_require__.rstest_original_modules[id] = requiredModule;
132
- __webpack_require__.rstest_original_module_factories[id] = __webpack_modules__[id];
133
- }
134
- if (modFactory && 'object' == typeof modFactory) {
135
- const isSpy = true === modFactory.spy;
136
- const isMock = true === modFactory.mock;
137
- if (!isSpy && !isMock) throw new Error('[Rstest] rs.doMock() options must be { spy: true } or { mock: true }');
138
- if (!requiredModule) {
139
- const optionName = isSpy ? 'spy' : 'mock';
140
- throw new Error(`[Rstest] rs.doMock('${id}', { ${optionName}: true }) failed: cannot load original module`);
43
+ const getMockImplementation = (mockType = 'mock')=>(id, modFactory)=>{
44
+ let requiredModule = __webpack_module_cache__[id]?.exports;
45
+ const wasAlreadyLoaded = !!requiredModule;
46
+ if (requiredModule) {
47
+ __webpack_require__.rstest_original_modules[id] = requiredModule;
48
+ __webpack_require__.rstest_original_module_factories[id] = __webpack_modules__[id];
49
+ } else __webpack_require__.rstest_original_module_factories[id] = __webpack_modules__[id];
50
+ if (modFactory && 'object' == typeof modFactory) {
51
+ const isSpy = true === modFactory.spy;
52
+ const isMock = true === modFactory.mock;
53
+ if (!isSpy && !isMock) throw new Error(`[Rstest] rs.${mockType}() options must be { spy: true } or { mock: true }`);
54
+ if (!wasAlreadyLoaded) try {
55
+ requiredModule = __webpack_require__(id);
56
+ } catch {
57
+ const optionName = isSpy ? 'spy' : 'mock';
58
+ throw new Error(`[Rstest] rs.${mockType}('${id}', { ${optionName}: true }) failed: cannot load original module`);
59
+ }
60
+ if (!requiredModule) {
61
+ const optionName = isSpy ? 'spy' : 'mock';
62
+ throw new Error(`[Rstest] rs.${mockType}('${id}', { ${optionName}: true }) failed: cannot load original module`);
63
+ }
64
+ const originalModule = requiredModule;
65
+ const isEsModule = true === originalModule.__esModule;
66
+ const mockedModule = globalThis.RSTEST_API?.rstest?.mockObject(originalModule, {
67
+ spy: isSpy
68
+ }) || originalModule;
69
+ const finalModFactory = function(__unused_webpack_module, __webpack_exports__, __webpack_require__1) {
70
+ __webpack_require__1.r(__webpack_exports__);
71
+ for(const key in mockedModule)__webpack_require__1.d(__webpack_exports__, {
72
+ [key]: ()=>mockedModule[key]
73
+ });
74
+ if (!isEsModule && !('default' in mockedModule)) __webpack_require__1.d(__webpack_exports__, {
75
+ default: ()=>mockedModule
76
+ });
77
+ };
78
+ __webpack_modules__[id] = finalModFactory;
79
+ delete __webpack_module_cache__[id];
80
+ return;
141
81
  }
142
- const originalModule = requiredModule;
143
- const isEsModule = true === originalModule.__esModule;
144
- const mockedModule = globalThis.RSTEST_API?.rstest?.mockObject(originalModule, {
145
- spy: isSpy
146
- }) || originalModule;
147
- if (isEsModule) __webpack_require__.r(mockedModule);
148
- else if (!('default' in mockedModule)) mockedModule.default = mockedModule;
149
- __webpack_module_cache__[id] = {
150
- exports: mockedModule,
151
- id,
152
- loaded: true
153
- };
154
- return;
155
- }
156
- if ('string' == typeof modFactory || 'number' == typeof modFactory) __webpack_module_cache__[id] = {
157
- exports: __webpack_require__(modFactory)
158
- };
159
- else if ('function' == typeof modFactory) {
160
- const exports = modFactory();
161
- __webpack_require__.r(exports);
162
- __webpack_module_cache__[id] = {
163
- exports,
164
- id,
165
- loaded: true
82
+ if ('string' == typeof modFactory || 'number' == typeof modFactory) __webpack_module_cache__[id] = {
83
+ exports: __webpack_require__(modFactory)
166
84
  };
167
- }
168
- };
169
- __webpack_require__.rstest_do_mock_require = (id, modFactory)=>{
170
- let requiredModule;
171
- try {
172
- requiredModule = __webpack_require__(id);
173
- } catch {} finally{
174
- __webpack_require__.rstest_original_modules[id] = requiredModule;
175
- __webpack_require__.rstest_original_module_factories[id] = __webpack_modules__[id];
176
- }
177
- if (modFactory && 'object' == typeof modFactory) {
178
- const isSpy = true === modFactory.spy;
179
- const isMock = true === modFactory.mock;
180
- if (!isSpy && !isMock) throw new Error('[Rstest] rs.doMockRequire() options must be { spy: true } or { mock: true }');
181
- if (!requiredModule) {
182
- const optionName = isSpy ? 'spy' : 'mock';
183
- throw new Error(`[Rstest] rs.doMockRequire('${id}', { ${optionName}: true }) failed: cannot load original module`);
85
+ else if ('function' == typeof modFactory) {
86
+ const finalModFactory = function(__unused_webpack_module, __webpack_exports__, __webpack_require__1) {
87
+ __webpack_require__1.r(__webpack_exports__);
88
+ const res = modFactory();
89
+ for(const key in res)__webpack_require__1.d(__webpack_exports__, {
90
+ [key]: ()=>res[key]
91
+ });
92
+ };
93
+ __webpack_modules__[id] = finalModFactory;
94
+ delete __webpack_module_cache__[id];
184
95
  }
185
- const originalModule = requiredModule;
186
- const isEsModule = true === originalModule.__esModule;
187
- const mockedModule = globalThis.RSTEST_API?.rstest?.mockObject(originalModule, {
188
- spy: isSpy
189
- }) || originalModule;
190
- if (isEsModule) __webpack_require__.r(mockedModule);
191
- else if (!('default' in mockedModule)) mockedModule.default = mockedModule;
192
- __webpack_module_cache__[id] = {
193
- exports: mockedModule,
194
- id,
195
- loaded: true
196
- };
197
- return;
198
- }
199
- if ('string' == typeof modFactory || 'number' == typeof modFactory) __webpack_module_cache__[id] = {
200
- exports: __webpack_require__(modFactory)
201
96
  };
202
- else if ('function' == typeof modFactory) {
203
- const exports = modFactory();
204
- __webpack_require__.r(exports);
205
- __webpack_module_cache__[id] = {
206
- exports,
207
- id,
208
- loaded: true
209
- };
210
- }
211
- };
97
+ __webpack_require__.rstest_mock = getMockImplementation('mock');
98
+ __webpack_require__.rstest_mock_require = getMockImplementation('mockRequire');
99
+ __webpack_require__.rstest_do_mock = getMockImplementation('doMock');
100
+ __webpack_require__.rstest_do_mock_require = getMockImplementation('doMockRequire');
212
101
  __webpack_require__.rstest_reset_modules = ()=>{
213
102
  const mockedIds = Object.keys(__webpack_require__.rstest_original_modules);
214
103
  Object.keys(__webpack_module_cache__).forEach((id)=>{
@@ -1,5 +1,4 @@
1
- import 'module';
2
- /*#__PURE__*/ import.meta.url;
1
+ import "node:module";
3
2
  var __webpack_modules__ = {};
4
3
  var __webpack_module_cache__ = {};
5
4
  function __webpack_require__(moduleId) {
package/dist/worker.d.ts CHANGED
@@ -1870,7 +1870,7 @@ declare function printWithType<T>(name: string, value: T, print: (value: T) => s
1870
1870
 
1871
1871
  declare type Procedure = (...args: any[]) => any;
1872
1872
 
1873
- declare type ProjectConfig = Omit<RstestConfig, 'projects' | 'reporters' | 'pool' | 'isolate' | 'coverage' | 'resolveSnapshotPath' | 'onConsoleLog' | 'hideSkippedTests' | 'hideSkippedTestFiles' | 'bail' | 'shard'>;
1873
+ declare type ProjectConfig = Omit<RstestConfig, 'projects' | 'reporters' | 'pool' | 'isolate' | 'coverage' | 'resolveSnapshotPath' | 'onConsoleLog' | 'bail' | 'shard'>;
1874
1874
 
1875
1875
  declare type ProjectContext = {
1876
1876
  name: string;
package/dist/worker.js CHANGED
@@ -1,5 +1,4 @@
1
- import 'module';
2
- /*#__PURE__*/ import.meta.url;
1
+ import "node:module";
3
2
  import { __webpack_require__ } from "./rslib-runtime.js";
4
3
  import { basename, isAbsolute, undoSerializableConfig, dirname, color, resolve as pathe_M_eThtNZ_resolve, join } from "./3160.js";
5
4
  import "./487.js";
@@ -56,7 +55,7 @@ function createRuntimeRpc(options, { originalConsole }) {
56
55
  rpc
57
56
  };
58
57
  }
59
- const external_node_fs_ = __webpack_require__("fs");
58
+ const external_node_fs_ = __webpack_require__("node:fs");
60
59
  class NodeSnapshotEnvironment {
61
60
  constructor(options = {}){
62
61
  this.options = options;