@rstest/core 0.7.7 → 0.7.9

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 (57) hide show
  1. package/LICENSE.md +294 -0
  2. package/dist/0~130.js +2 -2
  3. package/dist/0~1472.js +48 -0
  4. package/dist/0~1981.js +3 -0
  5. package/dist/0~2173.js +25 -10
  6. package/dist/0~2255.js +2 -2
  7. package/dist/0~3062.js +0 -5
  8. package/dist/0~3919.js +1 -1
  9. package/dist/0~4403.js +6 -5
  10. package/dist/0~4809.js +4 -4
  11. package/dist/0~5835.js +2 -2
  12. package/dist/0~62.js +3 -3
  13. package/dist/0~6588.js +3 -3
  14. package/dist/0~6923.js +2 -2
  15. package/dist/0~7583.js +9 -8
  16. package/dist/0~7882.js +1144 -0
  17. package/dist/0~8426.js +1 -2
  18. package/dist/0~89.js +33 -24
  19. package/dist/0~9348.js +953 -0
  20. package/dist/0~9634.js +58 -10
  21. package/dist/1157.js +13 -118
  22. package/dist/{7913.js → 1294.js} +51 -1745
  23. package/dist/2672.js +647 -0
  24. package/dist/3278.js +3 -450
  25. package/dist/4484.js +38 -0
  26. package/dist/487.js +1739 -0
  27. package/dist/4899.js +11 -0
  28. package/dist/5734.js +1 -1
  29. package/dist/{0~6151.js → 6151.js} +169 -21
  30. package/dist/{0~6973.js → 6973.js} +5 -5
  31. package/dist/721.js +9 -0
  32. package/dist/9131.js +559 -502
  33. package/dist/browser-runtime/2~907.js +1211 -0
  34. package/dist/browser-runtime/2~907.js.map +1 -0
  35. package/dist/browser-runtime/389.js +22071 -0
  36. package/dist/browser-runtime/389.js.LICENSE.txt +329 -0
  37. package/dist/browser-runtime/389.js.map +1 -0
  38. package/dist/browser-runtime/index.d.ts +2806 -0
  39. package/dist/browser-runtime/index.js +1 -0
  40. package/dist/browser-runtime/rslib-runtime.js +50 -0
  41. package/dist/browser-runtime/rslib-runtime.js.map +1 -0
  42. package/dist/browser.d.ts +3329 -0
  43. package/dist/browser.js +14 -0
  44. package/dist/cssFilterLoader.mjs +1 -1
  45. package/dist/globalSetupWorker.js +3 -2
  46. package/dist/index.d.ts +67 -2
  47. package/dist/index.js +2 -1
  48. package/dist/rslib-runtime.js +27 -0
  49. package/dist/rstestSuppressWarnings.cjs +9 -0
  50. package/dist/worker.d.ts +66 -2
  51. package/dist/worker.js +415 -1
  52. package/package.json +29 -14
  53. package/dist/0~8957.js +0 -149
  54. package/dist/554.js +0 -417
  55. package/dist/5693.js +0 -91
  56. /package/dist/{7913.js.LICENSE.txt → 1294.js.LICENSE.txt} +0 -0
  57. /package/dist/{0~6151.js.LICENSE.txt → 6151.js.LICENSE.txt} +0 -0
package/dist/0~8426.js CHANGED
@@ -2,8 +2,7 @@ import 'module';
2
2
  /*#__PURE__*/ import.meta.url;
3
3
  import { __webpack_require__ } from "./rslib-runtime.js";
4
4
  import "./1157.js";
5
- import "./5693.js";
6
- import { relative } from "./3278.js";
5
+ import { relative } from "./2672.js";
7
6
  const picomatch = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/index.js");
8
7
  var picomatch_default = /*#__PURE__*/ __webpack_require__.n(picomatch);
9
8
  const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
package/dist/0~89.js CHANGED
@@ -4,13 +4,13 @@ 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 "./5693.js";
8
- import { node_process, basename, isDebug, dirname, posix, resolve as pathe_M_eThtNZ_resolve, join } from "./3278.js";
7
+ import { basename, needFlagExperimentalDetectModule, isDeno, dirname, castArray, resolve as pathe_M_eThtNZ_resolve, serializableConfig, ADDITIONAL_NODE_BUILTINS, bgColor, join } from "./2672.js";
8
+ import { node_process, posix, isDebug } from "./3278.js";
9
9
  import { fileURLToPath } from "./6198.js";
10
10
  import { node_v8, createBirpc } from "./3216.js";
11
- import { serializableConfig, bgColor, TEMP_RSTEST_OUTPUT_DIR, TEMP_RSTEST_OUTPUT_DIR_GLOB, castArray, ADDITIONAL_NODE_BUILTINS, needFlagExperimentalDetectModule } from "./1157.js";
11
+ import { TEMP_RSTEST_OUTPUT_DIR, TEMP_RSTEST_OUTPUT_DIR_GLOB } from "./1157.js";
12
12
  import { isBuiltin } from "./4881.js";
13
- import { core_logger, createRsbuild } from "./9131.js";
13
+ import { rsbuild as __rspack_external__rsbuild_core_1b356efc } from "./4484.js";
14
14
  const DefaultMaxHeapSize = 1073741824;
15
15
  function memory_isMemorySufficient(options) {
16
16
  const { memoryThreshold = 0.7, maxHeapSize = DefaultMaxHeapSize } = options || {};
@@ -67,8 +67,6 @@ const createForksPool = (poolOptions)=>{
67
67
  isolateWorkers: isolate
68
68
  };
69
69
  const pool = new Tinypool(options);
70
- const destroy = pool.destroy.bind(pool);
71
- process.on('SIGTERM', destroy);
72
70
  return {
73
71
  name: 'forks',
74
72
  runTest: async ({ options, rpcMethods })=>{
@@ -91,10 +89,7 @@ const createForksPool = (poolOptions)=>{
91
89
  cleanup();
92
90
  }
93
91
  },
94
- close: ()=>{
95
- process.off('SIGTERM', destroy);
96
- return destroy();
97
- }
92
+ close: ()=>pool.destroy()
98
93
  };
99
94
  };
100
95
  const external_node_os_ = __webpack_require__("node:os");
@@ -156,6 +151,18 @@ const filterAssetsByEntry = async (entryInfo, getAssetFiles, getSourceMaps, setu
156
151
  sourceMaps: neededSourceMaps
157
152
  };
158
153
  };
154
+ const getNodeExecArgv = ()=>{
155
+ const __filename = fileURLToPath(import.meta.url);
156
+ const __dirname = dirname(__filename);
157
+ const suppressFile = join(__dirname, './rstestSuppressWarnings.cjs');
158
+ return [
159
+ '--experimental-vm-modules',
160
+ '--experimental-import-meta-resolve',
161
+ needFlagExperimentalDetectModule() ? '--experimental-detect-module' : void 0,
162
+ '--require',
163
+ suppressFile
164
+ ].filter(Boolean);
165
+ };
159
166
  const createPool = async ({ context, recommendWorkerCount = 1 / 0 })=>{
160
167
  const execArgv = process.execArgv.filter((execArg)=>execArg.startsWith('--perf') || execArg.startsWith('--cpu-prof') || execArg.startsWith('--heap-prof') || execArg.startsWith('--diagnostic-dir'));
161
168
  const numCpus = getNumCpus();
@@ -173,11 +180,8 @@ const createPool = async ({ context, recommendWorkerCount = 1 / 0 })=>{
173
180
  execArgv: [
174
181
  ...poolOptions?.execArgv ?? [],
175
182
  ...execArgv,
176
- '--experimental-vm-modules',
177
- '--experimental-import-meta-resolve',
178
- '--no-warnings',
179
- needFlagExperimentalDetectModule() ? '--experimental-detect-module' : void 0
180
- ].filter(Boolean),
183
+ ...isDeno ? [] : getNodeExecArgv()
184
+ ],
181
185
  env: {
182
186
  ...process.env,
183
187
  NODE_ENV: 'test',
@@ -356,8 +360,6 @@ async function createSetupPool() {
356
360
  }
357
361
  };
358
362
  const pool = new Tinypool(options);
359
- const destroy = pool.destroy.bind(pool);
360
- process.on('SIGTERM', destroy);
361
363
  return pool;
362
364
  }
363
365
  async function runGlobalSetup({ globalSetupEntries, assetFiles, sourceMaps, interopDefault, outputModule }) {
@@ -408,10 +410,11 @@ const require = /*#__PURE__*/ __rstest_shim_module__.createRequire(import.meta.u
408
410
  const pluginBasic = (context)=>({
409
411
  name: 'rstest:basic',
410
412
  setup: (api)=>{
411
- api.modifyBundlerChain((chain)=>{
413
+ api.modifyBundlerChain((chain, { CHAIN_ID })=>{
412
414
  chain.optimization.splitChunks({
413
415
  chunks: 'all'
414
416
  });
417
+ chain.module.rule(CHAIN_ID.RULE.JS).delete('type');
415
418
  });
416
419
  api.modifyEnvironmentConfig(async (config, { mergeEnvironmentConfig, name })=>{
417
420
  const { normalizedConfig: { resolve, source, output, tools, performance, dev, testEnvironment }, outputModule, rootPath } = context.projects.find((p)=>p.environmentName === name);
@@ -457,6 +460,11 @@ const pluginBasic = (context)=>({
457
460
  hoistMockModule: true,
458
461
  manualMockRoot: posix.resolve(rootPath, '__mocks__')
459
462
  }));
463
+ config.module.rules ??= [];
464
+ config.module.rules.push({
465
+ test: /\.mts$/,
466
+ type: "javascript/esm"
467
+ });
460
468
  if (outputModule) config.plugins.push(new rspack.BannerPlugin({
461
469
  banner: requireShim,
462
470
  stage: rspack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE - 1,
@@ -485,7 +493,7 @@ const pluginBasic = (context)=>({
485
493
  '.jsx',
486
494
  '.tsx'
487
495
  ];
488
- if ('node' === testEnvironment) config.resolve.mainFields = config.resolve.mainFields?.filter((filed)=>'module' !== filed) || [
496
+ if ('node' === testEnvironment.name) config.resolve.mainFields = config.resolve.mainFields?.filter((filed)=>'module' !== filed) || [
489
497
  'main'
490
498
  ];
491
499
  config.resolve.byDependency ??= {};
@@ -618,7 +626,7 @@ const pluginExternal = (context)=>({
618
626
  const { normalizedConfig: { testEnvironment }, outputModule } = context.projects.find((p)=>p.environmentName === name);
619
627
  return mergeEnvironmentConfig(config, {
620
628
  output: {
621
- externals: 'node' === testEnvironment ? [
629
+ externals: 'node' === testEnvironment.name ? [
622
630
  autoExternalNodeModules(outputModule)
623
631
  ] : void 0
624
632
  },
@@ -671,7 +679,7 @@ const pluginInspect = ()=>enable ? {
671
679
  });
672
680
  }
673
681
  } : null;
674
- const external_node_fs_ = __webpack_require__("node:fs");
682
+ const external_node_fs_ = __webpack_require__("fs");
675
683
  const mockRuntime_dirname = external_node_path_["default"].dirname(fileURLToPath(import.meta.url));
676
684
  class MockRuntimeRspackPlugin {
677
685
  outputModule;
@@ -790,10 +798,11 @@ function parseInlineSourceMapStr(code) {
790
798
  const isMultiCompiler = (compiler)=>'compilers' in compiler && Array.isArray(compiler.compilers);
791
799
  const prepareRsbuild = async (context, globTestSourceEntries, setupFiles, globalSetupFiles)=>{
792
800
  const { command, normalizedConfig: { isolate, dev = {}, coverage } } = context;
801
+ const projects = context.projects.filter((project)=>!project.normalizedConfig.browser.enabled);
793
802
  const debugMode = isDebug();
794
- core_logger.level = debugMode ? 'verbose' : 'error';
803
+ __rspack_external__rsbuild_core_1b356efc.logger.level = debugMode ? 'verbose' : 'error';
795
804
  const writeToDisk = dev.writeToDisk || debugMode;
796
- const rsbuildInstance = await createRsbuild({
805
+ const rsbuildInstance = await (0, __rspack_external__rsbuild_core_1b356efc.createRsbuild)({
797
806
  callerName: 'rstest',
798
807
  config: {
799
808
  root: context.rootPath,
@@ -809,7 +818,7 @@ const prepareRsbuild = async (context, globTestSourceEntries, setupFiles, global
809
818
  hmr: false,
810
819
  writeToDisk
811
820
  },
812
- environments: Object.fromEntries(context.projects.map((project)=>[
821
+ environments: Object.fromEntries(projects.map((project)=>[
813
822
  project.environmentName,
814
823
  {
815
824
  plugins: project.normalizedConfig.plugins,