@rstest/core 0.0.6 → 0.0.7

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/353.js CHANGED
@@ -454,7 +454,7 @@ export const __webpack_modules__ = {
454
454
  });
455
455
  return {
456
456
  command,
457
- version: "0.0.6",
457
+ version: "0.0.7",
458
458
  rootPath,
459
459
  reporters,
460
460
  snapshotManager,
package/dist/612.js CHANGED
@@ -317,7 +317,8 @@ global.__rstest_clean_core_cache__ = __rstest_clean_core_cache__;
317
317
  target: 'node'
318
318
  },
319
319
  tools: {
320
- rspack: (config)=>{
320
+ rspack: (config, { isProd })=>{
321
+ config.mode = isProd ? 'production' : 'development';
321
322
  config.output ??= {};
322
323
  config.output.iife = false;
323
324
  config.output.importFunctionName = '__rstest_dynamic_import__';
@@ -352,6 +353,7 @@ global.__rstest_clean_core_cache__ = __rstest_clean_core_cache__;
352
353
  config.optimization = {
353
354
  moduleIds: 'named',
354
355
  chunkIds: 'named',
356
+ nodeEnv: false,
355
357
  ...config.optimization || {},
356
358
  runtimeChunk: {
357
359
  name: 'runtime'
package/dist/813.js CHANGED
@@ -134,6 +134,7 @@ export const __webpack_modules__ = {
134
134
  __webpack_require__("./src/utils/logger.ts");
135
135
  __webpack_require__("node:fs");
136
136
  __webpack_require__("node:fs/promises");
137
+ __webpack_require__("node:module");
137
138
  __webpack_require__("pathe");
138
139
  }
139
140
  };
package/dist/867.js CHANGED
@@ -586,7 +586,7 @@ export const __webpack_modules__ = {
586
586
  }
587
587
  };
588
588
  }
589
- function limitConcurrency(concurrency = Number.POSITIVE_INFINITY) {
589
+ function limitConcurrency(concurrency = 1 / 0) {
590
590
  let running = 0;
591
591
  const queue = [];
592
592
  const runNext = ()=>{
@@ -1739,6 +1739,7 @@ export const __webpack_modules__ = {
1739
1739
  __webpack_require__("./src/utils/logger.ts");
1740
1740
  __webpack_require__("node:fs");
1741
1741
  __webpack_require__("node:fs/promises");
1742
+ __webpack_require__("node:module");
1742
1743
  __webpack_require__("pathe");
1743
1744
  }
1744
1745
  };
package/dist/cli.js CHANGED
@@ -7,6 +7,7 @@ import * as __WEBPACK_EXTERNAL_MODULE_fs__ from "fs";
7
7
  import * as __WEBPACK_EXTERNAL_MODULE_node_events_0a6aefe7__ from "node:events";
8
8
  import * as __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__ from "node:fs";
9
9
  import * as __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__ from "node:fs/promises";
10
+ import * as __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__ from "node:module";
10
11
  import * as __WEBPACK_EXTERNAL_MODULE_node_os_74b4b876__ from "node:os";
11
12
  import * as __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__ from "node:path";
12
13
  import * as __WEBPACK_EXTERNAL_MODULE_node_url_e96de089__ from "node:url";
@@ -2469,6 +2470,7 @@ var __webpack_modules__ = {
2469
2470
  var logger = __webpack_require__("./src/utils/logger.ts");
2470
2471
  var external_node_fs_ = __webpack_require__("node:fs");
2471
2472
  var promises_ = __webpack_require__("node:fs/promises");
2473
+ var external_node_module_ = __webpack_require__("node:module");
2472
2474
  var external_pathe_ = __webpack_require__("pathe");
2473
2475
  var dist = __webpack_require__("../../node_modules/.pnpm/tinyglobby@0.2.14/node_modules/tinyglobby/dist/index.mjs");
2474
2476
  const filterFiles = (testFiles, filters, dir)=>{
@@ -2518,18 +2520,38 @@ var __webpack_modules__ = {
2518
2520
  ];
2519
2521
  }));
2520
2522
  };
2523
+ const tryResolve = (request, rootPath)=>{
2524
+ try {
2525
+ const require1 = (0, external_node_module_.createRequire)(rootPath);
2526
+ return require1.resolve(request, {
2527
+ paths: [
2528
+ rootPath
2529
+ ]
2530
+ });
2531
+ } catch (_err) {
2532
+ return;
2533
+ }
2534
+ };
2521
2535
  const getSetupFiles = (setups, rootPath)=>Object.fromEntries((0, helper.XQ)(setups).map((setupFile)=>{
2522
2536
  const setupFilePath = (0, helper.ZY)(rootPath, setupFile);
2523
- if (!(0, external_node_fs_.existsSync)(setupFilePath)) {
2524
- let errorMessage = `Setup file ${helper.$_.red(setupFile)} not found`;
2525
- if (setupFilePath !== setupFile) errorMessage += helper.$_.gray(` (resolved path: ${setupFilePath})`);
2526
- throw errorMessage;
2537
+ try {
2538
+ if (!(0, external_node_fs_.existsSync)(setupFilePath)) {
2539
+ let errorMessage = `Setup file ${helper.$_.red(setupFile)} not found`;
2540
+ if (setupFilePath !== setupFile) errorMessage += helper.$_.gray(` (resolved path: ${setupFilePath})`);
2541
+ throw errorMessage;
2542
+ }
2543
+ const relativePath = external_pathe_["default"].relative(rootPath, setupFilePath);
2544
+ return [
2545
+ formatTestEntryName(relativePath),
2546
+ setupFilePath
2547
+ ];
2548
+ } catch (err) {
2549
+ if (tryResolve(setupFile, rootPath)) return [
2550
+ formatTestEntryName(setupFile),
2551
+ setupFile
2552
+ ];
2553
+ throw err;
2527
2554
  }
2528
- const relativePath = external_pathe_["default"].relative(rootPath, setupFilePath);
2529
- return [
2530
- formatTestEntryName(relativePath),
2531
- setupFilePath
2532
- ];
2533
2555
  }));
2534
2556
  const prettyTestPath = (testPath)=>{
2535
2557
  const { dir, base } = (0, helper.H)(testPath);
@@ -2839,6 +2861,9 @@ var __webpack_modules__ = {
2839
2861
  "node:fs/promises": function(module) {
2840
2862
  module.exports = __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__;
2841
2863
  },
2864
+ "node:module": function(module) {
2865
+ module.exports = __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__;
2866
+ },
2842
2867
  "node:os": function(module) {
2843
2868
  module.exports = __WEBPACK_EXTERNAL_MODULE_node_os_74b4b876__;
2844
2869
  },
@@ -3671,7 +3696,7 @@ function prepareCli() {
3671
3696
  if (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) console.log();
3672
3697
  }
3673
3698
  function showRstest() {
3674
- logger.k.greet(" Rstest v0.0.6");
3699
+ logger.k.greet(" Rstest v0.0.7");
3675
3700
  logger.k.log('');
3676
3701
  }
3677
3702
  const applyCommonOptions = (cli)=>{
@@ -3718,7 +3743,7 @@ async function initCli(options) {
3718
3743
  function setupCommands() {
3719
3744
  const cli = dist('rstest');
3720
3745
  cli.help();
3721
- cli.version("0.0.6");
3746
+ cli.version("0.0.7");
3722
3747
  applyCommonOptions(cli);
3723
3748
  cli.command('[...filters]', 'run tests').action(async (filters, options)=>{
3724
3749
  showRstest();
package/dist/worker.js CHANGED
@@ -9,6 +9,7 @@ import * as __WEBPACK_EXTERNAL_MODULE_node_assert_3e74d44e__ from "node:assert";
9
9
  import * as __WEBPACK_EXTERNAL_MODULE_node_console_8631dfae__ from "node:console";
10
10
  import * as __WEBPACK_EXTERNAL_MODULE_node_fs_5ea92f0c__ from "node:fs";
11
11
  import * as __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__ from "node:fs/promises";
12
+ import * as __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__ from "node:module";
12
13
  import * as __WEBPACK_EXTERNAL_MODULE_node_os_74b4b876__ from "node:os";
13
14
  import * as __WEBPACK_EXTERNAL_MODULE_node_timers_7045d530__ from "node:timers";
14
15
  import * as __WEBPACK_EXTERNAL_MODULE_node_util_1b29d436__ from "node:util";
@@ -17,7 +18,6 @@ import * as __WEBPACK_EXTERNAL_MODULE_path__ from "path";
17
18
  import * as __WEBPACK_EXTERNAL_MODULE_pathe__ from "pathe";
18
19
  import * as __WEBPACK_EXTERNAL_MODULE_tty__ from "tty";
19
20
  import * as __WEBPACK_EXTERNAL_MODULE_util__ from "util";
20
- import { createRequire } from "node:module";
21
21
  import { isAbsolute } from "node:path";
22
22
  import { pathToFileURL } from "node:url";
23
23
  import node_vm from "node:vm";
@@ -2887,7 +2887,7 @@ var __webpack_modules__ = {
2887
2887
  return -1 !== position && (-1 === terminatorPosition || position < terminatorPosition);
2888
2888
  };
2889
2889
  },
2890
- "../../node_modules/.pnpm/jest-diff@30.0.3/node_modules/jest-diff/build/index.js": function(module, __unused_webpack_exports, __webpack_require__) {
2890
+ "../../node_modules/.pnpm/jest-diff@30.0.4/node_modules/jest-diff/build/index.js": function(module, __unused_webpack_exports, __webpack_require__) {
2891
2891
  /*!
2892
2892
  * /**
2893
2893
  * * Copyright (c) Meta Platforms, Inc. and affiliates.
@@ -4556,8 +4556,8 @@ var __webpack_modules__ = {
4556
4556
  escapeString: true,
4557
4557
  highlight: false,
4558
4558
  indent: 2,
4559
- maxDepth: Number.POSITIVE_INFINITY,
4560
- maxWidth: Number.POSITIVE_INFINITY,
4559
+ maxDepth: 1 / 0,
4560
+ maxWidth: 1 / 0,
4561
4561
  min: false,
4562
4562
  plugins: [],
4563
4563
  printBasicPrototype: true,
@@ -4978,7 +4978,7 @@ var __webpack_modules__ = {
4978
4978
  o: ()=>formatTestError
4979
4979
  });
4980
4980
  var external_node_util_ = __webpack_require__("node:util");
4981
- var build = __webpack_require__("../../node_modules/.pnpm/jest-diff@30.0.3/node_modules/jest-diff/build/index.js");
4981
+ var build = __webpack_require__("../../node_modules/.pnpm/jest-diff@30.0.4/node_modules/jest-diff/build/index.js");
4982
4982
  build.DIFF_DELETE;
4983
4983
  build.DIFF_EQUAL;
4984
4984
  build.DIFF_INSERT;
@@ -5427,6 +5427,9 @@ var __webpack_modules__ = {
5427
5427
  "node:fs/promises": function(module) {
5428
5428
  module.exports = __WEBPACK_EXTERNAL_MODULE_node_fs_promises_153e37e0__;
5429
5429
  },
5430
+ "node:module": function(module) {
5431
+ module.exports = __WEBPACK_EXTERNAL_MODULE_node_module_ab9f2194__;
5432
+ },
5430
5433
  "node:os": function(module) {
5431
5434
  module.exports = __WEBPACK_EXTERNAL_MODULE_node_os_74b4b876__;
5432
5435
  },
@@ -5581,6 +5584,7 @@ __webpack_require__("./src/runtime/worker/setup.ts");
5581
5584
  var constants = __webpack_require__("./src/utils/constants.ts");
5582
5585
  var helper = __webpack_require__("./src/utils/helper.ts");
5583
5586
  var util = __webpack_require__("./src/runtime/util.ts");
5587
+ var external_node_module_ = __webpack_require__("node:module");
5584
5588
  var external_pathe_ = __webpack_require__("pathe");
5585
5589
  var logger = __webpack_require__("./src/utils/logger.ts");
5586
5590
  const shouldInterop = ({ interopDefault = true, modulePath, mod })=>{
@@ -5626,8 +5630,14 @@ const asModule = async (something, defaultExport, context, unlinked)=>{
5626
5630
  return m;
5627
5631
  };
5628
5632
  const isRelativePath = (p)=>/^\.\.?\//.test(p);
5629
- const loadModule_createRequire = (filename, distPath, rstestContext, assetFiles, interopDefault)=>{
5630
- const _require = createRequire(filename);
5633
+ const createRequire = (filename, distPath, rstestContext, assetFiles, interopDefault)=>{
5634
+ const _require = (()=>{
5635
+ try {
5636
+ return (0, external_node_module_.createRequire)(filename);
5637
+ } catch (_err) {
5638
+ return (0, external_node_module_.createRequire)(distPath);
5639
+ }
5640
+ })();
5631
5641
  const require1 = (id)=>{
5632
5642
  const currentDirectory = external_pathe_["default"].dirname(distPath);
5633
5643
  const joinedPath = isRelativePath(id) ? external_pathe_["default"].join(currentDirectory, id) : id;
@@ -5699,7 +5709,7 @@ const loadModule = ({ codeContent, distPath, testPath, rstestContext, assetFiles
5699
5709
  const context = {
5700
5710
  module: localModule,
5701
5711
  exports: localModule.exports,
5702
- require: loadModule_createRequire(testPath, distPath, rstestContext, assetFiles, interopDefault),
5712
+ require: createRequire(testPath, distPath, rstestContext, assetFiles, interopDefault),
5703
5713
  __rstest_dynamic_import__: defineRstestDynamicImport({
5704
5714
  testPath,
5705
5715
  interopDefault
@@ -297,7 +297,7 @@ declare interface MatcherState extends MatcherState_2 {
297
297
 
298
298
  declare type MaybePromise<T> = T | Promise<T>;
299
299
 
300
- declare interface Mock<T extends FunctionLike = FunctionLike> extends MockInstance<T> {
300
+ export declare interface Mock<T extends FunctionLike = FunctionLike> extends MockInstance<T> {
301
301
  new (...args: Parameters<T>): ReturnType<T>;
302
302
  (...args: Parameters<T>): ReturnType<T>;
303
303
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rstest/core",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "description": "The Rsbuild-based test tool.",
5
5
  "bugs": {
6
6
  "url": "https://github.com/web-infra-dev/rstest/issues"
@@ -48,12 +48,12 @@
48
48
  "importMeta.d.ts"
49
49
  ],
50
50
  "dependencies": {
51
- "@rsbuild/core": "1.4.3",
51
+ "@rsbuild/core": "1.4.6",
52
52
  "@types/chai": "^5.2.2",
53
53
  "@vitest/expect": "^3.2.4",
54
54
  "@vitest/snapshot": "^3.2.4",
55
55
  "birpc": "2.4.0",
56
- "chai": "^5.2.0",
56
+ "chai": "^5.2.1",
57
57
  "pathe": "^2.0.3",
58
58
  "std-env": "^3.9.0",
59
59
  "tinypool": "^1.1.1"
@@ -62,7 +62,7 @@
62
62
  "@babel/code-frame": "^7.27.1",
63
63
  "@jridgewell/trace-mapping": "0.3.29",
64
64
  "@microsoft/api-extractor": "^7.52.8",
65
- "@rslib/core": "0.10.4",
65
+ "@rslib/core": "0.10.5",
66
66
  "@sinonjs/fake-timers": "^14.0.0",
67
67
  "@types/babel__code-frame": "^7.0.6",
68
68
  "@types/jsdom": "^21.1.7",
@@ -70,7 +70,7 @@
70
70
  "@types/source-map-support": "^0.5.10",
71
71
  "cac": "^6.7.14",
72
72
  "happy-dom": "^18.0.1",
73
- "jest-diff": "^30.0.3",
73
+ "jest-diff": "^30.0.4",
74
74
  "jsdom": "^26.1.0",
75
75
  "license-webpack-plugin": "^4.0.2",
76
76
  "picocolors": "^1.1.1",