@rstest/core 0.7.6 → 0.7.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/0~2255.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 "./5693.js";
5
- const external_node_fs_ = __webpack_require__("fs");
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~6973.js CHANGED
@@ -6,7 +6,7 @@ import { fileURLToPath } from "./6198.js";
6
6
  import { rspack } from "./9131.js";
7
7
  import { getAbsolutePath, formatTestEntryName } from "./1157.js";
8
8
  import { posix } from "./3278.js";
9
- const external_node_fs_ = __webpack_require__("fs");
9
+ const external_node_fs_ = __webpack_require__("node:fs");
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 tryResolve = (request, rootPath)=>{
package/dist/0~7583.js CHANGED
@@ -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~89.js CHANGED
@@ -179,6 +179,7 @@ const createPool = async ({ context, recommendWorkerCount = 1 / 0 })=>{
179
179
  needFlagExperimentalDetectModule() ? '--experimental-detect-module' : void 0
180
180
  ].filter(Boolean),
181
181
  env: {
182
+ ...process.env,
182
183
  NODE_ENV: 'test',
183
184
  FORCE_COLOR: '1' === process.env.NO_COLOR ? '0' : '1'
184
185
  }
@@ -407,6 +408,11 @@ const require = /*#__PURE__*/ __rstest_shim_module__.createRequire(import.meta.u
407
408
  const pluginBasic = (context)=>({
408
409
  name: 'rstest:basic',
409
410
  setup: (api)=>{
411
+ api.modifyBundlerChain((chain)=>{
412
+ chain.optimization.splitChunks({
413
+ chunks: 'all'
414
+ });
415
+ });
410
416
  api.modifyEnvironmentConfig(async (config, { mergeEnvironmentConfig, name })=>{
411
417
  const { normalizedConfig: { resolve, source, output, tools, performance, dev, testEnvironment }, outputModule, rootPath } = context.projects.find((p)=>p.environmentName === name);
412
418
  return mergeEnvironmentConfig(config, {
@@ -665,7 +671,7 @@ const pluginInspect = ()=>enable ? {
665
671
  });
666
672
  }
667
673
  } : null;
668
- const external_node_fs_ = __webpack_require__("fs");
674
+ const external_node_fs_ = __webpack_require__("node:fs");
669
675
  const mockRuntime_dirname = external_node_path_["default"].dirname(fileURLToPath(import.meta.url));
670
676
  class MockRuntimeRspackPlugin {
671
677
  outputModule;
@@ -757,8 +763,7 @@ const pluginCacheControl = (setupFiles)=>({
757
763
  if (setupFiles.length) api.transform({
758
764
  test: setupFiles
759
765
  }, ({ code })=>({
760
- code: `
761
- ${code}
766
+ code: `${code}
762
767
  if (global.setupIds && __webpack_module__.id) {
763
768
  global.setupIds.push(__webpack_module__.id);
764
769
  }
package/dist/0~9634.js CHANGED
@@ -5,7 +5,7 @@ import "./5693.js";
5
5
  import { prepareRsbuild, createPool, createRsbuildServer, runGlobalTeardown, runGlobalSetup } from "./0~89.js";
6
6
  import { getTestEntries, getTaskNameWithPrefix, prettyTestPath, ROOT_SUITE_NAME, bgColor } from "./1157.js";
7
7
  import { logger_logger } from "./3278.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);
package/dist/1157.js CHANGED
@@ -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);
package/dist/554.js CHANGED
@@ -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;
package/dist/5693.js CHANGED
@@ -73,7 +73,7 @@ __webpack_require__.add({
73
73
  module.exports = createColors();
74
74
  module.exports.createColors = createColors;
75
75
  },
76
- fs (module) {
76
+ "node:fs" (module) {
77
77
  module.exports = __rspack_external_node_fs_5ea92f0c;
78
78
  },
79
79
  "node:os" (module) {
package/dist/7913.js CHANGED
@@ -4857,7 +4857,7 @@ __webpack_require__.add({
4857
4857
  var path = __webpack_require__("node:path");
4858
4858
  var fs;
4859
4859
  try {
4860
- fs = __webpack_require__("fs");
4860
+ fs = __webpack_require__("node:fs");
4861
4861
  if (!fs.existsSync || !fs.readFileSync) fs = null;
4862
4862
  } catch (err) {}
4863
4863
  var bufferFrom = __webpack_require__("../../node_modules/.pnpm/buffer-from@1.1.2/node_modules/buffer-from/index.js");
package/dist/9131.js CHANGED
@@ -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.6");
506
+ logger_logger.greet(" Rstest v0.7.7");
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.6");
550
+ cli.version("0.7.7");
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);
@@ -636,8 +636,16 @@ async function config_loadConfig({ cwd = process.cwd(), path, envMode, configLoa
636
636
  envMode,
637
637
  loader: configLoader
638
638
  });
639
+ let config = content;
640
+ if (config.extends) {
641
+ const extendsConfig = 'function' == typeof config.extends ? await config.extends(Object.freeze({
642
+ ...config
643
+ })) : config.extends;
644
+ delete extendsConfig.projects;
645
+ config = mergeRstestConfig(extendsConfig, config);
646
+ }
639
647
  return {
640
- content: content,
648
+ content: config,
641
649
  filePath: configFilePath
642
650
  };
643
651
  }
@@ -2373,7 +2381,7 @@ class Rstest {
2373
2381
  });
2374
2382
  this.reporters = reporters;
2375
2383
  this.snapshotManager = snapshotManager;
2376
- this.version = "0.7.6";
2384
+ this.version = "0.7.7";
2377
2385
  this.rootPath = rootPath;
2378
2386
  this.originalConfig = userConfig;
2379
2387
  this.normalizedConfig = rstestConfig;
package/dist/index.d.ts CHANGED
@@ -820,6 +820,10 @@ declare interface ExpectStatic_2 extends Chai.ExpectStatic, Matchers, Asymmetric
820
820
  not: AsymmetricMatchersContaining;
821
821
  }
822
822
 
823
+ export declare type ExtendConfig = Omit<RstestConfig, 'projects'>;
824
+
825
+ export declare type ExtendConfigFn = (userConfig: Readonly<RstestConfig>) => MaybePromise<ExtendConfig>;
826
+
823
827
  /**
824
828
  * Names of clock methods that may be faked by install.
825
829
  */
@@ -2075,7 +2079,7 @@ export declare const onTestFinished: Rstest['onTestFinished'];
2075
2079
 
2076
2080
  declare type OnTestFinishedHandler = (ctx: TestContext) => MaybePromise<void>;
2077
2081
 
2078
- declare type OptionalKeys = 'testNamePattern' | 'plugins' | 'source' | 'resolve' | 'output' | 'performance' | 'tools' | 'dev' | 'onConsoleLog' | 'chaiConfig' | 'resolveSnapshotPath';
2082
+ declare type OptionalKeys = 'testNamePattern' | 'plugins' | 'source' | 'resolve' | 'output' | 'performance' | 'tools' | 'dev' | 'onConsoleLog' | 'chaiConfig' | 'resolveSnapshotPath' | 'extends';
2079
2083
 
2080
2084
  declare interface Options {
2081
2085
  logger: {
@@ -2307,6 +2311,10 @@ export declare const rstest: RstestUtilities;
2307
2311
  export declare type RstestCommand = 'watch' | 'run' | 'list';
2308
2312
 
2309
2313
  export declare interface RstestConfig {
2314
+ /**
2315
+ * Extend configuration from adapters
2316
+ */
2317
+ extends?: ExtendConfigFn | ExtendConfig;
2310
2318
  /**
2311
2319
  * Project root
2312
2320
  *
package/dist/worker.d.ts CHANGED
@@ -708,6 +708,10 @@ declare interface ExpectStatic_2 extends Chai.ExpectStatic, Matchers, Asymmetric
708
708
  not: AsymmetricMatchersContaining;
709
709
  }
710
710
 
711
+ declare type ExtendConfig = Omit<RstestConfig, 'projects'>;
712
+
713
+ declare type ExtendConfigFn = (userConfig: Readonly<RstestConfig>) => MaybePromise<ExtendConfig>;
714
+
711
715
  declare class FileCoverage implements FileCoverageData {
712
716
  constructor(data: string | FileCoverage | FileCoverageData);
713
717
  merge(other: FileCoverageData): void;
@@ -1712,7 +1716,7 @@ declare type OnTestFailedHandler = (ctx: TestContext) => MaybePromise<void>;
1712
1716
 
1713
1717
  declare type OnTestFinishedHandler = (ctx: TestContext) => MaybePromise<void>;
1714
1718
 
1715
- declare type OptionalKeys = 'testNamePattern' | 'plugins' | 'source' | 'resolve' | 'output' | 'performance' | 'tools' | 'dev' | 'onConsoleLog' | 'chaiConfig' | 'resolveSnapshotPath';
1719
+ declare type OptionalKeys = 'testNamePattern' | 'plugins' | 'source' | 'resolve' | 'output' | 'performance' | 'tools' | 'dev' | 'onConsoleLog' | 'chaiConfig' | 'resolveSnapshotPath' | 'extends';
1716
1720
 
1717
1721
  declare interface Options {
1718
1722
  logger: {
@@ -1920,6 +1924,10 @@ declare type RoObject<T> = {
1920
1924
  declare type RstestCommand = 'watch' | 'run' | 'list';
1921
1925
 
1922
1926
  declare interface RstestConfig {
1927
+ /**
1928
+ * Extend configuration from adapters
1929
+ */
1930
+ extends?: ExtendConfigFn | ExtendConfig;
1923
1931
  /**
1924
1932
  * Project root
1925
1933
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rstest/core",
3
- "version": "0.7.6",
3
+ "version": "0.7.7",
4
4
  "description": "The Rsbuild-based test tool.",
5
5
  "bugs": {
6
6
  "url": "https://github.com/web-infra-dev/rstest/issues"
@@ -59,7 +59,7 @@
59
59
  "@babel/code-frame": "^7.27.1",
60
60
  "@jridgewell/trace-mapping": "0.3.31",
61
61
  "@microsoft/api-extractor": "^7.55.2",
62
- "@rslib/core": "0.18.5",
62
+ "@rslib/core": "^0.18.6",
63
63
  "@sinonjs/fake-timers": "^15.1.0",
64
64
  "@types/babel__code-frame": "^7.0.6",
65
65
  "@types/istanbul-reports": "^3.0.4",