@rstest/core 0.7.6 → 0.7.8

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~4809.js CHANGED
@@ -4,12 +4,12 @@ import { checkPkgInstalled } from "./7913.js";
4
4
  import { installGlobal, addDefaultErrorHandler } from "./0~3062.js";
5
5
  const environment = {
6
6
  name: 'happy-dom',
7
- async setup (global, { happyDom = {} }) {
7
+ setup: async (global, options = {})=>{
8
8
  checkPkgInstalled('happy-dom');
9
9
  const { Window } = await import("happy-dom");
10
10
  const win = new Window({
11
- ...happyDom,
12
- url: happyDom.url || 'http://localhost:3000',
11
+ ...options,
12
+ url: options.url || 'http://localhost:3000',
13
13
  console: console && global.console ? global.console : void 0
14
14
  });
15
15
  const cleanupGlobal = installGlobal(global, win, {
package/dist/0~6151.js CHANGED
@@ -11774,10 +11774,6 @@ const SnapshotPlugin = (workerState)=>{
11774
11774
  const isNot = utils.flag(this, 'negate');
11775
11775
  if (isNot) throw new Error('toMatchInlineSnapshot cannot be used with "not"');
11776
11776
  const test = getTest(this);
11777
- if (test) {
11778
- const isInsideEach = test.each || test.inTestEach;
11779
- if (isInsideEach) throw new Error('InlineSnapshot cannot be used inside of test.each or describe.each');
11780
- }
11781
11777
  const expected = utils.flag(this, 'object');
11782
11778
  const error = utils.flag(this, 'error');
11783
11779
  if ('string' == typeof properties) {
@@ -11821,10 +11817,6 @@ const SnapshotPlugin = (workerState)=>{
11821
11817
  const isNot = utils.flag(this, 'negate');
11822
11818
  if (isNot) throw new Error('toThrowErrorMatchingInlineSnapshot cannot be used with "not"');
11823
11819
  const test = getTest(this);
11824
- if (test) {
11825
- const isInsideEach = test.each || test.inTestEach;
11826
- if (isInsideEach) throw new Error('InlineSnapshot cannot be used inside of test.each or describe.each');
11827
- }
11828
11820
  const expected = utils.flag(this, 'object');
11829
11821
  const error = utils.flag(this, 'error');
11830
11822
  const promise = utils.flag(this, 'promise');
package/dist/0~62.js CHANGED
@@ -4,10 +4,10 @@ import { checkPkgInstalled } from "./7913.js";
4
4
  import { installGlobal, addDefaultErrorHandler } from "./0~3062.js";
5
5
  const environment = {
6
6
  name: 'jsdom',
7
- async setup (global, { jsdom = {} }) {
7
+ setup: async (global, options)=>{
8
8
  checkPkgInstalled('jsdom');
9
9
  const { CookieJar, JSDOM, ResourceLoader, VirtualConsole } = await import("jsdom");
10
- const { html = '<!DOCTYPE html>', userAgent, url = 'http://localhost:3000', contentType = 'text/html', pretendToBeVisual = true, includeNodeLocations = false, runScripts = 'dangerously', resources, console = false, cookieJar = false, ...restOptions } = jsdom;
10
+ const { html = '<!DOCTYPE html>', userAgent, url = 'http://localhost:3000', contentType = 'text/html', pretendToBeVisual = true, includeNodeLocations = false, runScripts = 'dangerously', resources, console = false, cookieJar = false, ...restOptions } = options;
11
11
  const dom = new JSDOM(html, {
12
12
  pretendToBeVisual,
13
13
  resources: resources ?? (userAgent ? new ResourceLoader({
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,12 @@ 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, { CHAIN_ID })=>{
412
+ chain.optimization.splitChunks({
413
+ chunks: 'all'
414
+ });
415
+ chain.module.rule(CHAIN_ID.RULE.JS).delete('type');
416
+ });
410
417
  api.modifyEnvironmentConfig(async (config, { mergeEnvironmentConfig, name })=>{
411
418
  const { normalizedConfig: { resolve, source, output, tools, performance, dev, testEnvironment }, outputModule, rootPath } = context.projects.find((p)=>p.environmentName === name);
412
419
  return mergeEnvironmentConfig(config, {
@@ -451,6 +458,11 @@ const pluginBasic = (context)=>({
451
458
  hoistMockModule: true,
452
459
  manualMockRoot: posix.resolve(rootPath, '__mocks__')
453
460
  }));
461
+ config.module.rules ??= [];
462
+ config.module.rules.push({
463
+ test: /\.mts$/,
464
+ type: "javascript/esm"
465
+ });
454
466
  if (outputModule) config.plugins.push(new rspack.BannerPlugin({
455
467
  banner: requireShim,
456
468
  stage: rspack.Compilation.PROCESS_ASSETS_STAGE_OPTIMIZE - 1,
@@ -479,7 +491,7 @@ const pluginBasic = (context)=>({
479
491
  '.jsx',
480
492
  '.tsx'
481
493
  ];
482
- if ('node' === testEnvironment) config.resolve.mainFields = config.resolve.mainFields?.filter((filed)=>'module' !== filed) || [
494
+ if ('node' === testEnvironment.name) config.resolve.mainFields = config.resolve.mainFields?.filter((filed)=>'module' !== filed) || [
483
495
  'main'
484
496
  ];
485
497
  config.resolve.byDependency ??= {};
@@ -612,7 +624,7 @@ const pluginExternal = (context)=>({
612
624
  const { normalizedConfig: { testEnvironment }, outputModule } = context.projects.find((p)=>p.environmentName === name);
613
625
  return mergeEnvironmentConfig(config, {
614
626
  output: {
615
- externals: 'node' === testEnvironment ? [
627
+ externals: 'node' === testEnvironment.name ? [
616
628
  autoExternalNodeModules(outputModule)
617
629
  ] : void 0
618
630
  },
@@ -665,7 +677,7 @@ const pluginInspect = ()=>enable ? {
665
677
  });
666
678
  }
667
679
  } : null;
668
- const external_node_fs_ = __webpack_require__("fs");
680
+ const external_node_fs_ = __webpack_require__("node:fs");
669
681
  const mockRuntime_dirname = external_node_path_["default"].dirname(fileURLToPath(import.meta.url));
670
682
  class MockRuntimeRspackPlugin {
671
683
  outputModule;
@@ -757,8 +769,7 @@ const pluginCacheControl = (setupFiles)=>({
757
769
  if (setupFiles.length) api.transform({
758
770
  test: setupFiles
759
771
  }, ({ code })=>({
760
- code: `
761
- ${code}
772
+ code: `${code}
762
773
  if (global.setupIds && __webpack_module__.id) {
763
774
  global.setupIds.push(__webpack_module__.id);
764
775
  }
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);
@@ -2012,6 +2012,7 @@ var Builder = class {
2012
2012
  return this;
2013
2013
  }
2014
2014
  };
2015
+ const picomatch = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/index.js");
2015
2016
  const isReadonlyArray = Array.isArray;
2016
2017
  const isWin = "win32" === process.platform;
2017
2018
  const ONLY_PARENT_DIRECTORIES = /^(\/?\.\.)+$/;
@@ -2384,5 +2385,4 @@ const formatTestPath = (root, testFilePath)=>{
2384
2385
  if (posix.isAbsolute(testPath) && testPath.includes(root)) testPath = posix.relative(root, testPath);
2385
2386
  return prettyTestPath(testPath);
2386
2387
  };
2387
- const picomatch = __webpack_require__("../../node_modules/.pnpm/picomatch@4.0.3/node_modules/picomatch/index.js");
2388
2388
  export { ADDITIONAL_NODE_BUILTINS, DEFAULT_CONFIG_EXTENSIONS, DEFAULT_CONFIG_NAME, ROOT_SUITE_NAME, TEMP_RSTEST_OUTPUT_DIR, TEMP_RSTEST_OUTPUT_DIR_GLOB, TS_CONFIG_FILE, bgColor, castArray, filterProjects, formatError, formatRootStr, formatTestEntryName, formatTestPath, getAbsolutePath, getTaskNameWithPrefix, getTestEntries, glob, globalApis, isDynamicPattern, isObject, isTTY, lstat, needFlagExperimentalDetectModule, prettyTestPath, prettyTime, promises_stat, readdir, realpath, serializableConfig, undoSerializableConfig, writeFile };
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;
@@ -201,7 +201,7 @@ const preparePool = async ({ entryInfo: { distPath, testPath }, updateSnapshot,
201
201
  process.off('unhandledRejection', unhandledRejection);
202
202
  });
203
203
  const { api, runner } = await createRstestRuntime(workerState);
204
- switch(testEnvironment){
204
+ switch(testEnvironment.name){
205
205
  case 'node':
206
206
  break;
207
207
  case 'jsdom':
@@ -209,7 +209,7 @@ const preparePool = async ({ entryInfo: { distPath, testPath }, updateSnapshot,
209
209
  const { environment } = await import("./0~62.js").then((mod)=>({
210
210
  environment: mod.environment
211
211
  }));
212
- const { teardown } = await environment.setup(global, {});
212
+ const { teardown } = await environment.setup(global, testEnvironment.options || {});
213
213
  cleanupFns.push(()=>teardown(global));
214
214
  break;
215
215
  }
@@ -218,12 +218,12 @@ const preparePool = async ({ entryInfo: { distPath, testPath }, updateSnapshot,
218
218
  const { environment } = await import("./0~4809.js").then((mod)=>({
219
219
  environment: mod.environment
220
220
  }));
221
- const { teardown } = await environment.setup(global, {});
221
+ const { teardown } = await environment.setup(global, testEnvironment.options || {});
222
222
  cleanupFns.push(async ()=>teardown(global));
223
223
  break;
224
224
  }
225
225
  default:
226
- throw new Error(`Unknown test environment: ${testEnvironment}`);
226
+ throw new Error(`Unknown test environment: ${testEnvironment.name}`);
227
227
  }
228
228
  if (globals) registerGlobalApi(api);
229
229
  const rstestContext = {
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.8");
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.8");
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
  }
@@ -684,7 +692,9 @@ const createDefaultConfig = ()=>({
684
692
  update: false,
685
693
  testTimeout: 5000,
686
694
  hookTimeout: 10000,
687
- testEnvironment: 'node',
695
+ testEnvironment: {
696
+ name: 'node'
697
+ },
688
698
  retry: 0,
689
699
  reporters: 'true' === process.env.GITHUB_ACTIONS ? [
690
700
  'default',
@@ -744,6 +754,9 @@ const withDefaultConfig = (config)=>{
744
754
  merged.pool = 'string' == typeof config.pool ? {
745
755
  type: config.pool
746
756
  } : merged.pool;
757
+ merged.testEnvironment = 'string' == typeof config.testEnvironment ? {
758
+ name: config.testEnvironment
759
+ } : merged.testEnvironment;
747
760
  return {
748
761
  ...merged,
749
762
  include: merged.include.map((p)=>formatRootStr(p, merged.root)),
@@ -2373,7 +2386,7 @@ class Rstest {
2373
2386
  });
2374
2387
  this.reporters = reporters;
2375
2388
  this.snapshotManager = snapshotManager;
2376
- this.version = "0.7.6";
2389
+ this.version = "0.7.8";
2377
2390
  this.rootPath = rootPath;
2378
2391
  this.originalConfig = userConfig;
2379
2392
  this.normalizedConfig = rstestConfig;
@@ -19,4 +19,4 @@ function loader(content) {
19
19
  })) return content;
20
20
  return '';
21
21
  }
22
- export { loader as default };
22
+ export default loader;
package/dist/index.d.ts CHANGED
@@ -779,6 +779,13 @@ declare interface EncodedSourceMap extends SourceMapV3 {
779
779
 
780
780
  declare type EncodedSourceMapXInput = EncodedSourceMap & XInput;
781
781
 
782
+ declare type EnvironmentName = 'node' | 'jsdom' | 'happy-dom';
783
+
784
+ declare type EnvironmentWithOptions = {
785
+ name: EnvironmentName;
786
+ options?: Record<string, any>;
787
+ };
788
+
782
789
  export declare type Expect = ExpectStatic;
783
790
 
784
791
  export declare const expect: Rstest['expect'];
@@ -820,6 +827,10 @@ declare interface ExpectStatic_2 extends Chai.ExpectStatic, Matchers, Asymmetric
820
827
  not: AsymmetricMatchersContaining;
821
828
  }
822
829
 
830
+ export declare type ExtendConfig = Omit<RstestConfig, 'projects'>;
831
+
832
+ export declare type ExtendConfigFn = (userConfig: Readonly<RstestConfig>) => MaybePromise<ExtendConfig>;
833
+
823
834
  /**
824
835
  * Names of clock methods that may be faked by install.
825
836
  */
@@ -2028,8 +2039,9 @@ declare interface Node_2 {
2028
2039
  visit(visitor: Visitor, state: any): void;
2029
2040
  }
2030
2041
 
2031
- declare type NormalizedConfig = Required<Omit<RstestConfig, OptionalKeys | 'pool' | 'projects' | 'coverage' | 'setupFiles' | 'globalSetup' | 'exclude'>> & Partial<Pick<RstestConfig, OptionalKeys>> & {
2042
+ declare type NormalizedConfig = Required<Omit<RstestConfig, OptionalKeys | 'pool' | 'projects' | 'coverage' | 'setupFiles' | 'globalSetup' | 'exclude' | 'testEnvironment'>> & Partial<Pick<RstestConfig, OptionalKeys>> & {
2032
2043
  pool: RstestPoolOptions;
2044
+ testEnvironment: EnvironmentWithOptions;
2033
2045
  coverage: NormalizedCoverageOptions;
2034
2046
  setupFiles: string[];
2035
2047
  globalSetup: string[];
@@ -2075,7 +2087,7 @@ export declare const onTestFinished: Rstest['onTestFinished'];
2075
2087
 
2076
2088
  declare type OnTestFinishedHandler = (ctx: TestContext) => MaybePromise<void>;
2077
2089
 
2078
- declare type OptionalKeys = 'testNamePattern' | 'plugins' | 'source' | 'resolve' | 'output' | 'performance' | 'tools' | 'dev' | 'onConsoleLog' | 'chaiConfig' | 'resolveSnapshotPath';
2090
+ declare type OptionalKeys = 'testNamePattern' | 'plugins' | 'source' | 'resolve' | 'output' | 'performance' | 'tools' | 'dev' | 'onConsoleLog' | 'chaiConfig' | 'resolveSnapshotPath' | 'extends';
2079
2091
 
2080
2092
  declare interface Options {
2081
2093
  logger: {
@@ -2307,6 +2319,10 @@ export declare const rstest: RstestUtilities;
2307
2319
  export declare type RstestCommand = 'watch' | 'run' | 'list';
2308
2320
 
2309
2321
  export declare interface RstestConfig {
2322
+ /**
2323
+ * Extend configuration from adapters
2324
+ */
2325
+ extends?: ExtendConfigFn | ExtendConfig;
2310
2326
  /**
2311
2327
  * Project root
2312
2328
  *
@@ -2390,7 +2406,7 @@ export declare interface RstestConfig {
2390
2406
  *
2391
2407
  * @default 'node'
2392
2408
  */
2393
- testEnvironment?: 'node' | 'jsdom' | 'happy-dom';
2409
+ testEnvironment?: EnvironmentName | EnvironmentWithOptions;
2394
2410
  /**
2395
2411
  * Stop running tests after n failures.
2396
2412
  * Set to 0 to run all tests regardless of failures.
package/dist/worker.d.ts CHANGED
@@ -671,6 +671,13 @@ declare type EntryInfo = {
671
671
  files?: string[];
672
672
  };
673
673
 
674
+ declare type EnvironmentName = 'node' | 'jsdom' | 'happy-dom';
675
+
676
+ declare type EnvironmentWithOptions = {
677
+ name: EnvironmentName;
678
+ options?: Record<string, any>;
679
+ };
680
+
674
681
  declare type ExpectationResult = SyncExpectationResult | AsyncExpectationResult;
675
682
 
676
683
  declare interface ExpectPollOptions {
@@ -708,6 +715,10 @@ declare interface ExpectStatic_2 extends Chai.ExpectStatic, Matchers, Asymmetric
708
715
  not: AsymmetricMatchersContaining;
709
716
  }
710
717
 
718
+ declare type ExtendConfig = Omit<RstestConfig, 'projects'>;
719
+
720
+ declare type ExtendConfigFn = (userConfig: Readonly<RstestConfig>) => MaybePromise<ExtendConfig>;
721
+
711
722
  declare class FileCoverage implements FileCoverageData {
712
723
  constructor(data: string | FileCoverage | FileCoverageData);
713
724
  merge(other: FileCoverageData): void;
@@ -1671,8 +1682,9 @@ declare interface Node_2 {
1671
1682
  visit(visitor: Visitor, state: any): void;
1672
1683
  }
1673
1684
 
1674
- declare type NormalizedConfig = Required<Omit<RstestConfig, OptionalKeys | 'pool' | 'projects' | 'coverage' | 'setupFiles' | 'globalSetup' | 'exclude'>> & Partial<Pick<RstestConfig, OptionalKeys>> & {
1685
+ declare type NormalizedConfig = Required<Omit<RstestConfig, OptionalKeys | 'pool' | 'projects' | 'coverage' | 'setupFiles' | 'globalSetup' | 'exclude' | 'testEnvironment'>> & Partial<Pick<RstestConfig, OptionalKeys>> & {
1675
1686
  pool: RstestPoolOptions;
1687
+ testEnvironment: EnvironmentWithOptions;
1676
1688
  coverage: NormalizedCoverageOptions;
1677
1689
  setupFiles: string[];
1678
1690
  globalSetup: string[];
@@ -1712,7 +1724,7 @@ declare type OnTestFailedHandler = (ctx: TestContext) => MaybePromise<void>;
1712
1724
 
1713
1725
  declare type OnTestFinishedHandler = (ctx: TestContext) => MaybePromise<void>;
1714
1726
 
1715
- declare type OptionalKeys = 'testNamePattern' | 'plugins' | 'source' | 'resolve' | 'output' | 'performance' | 'tools' | 'dev' | 'onConsoleLog' | 'chaiConfig' | 'resolveSnapshotPath';
1727
+ declare type OptionalKeys = 'testNamePattern' | 'plugins' | 'source' | 'resolve' | 'output' | 'performance' | 'tools' | 'dev' | 'onConsoleLog' | 'chaiConfig' | 'resolveSnapshotPath' | 'extends';
1716
1728
 
1717
1729
  declare interface Options {
1718
1730
  logger: {
@@ -1920,6 +1932,10 @@ declare type RoObject<T> = {
1920
1932
  declare type RstestCommand = 'watch' | 'run' | 'list';
1921
1933
 
1922
1934
  declare interface RstestConfig {
1935
+ /**
1936
+ * Extend configuration from adapters
1937
+ */
1938
+ extends?: ExtendConfigFn | ExtendConfig;
1923
1939
  /**
1924
1940
  * Project root
1925
1941
  *
@@ -2003,7 +2019,7 @@ declare interface RstestConfig {
2003
2019
  *
2004
2020
  * @default 'node'
2005
2021
  */
2006
- testEnvironment?: 'node' | 'jsdom' | 'happy-dom';
2022
+ testEnvironment?: EnvironmentName | EnvironmentWithOptions;
2007
2023
  /**
2008
2024
  * Stop running tests after n failures.
2009
2025
  * Set to 0 to run all tests regardless of failures.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rstest/core",
3
- "version": "0.7.6",
3
+ "version": "0.7.8",
4
4
  "description": "The Rsbuild-based test tool.",
5
5
  "bugs": {
6
6
  "url": "https://github.com/web-infra-dev/rstest/issues"
@@ -47,7 +47,7 @@
47
47
  ],
48
48
  "dependencies": {
49
49
  "@types/chai": "^5.2.3",
50
- "@rsbuild/core": "1.7.0-beta.1",
50
+ "@rsbuild/core": "1.7.1",
51
51
  "tinypool": "^1.1.1"
52
52
  },
53
53
  "devDependencies": {
@@ -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.19.0",
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",