@rstest/core 0.6.0 → 0.6.1

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~628.js CHANGED
@@ -57,6 +57,7 @@ export const __webpack_modules__ = {
57
57
  config.output.iife = false;
58
58
  config.output.importFunctionName = '__rstest_dynamic_import__';
59
59
  config.output.devtoolModuleFilenameTemplate = '[absolute-resource-path]';
60
+ if (!config.devtool || !config.devtool.includes('inline')) config.devtool = 'nosources-source-map';
60
61
  config.plugins.push(new rspack.experiments.RstestPlugin({
61
62
  injectModulePathName: true,
62
63
  importMetaPathName: true,
@@ -258,7 +259,7 @@ export const __webpack_modules__ = {
258
259
  name: 'rstest:inspect',
259
260
  setup: (api)=>{
260
261
  api.modifyRspackConfig(async (config)=>{
261
- config.devtool = 'inline-source-map';
262
+ config.devtool = 'inline-nosources-source-map';
262
263
  config.optimization ??= {};
263
264
  config.optimization.splitChunks = {
264
265
  ...config.optimization.splitChunks || {},
package/dist/index.js CHANGED
@@ -2108,7 +2108,7 @@ ${section.body}` : section.body).join("\n\n"));
2108
2108
  function setupCommands() {
2109
2109
  const cli = dist('rstest');
2110
2110
  cli.help();
2111
- cli.version("0.6.0");
2111
+ cli.version("0.6.1");
2112
2112
  applyCommonOptions(cli);
2113
2113
  cli.command('[...filters]', 'run tests').option('-w, --watch', 'Run tests in watch mode').action(async (filters, options)=>{
2114
2114
  (0, prepare.N)();
@@ -2282,12 +2282,13 @@ ${section.body}` : section.body).join("\n\n"));
2282
2282
  projectPaths.push(...await globProjects(projectPatterns));
2283
2283
  const projects = await Promise.all(projectPaths.map(async (project)=>{
2284
2284
  const isDirectory = (0, external_node_fs_.statSync)(project).isDirectory();
2285
+ const root = isDirectory ? project : (0, pathe_M_eThtNZ.d)(project);
2285
2286
  const { config, configFilePath } = await resolveConfig({
2286
2287
  ...options,
2287
2288
  config: isDirectory ? void 0 : project,
2288
- root: isDirectory ? project : (0, pathe_M_eThtNZ.d)(project)
2289
+ root
2289
2290
  });
2290
- config.name ??= getDefaultProjectName(project);
2291
+ config.name ??= getDefaultProjectName(root);
2291
2292
  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.`);
2292
2293
  return {
2293
2294
  config,
@@ -2348,7 +2349,7 @@ ${conflictProjects.map((p)=>`- ${p.configFilePath || p.config.root}`).join('\n')
2348
2349
  if (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) console.log();
2349
2350
  }
2350
2351
  function showRstest() {
2351
- _utils_logger__WEBPACK_IMPORTED_MODULE_0__.vF.greet(" Rstest v0.6.0");
2352
+ _utils_logger__WEBPACK_IMPORTED_MODULE_0__.vF.greet(" Rstest v0.6.1");
2352
2353
  _utils_logger__WEBPACK_IMPORTED_MODULE_0__.vF.log('');
2353
2354
  }
2354
2355
  },
@@ -3468,7 +3469,7 @@ ${conflictProjects.map((p)=>`- ${p.configFilePath || p.config.root}`).join('\n')
3468
3469
  });
3469
3470
  this.reporters = reporters;
3470
3471
  this.snapshotManager = snapshotManager;
3471
- this.version = "0.6.0";
3472
+ this.version = "0.6.1";
3472
3473
  this.rootPath = rootPath;
3473
3474
  this.originalConfig = userConfig;
3474
3475
  this.normalizedConfig = rstestConfig;
@@ -1,5 +1,5 @@
1
1
  const originalWebpackRequire = __webpack_require__;
2
- __webpack_require__ = function(...args) {
2
+ __webpack_require__ = new Proxy(function(...args) {
3
3
  try {
4
4
  return originalWebpackRequire(...args);
5
5
  } catch (e) {
@@ -7,9 +7,16 @@ __webpack_require__ = function(...args) {
7
7
  if (errMsg.includes('__webpack_modules__[moduleId] is not a function')) throw new Error(`[Rstest] Cannot find module "${args[0]}"`);
8
8
  throw e;
9
9
  }
10
- };
11
- Object.keys(originalWebpackRequire).forEach((key)=>{
12
- __webpack_require__[key] = originalWebpackRequire[key];
10
+ }, {
11
+ set (target, property, value) {
12
+ target[property] = value;
13
+ originalWebpackRequire[property] = value;
14
+ return true;
15
+ },
16
+ get (target, property) {
17
+ if (property in target) return target[property];
18
+ return originalWebpackRequire[property];
19
+ }
13
20
  });
14
21
  __webpack_require__.rstest_original_modules = {};
15
22
  __webpack_require__.rstest_original_module_factories = {};
package/dist/worker.js CHANGED
@@ -6714,7 +6714,7 @@ var __webpack_modules__ = {
6714
6714
  build.diffStringsUnified;
6715
6715
  const REAL_TIMERS = {};
6716
6716
  const setRealTimers = ()=>{
6717
- REAL_TIMERS.setTimeout ??= globalThis.setTimeout;
6717
+ REAL_TIMERS.setTimeout ??= globalThis.setTimeout.bind(globalThis);
6718
6718
  };
6719
6719
  const getRealTimers = ()=>REAL_TIMERS;
6720
6720
  const formatTestError = (err, test)=>{
@@ -2746,6 +2746,7 @@ declare type TestContext = {
2746
2746
  declare interface TestEachFn {
2747
2747
  <T extends Record<string, unknown>>(cases: readonly T[]): (description: string, fn?: (param: T) => MaybePromise<void>, timeout?: number) => void;
2748
2748
  <T extends readonly [unknown, ...unknown[]]>(cases: readonly T[]): (description: string, fn: (...args: [...T]) => MaybePromise<void>, timeout?: number) => void;
2749
+ <T>(cases: readonly T[]): (description: string, fn: (...args: T[]) => MaybePromise<void>, timeout?: number) => void;
2749
2750
  }
2750
2751
 
2751
2752
  declare type Tester = (this: TesterContext, a: any, b: any, customTesters: Array<Tester>) => boolean | undefined;
@@ -2342,6 +2342,7 @@ declare type TestContext = {
2342
2342
  declare interface TestEachFn {
2343
2343
  <T extends Record<string, unknown>>(cases: readonly T[]): (description: string, fn?: (param: T) => MaybePromise<void>, timeout?: number) => void;
2344
2344
  <T extends readonly [unknown, ...unknown[]]>(cases: readonly T[]): (description: string, fn: (...args: [...T]) => MaybePromise<void>, timeout?: number) => void;
2345
+ <T>(cases: readonly T[]): (description: string, fn: (...args: T[]) => MaybePromise<void>, timeout?: number) => void;
2345
2346
  }
2346
2347
 
2347
2348
  declare type Tester = (this: TesterContext, a: any, b: any, customTesters: Array<Tester>) => boolean | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rstest/core",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "The Rsbuild-based test tool.",
5
5
  "bugs": {
6
6
  "url": "https://github.com/web-infra-dev/rstest/issues"
@@ -59,8 +59,8 @@
59
59
  "@vitest/snapshot": "^3.2.4",
60
60
  "@babel/code-frame": "^7.27.1",
61
61
  "@jridgewell/trace-mapping": "0.3.31",
62
- "@microsoft/api-extractor": "^7.53.2",
63
- "@rslib/core": "0.16.0",
62
+ "@microsoft/api-extractor": "^7.53.3",
63
+ "@rslib/core": "0.16.1",
64
64
  "@sinonjs/fake-timers": "^14.0.0",
65
65
  "@types/babel__code-frame": "^7.0.6",
66
66
  "@types/istanbul-reports": "^3.0.4",