@rstest/core 0.0.3 → 0.0.4

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/LICENSE CHANGED
@@ -139,9 +139,9 @@ Licensed under MIT license in the repository at https://github.com/jestjs/jest.g
139
139
 
140
140
  ### @jridgewell/trace-mapping
141
141
 
142
- Licensed under MIT license in the repository at git+https://github.com/jridgewell/trace-mapping.git.
142
+ Licensed under MIT license in the repository at git+https://github.com/jridgewell/sourcemaps.git.
143
143
 
144
- > Copyright 2022 Justin Ridgewell <justin@ridgewell.name>
144
+ > Copyright 2024 Justin Ridgewell <justin@ridgewell.name>
145
145
  >
146
146
  > Permission is hereby granted, free of charge, to any person obtaining a copy
147
147
  > of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -6,6 +6,14 @@
6
6
 
7
7
  Rstest is a testing framework powered by Rspack.
8
8
 
9
- ## 📖 License
9
+ ## Documentation
10
+
11
+ See [Documentation](https://rstest.rs).
12
+
13
+ ## Contributing
14
+
15
+ Please read the [Contributing Guide](https://github.com/web-infra-dev/rstest/blob/main/CONTRIBUTING.md).
16
+
17
+ ## License
10
18
 
11
19
  Rstest is licensed under the [MIT License](https://github.com/web-infra-dev/rstest/blob/main/LICENSE).
package/dist/285.js CHANGED
@@ -26,6 +26,7 @@ export const __webpack_modules__ = {
26
26
  const getRsbuildStats = await (0, _rsbuild__WEBPACK_IMPORTED_MODULE_4__.r)({
27
27
  name,
28
28
  globTestSourceEntries,
29
+ normalizedConfig: context.normalizedConfig,
29
30
  setupFiles,
30
31
  rsbuildInstance,
31
32
  rootPath
@@ -54,7 +55,7 @@ export const __webpack_modules__ = {
54
55
  const hasError = list.some((file)=>file.errors?.length);
55
56
  if (hasError) {
56
57
  const { printError } = await Promise.all([
57
- __webpack_require__.e("973"),
58
+ __webpack_require__.e("502"),
58
59
  __webpack_require__.e("355")
59
60
  ]).then(__webpack_require__.bind(__webpack_require__, "./src/utils/error.ts"));
60
61
  process.exitCode = 1;
package/dist/353.js CHANGED
@@ -323,7 +323,7 @@ export const __webpack_modules__ = {
323
323
  utils.kg.log(`${utils.$_.bgRed(' FAIL ')} ${(0, utils.aj)(relativePath)} ${nameStr.length ? `${utils.$_.dim(utils.Qd)} ${nameStr}` : ''}`);
324
324
  if (test.errors) {
325
325
  const { printError } = await Promise.all([
326
- __webpack_require__.e("973"),
326
+ __webpack_require__.e("502"),
327
327
  __webpack_require__.e("355")
328
328
  ]).then(__webpack_require__.bind(__webpack_require__, "./src/utils/error.ts"));
329
329
  for (const error of test.errors)await printError(error, getSourcemap, rootPath);
@@ -374,7 +374,8 @@ export const __webpack_modules__ = {
374
374
  const icon = isSlowCase && 'pass' === result.status ? utils.$_.yellow(statusStr[result.status]) : statusColorfulStr[result.status];
375
375
  const nameStr = (0, utils.Yz)(result);
376
376
  const duration = void 0 !== result.duration ? ` (${(0, utils.AS)(result.duration, false)})` : '';
377
- console.log(` ${icon} ${nameStr}${utils.$_.gray(duration)}`);
377
+ const retry = result.retryCount ? utils.$_.yellow(` (retry x${result.retryCount})`) : '';
378
+ console.log(` ${icon} ${nameStr}${utils.$_.gray(duration)}${retry}`);
378
379
  if (result.errors) for (const error of result.errors)console.error(utils.$_.red(` ${error.message}`));
379
380
  }
380
381
  }
@@ -451,7 +452,7 @@ export const __webpack_modules__ = {
451
452
  });
452
453
  return {
453
454
  command,
454
- version: "0.0.3",
455
+ version: "0.0.4",
455
456
  rootPath,
456
457
  reporters,
457
458
  snapshotManager,
package/dist/355.js CHANGED
@@ -7,7 +7,7 @@ export const __webpack_modules__ = {
7
7
  printError: ()=>printError
8
8
  });
9
9
  var node_fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("node:fs");
10
- var _jridgewell_trace_mapping__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/@jridgewell+trace-mapping@0.3.25/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs");
10
+ var _jridgewell_trace_mapping__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("../../node_modules/.pnpm/@jridgewell+trace-mapping@0.3.27/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs");
11
11
  var stacktrace_parser__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("../../node_modules/.pnpm/stacktrace-parser@0.1.11/node_modules/stacktrace-parser/dist/stack-trace-parser.esm.js");
12
12
  var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("./src/utils/index.ts");
13
13
  async function printError(error, getSourcemap, rootPath) {
@@ -1,8 +1,8 @@
1
1
  export const __webpack_ids__ = [
2
- "973"
2
+ "502"
3
3
  ];
4
4
  export const __webpack_modules__ = {
5
- "../../node_modules/.pnpm/@jridgewell+trace-mapping@0.3.25/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs": function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
5
+ "../../node_modules/.pnpm/@jridgewell+trace-mapping@0.3.27/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs": function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
6
6
  __webpack_require__.d(__webpack_exports__, {
7
7
  s7: ()=>TraceMap,
8
8
  Sk: ()=>originalPositionFor
@@ -212,7 +212,7 @@ export const __webpack_modules__ = {
212
212
  if (!path || addTrailingSlash && !path.endsWith('/..')) path += '/';
213
213
  url.path = path;
214
214
  }
215
- function resolve(input, base) {
215
+ function resolve_uri_resolve(input, base) {
216
216
  if (!input && !base) return '';
217
217
  const url = parseUrl(input);
218
218
  let inputType = url.type;
@@ -255,20 +255,21 @@ export const __webpack_modules__ = {
255
255
  return url.scheme + '//' + url.user + url.host + url.port + url.path + queryHash;
256
256
  }
257
257
  }
258
- function trace_mapping_resolve(input, base) {
259
- if (base && !base.endsWith('/')) base += '/';
260
- return resolve(input, base);
261
- }
262
258
  function stripFilename(path) {
263
- if (!path) return '';
264
- const index = path.lastIndexOf('/');
259
+ if (!path) return "";
260
+ const index = path.lastIndexOf("/");
265
261
  return path.slice(0, index + 1);
266
262
  }
267
- const COLUMN = 0;
268
- const SOURCES_INDEX = 1;
269
- const SOURCE_LINE = 2;
270
- const SOURCE_COLUMN = 3;
271
- const NAMES_INDEX = 4;
263
+ function resolver(mapUrl, sourceRoot) {
264
+ const from = stripFilename(mapUrl);
265
+ const prefix = sourceRoot ? sourceRoot + "/" : "";
266
+ return (source)=>resolve_uri_resolve(prefix + (source || ""), from);
267
+ }
268
+ var COLUMN = 0;
269
+ var SOURCES_INDEX = 1;
270
+ var SOURCE_LINE = 2;
271
+ var SOURCE_COLUMN = 3;
272
+ var NAMES_INDEX = 4;
272
273
  function maybeSort(mappings, owned) {
273
274
  const unsortedIndex = nextUnsortedSegmentLine(mappings, 0);
274
275
  if (unsortedIndex === mappings.length) return mappings;
@@ -291,7 +292,7 @@ export const __webpack_modules__ = {
291
292
  function trace_mapping_sortComparator(a, b) {
292
293
  return a[COLUMN] - b[COLUMN];
293
294
  }
294
- let found = false;
295
+ var found = false;
295
296
  function binarySearch(haystack, needle, low, high) {
296
297
  while(low <= high){
297
298
  const mid = low + (high - low >> 1);
@@ -337,15 +338,18 @@ export const __webpack_modules__ = {
337
338
  state.lastNeedle = needle;
338
339
  return state.lastIndex = binarySearch(haystack, needle, low, high);
339
340
  }
340
- const LINE_GTR_ZERO = '`line` must be greater than 0 (lines start at line 1)';
341
- const COL_GTR_EQ_ZERO = '`column` must be greater than or equal to 0 (columns start at column 0)';
342
- const LEAST_UPPER_BOUND = -1;
343
- const GREATEST_LOWER_BOUND = 1;
344
- class TraceMap {
341
+ function parse(map) {
342
+ return "string" == typeof map ? JSON.parse(map) : map;
343
+ }
344
+ var LINE_GTR_ZERO = "`line` must be greater than 0 (lines start at line 1)";
345
+ var COL_GTR_EQ_ZERO = "`column` must be greater than or equal to 0 (columns start at column 0)";
346
+ var LEAST_UPPER_BOUND = -1;
347
+ var GREATEST_LOWER_BOUND = 1;
348
+ var TraceMap = class {
345
349
  constructor(map, mapUrl){
346
- const isString = 'string' == typeof map;
350
+ const isString = "string" == typeof map;
347
351
  if (!isString && map._decodedMemo) return map;
348
- const parsed = isString ? JSON.parse(map) : map;
352
+ const parsed = parse(map);
349
353
  const { version, file, names, sourceRoot, sources, sourcesContent } = parsed;
350
354
  this.version = version;
351
355
  this.file = file;
@@ -354,21 +358,22 @@ export const __webpack_modules__ = {
354
358
  this.sources = sources;
355
359
  this.sourcesContent = sourcesContent;
356
360
  this.ignoreList = parsed.ignoreList || parsed.x_google_ignoreList || void 0;
357
- const from = trace_mapping_resolve(sourceRoot || '', stripFilename(mapUrl));
358
- this.resolvedSources = sources.map((s)=>trace_mapping_resolve(s || '', from));
361
+ const resolve = resolver(mapUrl, sourceRoot);
362
+ this.resolvedSources = sources.map(resolve);
359
363
  const { mappings } = parsed;
360
- if ('string' == typeof mappings) {
364
+ if ("string" == typeof mappings) {
361
365
  this._encoded = mappings;
362
366
  this._decoded = void 0;
363
- } else {
367
+ } else if (Array.isArray(mappings)) {
364
368
  this._encoded = void 0;
365
369
  this._decoded = maybeSort(mappings, isString);
366
- }
370
+ } else if (parsed.sections) throw new Error("TraceMap passed sectioned source map, please use FlattenMap export instead");
371
+ else throw new Error(`invalid source map: ${JSON.stringify(parsed)}`);
367
372
  this._decodedMemo = memoizedState();
368
373
  this._bySources = void 0;
369
374
  this._bySourceMemos = void 0;
370
375
  }
371
- }
376
+ };
372
377
  function cast(map) {
373
378
  return map;
374
379
  }
package/dist/629.js CHANGED
@@ -33,6 +33,7 @@ export const __webpack_modules__ = {
33
33
  const rsbuildInstance = await (0, _rsbuild__WEBPACK_IMPORTED_MODULE_2__.z)(context, globTestSourceEntries, setupFiles);
34
34
  const getRsbuildStats = await (0, _rsbuild__WEBPACK_IMPORTED_MODULE_2__.r)({
35
35
  name,
36
+ normalizedConfig: context.normalizedConfig,
36
37
  globTestSourceEntries,
37
38
  setupFiles,
38
39
  rsbuildInstance,
package/dist/813.js CHANGED
@@ -129,11 +129,11 @@ export const __webpack_modules__ = {
129
129
  $_: ()=>helper.$_,
130
130
  Yz: ()=>helper.Yz
131
131
  });
132
+ var constants = __webpack_require__("./src/utils/constants.ts");
132
133
  var helper = __webpack_require__("./src/utils/helper.ts");
133
134
  __webpack_require__("./src/utils/logger.ts");
134
135
  __webpack_require__("node:fs");
135
136
  __webpack_require__("node:fs/promises");
136
137
  __webpack_require__("pathe");
137
- var constants = __webpack_require__("./src/utils/constants.ts");
138
138
  }
139
139
  };
package/dist/867.js CHANGED
@@ -277,6 +277,8 @@ export const __webpack_modules__ = {
277
277
  const isNot = utils.flag(this, 'negate');
278
278
  if (isNot) throw new Error('toThrowErrorMatchingInlineSnapshot cannot be used with "not"');
279
279
  const test = getTest('toThrowErrorMatchingInlineSnapshot', this);
280
+ const isInsideEach = test.each || test.inTestEach;
281
+ if (isInsideEach) throw new Error('InlineSnapshot cannot be used inside of test.each or describe.each');
280
282
  const expected = utils.flag(this, 'object');
281
283
  const error = utils.flag(this, 'error');
282
284
  const promise = utils.flag(this, 'promise');
@@ -675,7 +677,7 @@ export const __webpack_modules__ = {
675
677
  }
676
678
  ]
677
679
  };
678
- } catch (error) {
680
+ } catch (_err) {
679
681
  result = {
680
682
  status: 'pass',
681
683
  parentNames: test.parentNames,
@@ -811,6 +813,7 @@ export const __webpack_modules__ = {
811
813
  retryCount++;
812
814
  }while (retryCount <= retry && 'fail' === result.status);
813
815
  result.duration = RealDate.now() - start;
816
+ result.retryCount = retryCount - 1;
814
817
  hooks.onTestCaseResult?.(result);
815
818
  results.push(result);
816
819
  }
@@ -1725,11 +1728,11 @@ export const __webpack_modules__ = {
1725
1728
  $_: ()=>helper.$_,
1726
1729
  Yz: ()=>helper.Yz
1727
1730
  });
1731
+ var constants = __webpack_require__("./src/utils/constants.ts");
1728
1732
  var helper = __webpack_require__("./src/utils/helper.ts");
1729
1733
  __webpack_require__("./src/utils/logger.ts");
1730
1734
  __webpack_require__("node:fs");
1731
1735
  __webpack_require__("node:fs/promises");
1732
1736
  __webpack_require__("pathe");
1733
- var constants = __webpack_require__("./src/utils/constants.ts");
1734
1737
  }
1735
1738
  };
package/dist/992.js CHANGED
@@ -75,7 +75,7 @@ export const __webpack_modules__ = {
75
75
  };
76
76
  const isMultiCompiler = (compiler)=>'compilers' in compiler && Array.isArray(compiler.compilers);
77
77
  const autoExternalNodeModules = ({ context, request, dependencyType, getResolve }, callback)=>{
78
- if (!request || request.startsWith('node:')) return callback();
78
+ if (!request) return callback();
79
79
  if (request.startsWith('@swc/helpers/')) return callback();
80
80
  const doExternal = (externalPath = request)=>{
81
81
  callback(void 0, externalPath, 'commonjs' === dependencyType ? 'commonjs' : 'module-import');
@@ -88,11 +88,20 @@ export const __webpack_modules__ = {
88
88
  return callback();
89
89
  });
90
90
  };
91
+ const autoExternalNodeBuiltin = ({ request, dependencyType }, callback)=>{
92
+ if (!request) return callback();
93
+ const isNodeBuiltin = utils.Tn.some((builtin)=>{
94
+ if ('string' == typeof builtin) return builtin === request;
95
+ return builtin.test(request);
96
+ });
97
+ if (isNodeBuiltin) callback(void 0, request, 'commonjs' === dependencyType ? 'commonjs' : 'module-import');
98
+ else callback();
99
+ };
91
100
  const prepareRsbuild = async (context, globTestSourceEntries, setupFiles)=>{
92
- const { command, normalizedConfig: { name, plugins, resolve, source, output, tools, testEnvironment } } = context;
101
+ const { command, normalizedConfig: { name, plugins, resolve, source, output, tools, testEnvironment, performance, dev = {} } } = context;
93
102
  const debugMode = (0, utils.L1)();
94
103
  core_.logger.level = debugMode ? 'verbose' : 'error';
95
- const writeToDisk = debugMode;
104
+ const writeToDisk = dev.writeToDisk || debugMode;
96
105
  const rsbuildInstance = await (0, core_.createRsbuild)({
97
106
  rsbuildConfig: {
98
107
  tools,
@@ -105,6 +114,7 @@ export const __webpack_modules__ = {
105
114
  strictPort: false,
106
115
  middlewareMode: true
107
116
  },
117
+ performance,
108
118
  environments: {
109
119
  [name]: {
110
120
  dev: {
@@ -123,21 +133,13 @@ export const __webpack_modules__ = {
123
133
  distPath: {
124
134
  root: utils.Nk
125
135
  },
126
- externals: [
127
- {
128
- '@rstest/core': 'global @rstest/core'
129
- },
130
- 'node' === testEnvironment ? autoExternalNodeModules : {}
131
- ],
132
136
  target: 'node'
133
137
  },
134
138
  tools: {
135
139
  rspack: (config)=>{
136
140
  config.output ??= {};
137
141
  config.output.iife = false;
138
- config.externalsPresets = {
139
- node: true
140
- };
142
+ config.output.importFunctionName = '__rstest_dynamic_import__';
141
143
  config.output.devtoolModuleFilenameTemplate = '[absolute-resource-path]';
142
144
  config.plugins.push(new core_.rspack.experiments.RstestPlugin({
143
145
  injectModulePathName: true,
@@ -145,6 +147,14 @@ export const __webpack_modules__ = {
145
147
  importMetaPathName: true,
146
148
  manualMockRoot: context.rootPath
147
149
  }));
150
+ config.externals = (0, utils.XQ)(config.externals) || [];
151
+ config.externals.unshift({
152
+ '@rstest/core': 'global @rstest/core'
153
+ });
154
+ if ('node' === testEnvironment) config.externals.push(autoExternalNodeModules);
155
+ config.externalsPresets ??= {};
156
+ config.externalsPresets.node = false;
157
+ config.externals.push(autoExternalNodeBuiltin);
148
158
  config.module.parser ??= {};
149
159
  config.module.parser.javascript = {
150
160
  importDynamic: false,
@@ -159,16 +169,11 @@ export const __webpack_modules__ = {
159
169
  ];
160
170
  }
161
171
  config.optimization = {
162
- ...config.optimization || {},
163
172
  moduleIds: 'named',
164
173
  chunkIds: 'named',
174
+ ...config.optimization || {},
165
175
  runtimeChunk: {
166
176
  name: 'runtime'
167
- },
168
- splitChunks: {
169
- chunks: 'all',
170
- minSize: 0,
171
- maxInitialRequests: Number.POSITIVE_INFINITY
172
177
  }
173
178
  };
174
179
  }
@@ -187,7 +192,7 @@ export const __webpack_modules__ = {
187
192
  });
188
193
  return rsbuildInstance;
189
194
  };
190
- const createRsbuildServer = async ({ name, globTestSourceEntries, setupFiles, rsbuildInstance })=>{
195
+ const createRsbuildServer = async ({ name, globTestSourceEntries, setupFiles, rsbuildInstance, normalizedConfig })=>{
191
196
  let rspackCompiler;
192
197
  const rstestCompilerPlugin = {
193
198
  name: 'rstest:compiler',
@@ -204,7 +209,10 @@ export const __webpack_modules__ = {
204
209
  getPortSilently: true
205
210
  });
206
211
  if ((0, utils.L1)()) await rsbuildInstance.inspectConfig({
207
- writeToDisk: true
212
+ writeToDisk: true,
213
+ extraConfigs: {
214
+ retest: normalizedConfig
215
+ }
208
216
  });
209
217
  const outputFileSystem = (isMultiCompiler(rspackCompiler) ? rspackCompiler.compilers[0].outputFileSystem : rspackCompiler.outputFileSystem) || external_node_fs_["default"];
210
218
  const getRsbuildStats = async ()=>{
package/dist/cli.js CHANGED
@@ -2292,6 +2292,7 @@ var __webpack_modules__ = {
2292
2292
  $_: ()=>picocolors__WEBPACK_IMPORTED_MODULE_2___default.a,
2293
2293
  AS: ()=>prettyTime,
2294
2294
  H: ()=>parsePosix,
2295
+ Tn: ()=>NODE_BUILTINS,
2295
2296
  XQ: ()=>castArray,
2296
2297
  Yz: ()=>getTaskNameWithPrefix,
2297
2298
  Z: ()=>formatError,
@@ -2359,6 +2360,64 @@ var __webpack_modules__ = {
2359
2360
  0,
2360
2361
  0
2361
2362
  ];
2363
+ const NODE_BUILTINS = [
2364
+ 'assert',
2365
+ 'assert/strict',
2366
+ 'async_hooks',
2367
+ 'buffer',
2368
+ 'child_process',
2369
+ 'cluster',
2370
+ 'console',
2371
+ 'constants',
2372
+ 'crypto',
2373
+ 'dgram',
2374
+ 'diagnostics_channel',
2375
+ 'dns',
2376
+ 'dns/promises',
2377
+ 'domain',
2378
+ 'events',
2379
+ 'fs',
2380
+ 'fs/promises',
2381
+ 'http',
2382
+ 'http2',
2383
+ 'https',
2384
+ 'inspector',
2385
+ 'inspector/promises',
2386
+ 'module',
2387
+ 'net',
2388
+ 'os',
2389
+ 'path',
2390
+ 'path/posix',
2391
+ 'path/win32',
2392
+ 'perf_hooks',
2393
+ 'process',
2394
+ 'punycode',
2395
+ 'querystring',
2396
+ 'readline',
2397
+ 'readline/promises',
2398
+ 'repl',
2399
+ 'stream',
2400
+ 'stream/consumers',
2401
+ 'stream/promises',
2402
+ 'stream/web',
2403
+ 'string_decoder',
2404
+ 'sys',
2405
+ 'timers',
2406
+ 'timers/promises',
2407
+ 'tls',
2408
+ 'trace_events',
2409
+ 'tty',
2410
+ 'url',
2411
+ 'util',
2412
+ 'util/types',
2413
+ 'v8',
2414
+ 'vm',
2415
+ 'wasi',
2416
+ 'worker_threads',
2417
+ 'zlib',
2418
+ /^node:/,
2419
+ 'pnpapi'
2420
+ ];
2362
2421
  },
2363
2422
  "./src/utils/index.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
2364
2423
  __webpack_require__.d(__webpack_exports__, {
@@ -2371,8 +2430,9 @@ var __webpack_modules__ = {
2371
2430
  mP: ()=>helper.mP,
2372
2431
  Ps: ()=>formatTestPath,
2373
2432
  XQ: ()=>helper.XQ,
2374
- $_: ()=>helper.$_,
2375
2433
  Nk: ()=>constants.Nk,
2434
+ Tn: ()=>helper.Tn,
2435
+ $_: ()=>helper.$_,
2376
2436
  Yz: ()=>helper.Yz,
2377
2437
  L1: ()=>logger.L,
2378
2438
  v8: ()=>helper.v8,
@@ -2380,6 +2440,7 @@ var __webpack_modules__ = {
2380
2440
  f1: ()=>constants.f1,
2381
2441
  AS: ()=>helper.AS
2382
2442
  });
2443
+ var constants = __webpack_require__("./src/utils/constants.ts");
2383
2444
  var helper = __webpack_require__("./src/utils/helper.ts");
2384
2445
  var logger = __webpack_require__("./src/utils/logger.ts");
2385
2446
  var external_node_fs_ = __webpack_require__("node:fs");
@@ -2455,7 +2516,6 @@ var __webpack_modules__ = {
2455
2516
  if (external_pathe_["default"].isAbsolute(testPath) && testPath.includes(root)) testPath = external_pathe_["default"].relative(root, testPath);
2456
2517
  return prettyTestPath(testPath);
2457
2518
  };
2458
- var constants = __webpack_require__("./src/utils/constants.ts");
2459
2519
  },
2460
2520
  "./src/utils/logger.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
2461
2521
  __webpack_require__.d(__webpack_exports__, {
@@ -3587,7 +3647,7 @@ function prepareCli() {
3587
3647
  if (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) console.log();
3588
3648
  }
3589
3649
  function showRstest() {
3590
- logger.k.greet(" Rstest v0.0.3");
3650
+ logger.k.greet(" Rstest v0.0.4");
3591
3651
  logger.k.log('');
3592
3652
  }
3593
3653
  const applyCommonOptions = (cli)=>{
@@ -3631,7 +3691,7 @@ async function initCli(options) {
3631
3691
  function setupCommands() {
3632
3692
  const cli = dist('rstest');
3633
3693
  cli.help();
3634
- cli.version("0.0.3");
3694
+ cli.version("0.0.4");
3635
3695
  applyCommonOptions(cli);
3636
3696
  cli.command('[...filters]', 'run tests').action(async (filters, options)=>{
3637
3697
  showRstest();
package/dist/worker.js CHANGED
@@ -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.2/node_modules/jest-diff/build/index.js": function(module, __unused_webpack_exports, __webpack_require__) {
2890
+ "../../node_modules/.pnpm/jest-diff@30.0.3/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.
@@ -3201,6 +3201,7 @@ var __webpack_modules__ = {
3201
3201
  exports.printDiffLines = exports.diffLinesUnified2 = exports.diffLinesUnified = exports.diffLinesRaw = void 0;
3202
3202
  var _diffSequences = _interopRequireDefault(__webpack_require__("../../node_modules/.pnpm/@jest+diff-sequences@30.0.1/node_modules/@jest/diff-sequences/build/index.js"));
3203
3203
  var _cleanupSemantic = __nested_webpack_require_20541_20560__("./src/cleanupSemantic.ts");
3204
+ var _escapeControlCharacters = __nested_webpack_require_20541_20560__("./src/escapeControlCharacters.ts");
3204
3205
  var _joinAlignedDiffs = __nested_webpack_require_20541_20560__("./src/joinAlignedDiffs.ts");
3205
3206
  var _normalizeDiffOptions = __nested_webpack_require_20541_20560__("./src/normalizeDiffOptions.ts");
3206
3207
  function _interopRequireDefault(e) {
@@ -3247,7 +3248,7 @@ var __webpack_modules__ = {
3247
3248
  };
3248
3249
  const printDiffLines = (diffs, options)=>printAnnotation(options, countChanges(diffs)) + (options.expand ? (0, _joinAlignedDiffs.joinAlignedDiffsExpand)(diffs, options) : (0, _joinAlignedDiffs.joinAlignedDiffsNoExpand)(diffs, options));
3249
3250
  exports.printDiffLines = printDiffLines;
3250
- const diffLinesUnified = (aLines, bLines, options)=>printDiffLines(diffLinesRaw(isEmptyString(aLines) ? [] : aLines, isEmptyString(bLines) ? [] : bLines), (0, _normalizeDiffOptions.normalizeDiffOptions)(options));
3251
+ const diffLinesUnified = (aLines, bLines, options)=>printDiffLines(diffLinesRaw(isEmptyString(aLines) ? [] : aLines.map(_escapeControlCharacters.escapeControlCharacters), isEmptyString(bLines) ? [] : bLines.map(_escapeControlCharacters.escapeControlCharacters)), (0, _normalizeDiffOptions.normalizeDiffOptions)(options));
3251
3252
  exports.diffLinesUnified = diffLinesUnified;
3252
3253
  const diffLinesUnified2 = (aLinesDisplay, bLinesDisplay, aLinesCompare, bLinesCompare, options)=>{
3253
3254
  if (isEmptyString(aLinesDisplay) && isEmptyString(aLinesCompare)) {
@@ -3298,13 +3299,13 @@ var __webpack_modules__ = {
3298
3299
  };
3299
3300
  exports.diffLinesRaw = diffLinesRaw;
3300
3301
  },
3301
- "./src/diffStrings.ts": (__unused_webpack_module, exports, __nested_webpack_require_26333_26352__)=>{
3302
+ "./src/diffStrings.ts": (__unused_webpack_module, exports, __nested_webpack_require_26529_26548__)=>{
3302
3303
  Object.defineProperty(exports, "__esModule", {
3303
3304
  value: true
3304
3305
  });
3305
3306
  exports["default"] = void 0;
3306
3307
  var _diffSequences = _interopRequireDefault(__webpack_require__("../../node_modules/.pnpm/@jest+diff-sequences@30.0.1/node_modules/@jest/diff-sequences/build/index.js"));
3307
- var _cleanupSemantic = __nested_webpack_require_26333_26352__("./src/cleanupSemantic.ts");
3308
+ var _cleanupSemantic = __nested_webpack_require_26529_26548__("./src/cleanupSemantic.ts");
3308
3309
  function _interopRequireDefault(e) {
3309
3310
  return e && e.__esModule ? e : {
3310
3311
  default: e
@@ -3329,12 +3330,34 @@ var __webpack_modules__ = {
3329
3330
  };
3330
3331
  exports["default"] = diffStrings;
3331
3332
  },
3332
- "./src/getAlignedDiffs.ts": (__unused_webpack_module, exports, __nested_webpack_require_28166_28185__)=>{
3333
+ "./src/escapeControlCharacters.ts": (__unused_webpack_module, exports)=>{
3334
+ Object.defineProperty(exports, "__esModule", {
3335
+ value: true
3336
+ });
3337
+ exports.escapeControlCharacters = void 0;
3338
+ const escapeControlCharacters = (str)=>str.replaceAll(/[\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F-\u009F]/g, (match)=>{
3339
+ switch(match){
3340
+ case '\b':
3341
+ return '\\b';
3342
+ case '\f':
3343
+ return '\\f';
3344
+ case '\v':
3345
+ return '\\v';
3346
+ default:
3347
+ {
3348
+ const code = match.codePointAt(0);
3349
+ return `\\x${code.toString(16).padStart(2, '0')}`;
3350
+ }
3351
+ }
3352
+ });
3353
+ exports.escapeControlCharacters = escapeControlCharacters;
3354
+ },
3355
+ "./src/getAlignedDiffs.ts": (__unused_webpack_module, exports, __nested_webpack_require_29271_29290__)=>{
3333
3356
  Object.defineProperty(exports, "__esModule", {
3334
3357
  value: true
3335
3358
  });
3336
3359
  exports["default"] = void 0;
3337
- var _cleanupSemantic = __nested_webpack_require_28166_28185__("./src/cleanupSemantic.ts");
3360
+ var _cleanupSemantic = __nested_webpack_require_29271_29290__("./src/cleanupSemantic.ts");
3338
3361
  const concatenateRelevantDiffs = (op, diffs, changeColor)=>diffs.reduce((reduced, diff)=>reduced + (diff[0] === _cleanupSemantic.DIFF_EQUAL ? diff[1] : diff[0] === op && diff[1].length > 0 ? changeColor(diff[1]) : ''), '');
3339
3362
  class ChangeBuffer {
3340
3363
  op;
@@ -3440,12 +3463,12 @@ var __webpack_modules__ = {
3440
3463
  };
3441
3464
  exports["default"] = getAlignedDiffs;
3442
3465
  },
3443
- "./src/joinAlignedDiffs.ts": (__unused_webpack_module, exports, __nested_webpack_require_35036_35055__)=>{
3466
+ "./src/joinAlignedDiffs.ts": (__unused_webpack_module, exports, __nested_webpack_require_36141_36160__)=>{
3444
3467
  Object.defineProperty(exports, "__esModule", {
3445
3468
  value: true
3446
3469
  });
3447
3470
  exports.joinAlignedDiffsNoExpand = exports.joinAlignedDiffsExpand = void 0;
3448
- var _cleanupSemantic = __nested_webpack_require_35036_35055__("./src/cleanupSemantic.ts");
3471
+ var _cleanupSemantic = __nested_webpack_require_36141_36160__("./src/cleanupSemantic.ts");
3449
3472
  const formatTrailingSpaces = (line, trailingSpaceFormatter)=>line.replace(/\s+$/, (match)=>trailingSpaceFormatter(match));
3450
3473
  const printDiffLine = (line, isFirstOrLast, color, indicator, trailingSpaceFormatter, emptyFirstOrLastLinePlaceholder)=>0 === line.length ? ' ' === indicator ? isFirstOrLast && emptyFirstOrLastLinePlaceholder.length > 0 ? color(`${indicator} ${emptyFirstOrLastLinePlaceholder}`) : '' : color(indicator) : color(`${indicator} ${formatTrailingSpaces(line, trailingSpaceFormatter)}`);
3451
3474
  const printDeleteLine = (line, isFirstOrLast, { aColor, aIndicator, changeLineTrailingSpaceColor, emptyFirstOrLastLinePlaceholder })=>printDiffLine(line, isFirstOrLast, aColor, aIndicator, changeLineTrailingSpaceColor, emptyFirstOrLastLinePlaceholder);
@@ -3613,16 +3636,16 @@ var __webpack_modules__ = {
3613
3636
  });
3614
3637
  exports.normalizeDiffOptions = normalizeDiffOptions;
3615
3638
  },
3616
- "./src/printDiffs.ts": (__unused_webpack_module, exports, __nested_webpack_require_44431_44450__)=>{
3639
+ "./src/printDiffs.ts": (__unused_webpack_module, exports, __nested_webpack_require_45536_45555__)=>{
3617
3640
  Object.defineProperty(exports, "__esModule", {
3618
3641
  value: true
3619
3642
  });
3620
3643
  exports.diffStringsUnified = exports.diffStringsRaw = void 0;
3621
- var _cleanupSemantic = __nested_webpack_require_44431_44450__("./src/cleanupSemantic.ts");
3622
- var _diffLines = __nested_webpack_require_44431_44450__("./src/diffLines.ts");
3623
- var _diffStrings = _interopRequireDefault(__nested_webpack_require_44431_44450__("./src/diffStrings.ts"));
3624
- var _getAlignedDiffs = _interopRequireDefault(__nested_webpack_require_44431_44450__("./src/getAlignedDiffs.ts"));
3625
- var _normalizeDiffOptions = __nested_webpack_require_44431_44450__("./src/normalizeDiffOptions.ts");
3644
+ var _cleanupSemantic = __nested_webpack_require_45536_45555__("./src/cleanupSemantic.ts");
3645
+ var _diffLines = __nested_webpack_require_45536_45555__("./src/diffLines.ts");
3646
+ var _diffStrings = _interopRequireDefault(__nested_webpack_require_45536_45555__("./src/diffStrings.ts"));
3647
+ var _getAlignedDiffs = _interopRequireDefault(__nested_webpack_require_45536_45555__("./src/getAlignedDiffs.ts"));
3648
+ var _normalizeDiffOptions = __nested_webpack_require_45536_45555__("./src/normalizeDiffOptions.ts");
3626
3649
  function _interopRequireDefault(e) {
3627
3650
  return e && e.__esModule ? e : {
3628
3651
  default: e
@@ -3657,13 +3680,13 @@ var __webpack_modules__ = {
3657
3680
  }
3658
3681
  };
3659
3682
  var __webpack_module_cache__ = {};
3660
- function __nested_webpack_require_47190__(moduleId) {
3683
+ function __nested_webpack_require_48295__(moduleId) {
3661
3684
  var cachedModule = __webpack_module_cache__[moduleId];
3662
3685
  if (void 0 !== cachedModule) return cachedModule.exports;
3663
3686
  var module = __webpack_module_cache__[moduleId] = {
3664
3687
  exports: {}
3665
3688
  };
3666
- __webpack_modules__[moduleId](module, module.exports, __nested_webpack_require_47190__);
3689
+ __webpack_modules__[moduleId](module, module.exports, __nested_webpack_require_48295__);
3667
3690
  return module.exports;
3668
3691
  }
3669
3692
  var __nested_webpack_exports__ = {};
@@ -3730,11 +3753,12 @@ var __webpack_modules__ = {
3730
3753
  var _chalk = _interopRequireDefault(__webpack_require__("../../node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/index.js"));
3731
3754
  var _getType = __webpack_require__("../../node_modules/.pnpm/@jest+get-type@30.0.1/node_modules/@jest/get-type/build/index.js");
3732
3755
  var _prettyFormat = __webpack_require__("../../node_modules/.pnpm/pretty-format@30.0.2/node_modules/pretty-format/build/index.js");
3733
- var _cleanupSemantic = __nested_webpack_require_47190__("./src/cleanupSemantic.ts");
3734
- var _constants = __nested_webpack_require_47190__("./src/constants.ts");
3735
- var _diffLines = __nested_webpack_require_47190__("./src/diffLines.ts");
3736
- var _normalizeDiffOptions = __nested_webpack_require_47190__("./src/normalizeDiffOptions.ts");
3737
- var _printDiffs = __nested_webpack_require_47190__("./src/printDiffs.ts");
3756
+ var _cleanupSemantic = __nested_webpack_require_48295__("./src/cleanupSemantic.ts");
3757
+ var _constants = __nested_webpack_require_48295__("./src/constants.ts");
3758
+ var _diffLines = __nested_webpack_require_48295__("./src/diffLines.ts");
3759
+ var _escapeControlCharacters = __nested_webpack_require_48295__("./src/escapeControlCharacters.ts");
3760
+ var _normalizeDiffOptions = __nested_webpack_require_48295__("./src/normalizeDiffOptions.ts");
3761
+ var _printDiffs = __nested_webpack_require_48295__("./src/printDiffs.ts");
3738
3762
  function _interopRequireDefault(e) {
3739
3763
  return e && e.__esModule ? e : {
3740
3764
  default: e
@@ -3777,7 +3801,7 @@ var __webpack_modules__ = {
3777
3801
  if (omitDifference) return null;
3778
3802
  switch(aType){
3779
3803
  case 'string':
3780
- return (0, _diffLines.diffLinesUnified)(a.split('\n'), b.split('\n'), options);
3804
+ return (0, _diffLines.diffLinesUnified)((0, _escapeControlCharacters.escapeControlCharacters)(a).split('\n'), (0, _escapeControlCharacters.escapeControlCharacters)(b).split('\n'), options);
3781
3805
  case 'boolean':
3782
3806
  case 'number':
3783
3807
  return comparePrimitive(a, b, options);
@@ -4954,7 +4978,7 @@ var __webpack_modules__ = {
4954
4978
  o: ()=>formatTestError
4955
4979
  });
4956
4980
  var external_node_util_ = __webpack_require__("node:util");
4957
- var build = __webpack_require__("../../node_modules/.pnpm/jest-diff@30.0.2/node_modules/jest-diff/build/index.js");
4981
+ var build = __webpack_require__("../../node_modules/.pnpm/jest-diff@30.0.3/node_modules/jest-diff/build/index.js");
4958
4982
  build.DIFF_DELETE;
4959
4983
  build.DIFF_EQUAL;
4960
4984
  build.DIFF_INSERT;
@@ -5622,6 +5646,39 @@ const loadModule_createRequire = (filename, distPath, rstestContext, assetFiles,
5622
5646
  require1.main = _require.main;
5623
5647
  return require1;
5624
5648
  };
5649
+ const defineRstestDynamicImport = ({ testPath, interopDefault, returnModule = false })=>async (specifier, importAttributes)=>{
5650
+ const resolvedPath = isAbsolute(specifier) ? pathToFileURL(specifier) : await import.meta.resolve(specifier, pathToFileURL(testPath));
5651
+ const modulePath = 'string' == typeof resolvedPath ? resolvedPath : resolvedPath.pathname;
5652
+ const importedModule = await import(modulePath, importAttributes);
5653
+ if (shouldInterop({
5654
+ interopDefault,
5655
+ modulePath,
5656
+ mod: importedModule
5657
+ })) {
5658
+ const { mod, defaultExport } = interopModule(importedModule);
5659
+ if (returnModule) return asModule(mod, defaultExport);
5660
+ return new Proxy(mod, {
5661
+ get (mod, prop) {
5662
+ if ('default' === prop) return defaultExport;
5663
+ return mod[prop] ?? defaultExport?.[prop];
5664
+ },
5665
+ has (mod, prop) {
5666
+ if ('default' === prop) return void 0 !== defaultExport;
5667
+ return prop in mod || defaultExport && prop in defaultExport;
5668
+ },
5669
+ getOwnPropertyDescriptor (mod, prop) {
5670
+ const descriptor = Reflect.getOwnPropertyDescriptor(mod, prop);
5671
+ if (descriptor) return descriptor;
5672
+ if ('default' === prop && void 0 !== defaultExport) return {
5673
+ value: defaultExport,
5674
+ enumerable: true,
5675
+ configurable: true
5676
+ };
5677
+ }
5678
+ });
5679
+ }
5680
+ return importedModule;
5681
+ };
5625
5682
  const loadModule = ({ codeContent, distPath, testPath, rstestContext, assetFiles, interopDefault })=>{
5626
5683
  const fileDir = external_pathe_["default"].dirname(testPath);
5627
5684
  const localModule = {
@@ -5637,6 +5694,10 @@ const loadModule = ({ codeContent, distPath, testPath, rstestContext, assetFiles
5637
5694
  module: localModule,
5638
5695
  exports: localModule.exports,
5639
5696
  require: loadModule_createRequire(testPath, distPath, rstestContext, assetFiles, interopDefault),
5697
+ __rstest_dynamic_import__: defineRstestDynamicImport({
5698
+ testPath,
5699
+ interopDefault
5700
+ }),
5640
5701
  __dirname: fileDir,
5641
5702
  __filename: testPath,
5642
5703
  ...rstestContext
@@ -5647,20 +5708,11 @@ const loadModule = ({ codeContent, distPath, testPath, rstestContext, assetFiles
5647
5708
  filename: distPath,
5648
5709
  lineOffset: 0,
5649
5710
  columnOffset: -codeDefinition.length,
5650
- importModuleDynamically: async (specifier, _referencer, importAttributes)=>{
5651
- const resolvedPath = isAbsolute(specifier) ? pathToFileURL(specifier) : await import.meta.resolve(specifier, pathToFileURL(testPath));
5652
- const modulePath = 'string' == typeof resolvedPath ? resolvedPath : resolvedPath.pathname;
5653
- const importedModule = await import(modulePath, importAttributes);
5654
- if (shouldInterop({
5711
+ importModuleDynamically: (specifier, _referencer, importAttributes)=>defineRstestDynamicImport({
5712
+ testPath,
5655
5713
  interopDefault,
5656
- modulePath,
5657
- mod: importedModule
5658
- })) {
5659
- const { mod, defaultExport } = interopModule(importedModule);
5660
- return asModule(mod, defaultExport);
5661
- }
5662
- return importedModule;
5663
- }
5714
+ returnModule: true
5715
+ })(specifier, importAttributes)
5664
5716
  });
5665
5717
  fn(...Object.values(context));
5666
5718
  return localModule.exports;
@@ -5842,7 +5894,11 @@ const runInPool = async (options)=>{
5842
5894
  } finally{
5843
5895
  await Promise.all(cleanups.map((fn)=>fn()));
5844
5896
  }
5897
+ const exit = process.exit;
5845
5898
  try {
5899
+ process.exit = (code = process.exitCode || 0)=>{
5900
+ throw new Error(`process.exit unexpectedly called with "${code}"`);
5901
+ };
5846
5902
  const { rstestContext, runner, rpc, api, cleanup, unhandledErrors, interopDefault } = await preparePool(options);
5847
5903
  cleanups.push(cleanup);
5848
5904
  await loadFiles({
@@ -5879,6 +5935,7 @@ const runInPool = async (options)=>{
5879
5935
  };
5880
5936
  } finally{
5881
5937
  await Promise.all(cleanups.map((fn)=>fn()));
5938
+ process.exit = exit;
5882
5939
  }
5883
5940
  };
5884
5941
  const worker = runInPool;
@@ -79,7 +79,7 @@ declare type NormalizedConfig = Required<Omit<RstestConfig, OptionalKeys | 'pool
79
79
  pool: RstestPoolOptions;
80
80
  };
81
81
 
82
- declare type OptionalKeys = 'setupFiles' | 'testNamePattern' | 'plugins' | 'source' | 'resolve' | 'output' | 'tools' | 'onConsoleLog';
82
+ declare type OptionalKeys = 'setupFiles' | 'testNamePattern' | 'plugins' | 'source' | 'resolve' | 'output' | 'performance' | 'tools' | 'dev' | 'onConsoleLog';
83
83
 
84
84
  export declare interface Reporter {
85
85
  /**
@@ -120,6 +120,14 @@ declare const reportersMap: {
120
120
 
121
121
  declare type ReporterWithOptions<Name extends BuiltInReporterNames = BuiltInReporterNames> = Name extends keyof BuiltinReporterOptions ? [Name, Partial<BuiltinReporterOptions[Name]>] : [Name, Record<string, unknown>];
122
122
 
123
+ declare type Ro<T> = T extends Array<infer V> ? V[] | Readonly<V[]> | RoArray<V> | Readonly<RoArray<V>> : T extends object ? T | Readonly<T> | RoObject<T> | Readonly<RoObject<T>> : T;
124
+
125
+ declare type RoArray<T> = Ro<T>[];
126
+
127
+ declare type RoObject<T> = {
128
+ [K in keyof T]: T[K] | Ro<T[K]>;
129
+ };
130
+
123
131
  export declare type RstestCommand = 'watch' | 'run' | 'list';
124
132
 
125
133
  export declare interface RstestConfig {
@@ -163,7 +171,7 @@ export declare interface RstestConfig {
163
171
  */
164
172
  retry?: number;
165
173
  /**
166
- * Allows the test suite to pass when no files are found.
174
+ * Pass when no tests are found.
167
175
  *
168
176
  * @default false
169
177
  */
@@ -263,7 +271,9 @@ export declare interface RstestConfig {
263
271
  onConsoleLog?: (content: string) => boolean | void;
264
272
  plugins?: RsbuildConfig['plugins'];
265
273
  source?: Pick<NonNullable<RsbuildConfig['source']>, 'define' | 'tsconfigPath' | 'decorators' | 'include' | 'exclude'>;
266
- output?: Pick<NonNullable<RsbuildConfig['output']>, 'cssModules'>;
274
+ performance?: Pick<NonNullable<RsbuildConfig['performance']>, 'bundleAnalyze'>;
275
+ dev?: Pick<NonNullable<RsbuildConfig['dev']>, 'writeToDisk'>;
276
+ output?: Pick<NonNullable<RsbuildConfig['output']>, 'cssModules' | 'externals' | 'cleanDistPath'>;
267
277
  resolve?: RsbuildConfig['resolve'];
268
278
  tools?: Pick<NonNullable<RsbuildConfig['tools']>, 'rspack' | 'swc' | 'bundlerChain'>;
269
279
  }
@@ -312,11 +322,11 @@ declare interface SourceMapV3 {
312
322
 
313
323
  declare type SourcesIndex = number;
314
324
 
315
- declare type TestFileInfo = {
325
+ export declare type TestFileInfo = {
316
326
  testPath: TestPath;
317
327
  };
318
328
 
319
- declare type TestFileResult = TestResult & {
329
+ export declare type TestFileResult = TestResult & {
320
330
  results: TestResult[];
321
331
  snapshotResult?: SnapshotResult;
322
332
  };
@@ -324,13 +334,14 @@ declare type TestFileResult = TestResult & {
324
334
  /** The test file original path */
325
335
  declare type TestPath = string;
326
336
 
327
- declare type TestResult = {
337
+ export declare type TestResult = {
328
338
  status: TestResultStatus;
329
339
  name: string;
330
340
  testPath: TestPath;
331
341
  parentNames?: string[];
332
342
  duration?: number;
333
343
  errors?: FormattedError[];
344
+ retryCount?: number;
334
345
  };
335
346
 
336
347
  declare type TestResultStatus = 'skip' | 'pass' | 'fail' | 'todo';
@@ -349,7 +360,7 @@ declare class TraceMap implements SourceMap {
349
360
  private _decodedMemo;
350
361
  private _bySources;
351
362
  private _bySourceMemos;
352
- constructor(map: SourceMapInput, mapUrl?: string | null);
363
+ constructor(map: Ro<SourceMapInput>, mapUrl?: string | null);
353
364
  }
354
365
 
355
366
  declare interface UserConsoleLog {
@@ -364,19 +364,19 @@ declare interface MockInstance<T extends FunctionLike = FunctionLike> {
364
364
  /**
365
365
  * Returns current mock implementation if there is one.
366
366
  */
367
- getMockImplementation(): T | undefined;
367
+ getMockImplementation(): NormalizedProcedure<T> | undefined;
368
368
  /**
369
369
  * Accepts a function that should be used as the implementation of the mock.
370
370
  */
371
- mockImplementation(fn: T): this;
371
+ mockImplementation(fn: NormalizedProcedure<T>): this;
372
372
  /**
373
373
  * Accepts a function that will be used as an implementation of the mock for one call to the mocked function.
374
374
  */
375
- mockImplementationOnce(fn: T): this;
375
+ mockImplementationOnce(fn: NormalizedProcedure<T>): this;
376
376
  /**
377
377
  * Accepts a function which should be temporarily used as the implementation of the mock while the callback is being executed.
378
378
  */
379
- withImplementation<T2>(fn: T, callback: () => T2): T2 extends Promise<unknown> ? Promise<void> : void;
379
+ withImplementation<T2>(fn: NormalizedProcedure<T>, callback: () => T2): T2 extends Promise<unknown> ? Promise<void> : void;
380
380
  /**
381
381
  * Return the `this` context from the method without invoking the actual implementation.
382
382
  */
@@ -437,16 +437,6 @@ declare interface MockSettledResultFulfilled<T> {
437
437
  value: T;
438
438
  }
439
439
 
440
- declare interface MockSettledResultFulfilled<T> {
441
- type: 'fulfilled';
442
- value: T;
443
- }
444
-
445
- declare interface MockSettledResultRejected {
446
- type: 'rejected';
447
- value: any;
448
- }
449
-
450
440
  declare interface MockSettledResultRejected {
451
441
  type: 'rejected';
452
442
  value: any;
@@ -460,7 +450,11 @@ declare type NormalizedConfig = Required<Omit<RstestConfig, OptionalKeys | 'pool
460
450
  pool: RstestPoolOptions;
461
451
  };
462
452
 
463
- declare type OptionalKeys = 'setupFiles' | 'testNamePattern' | 'plugins' | 'source' | 'resolve' | 'output' | 'tools' | 'onConsoleLog';
453
+ declare type NormalizedProcedure<T extends Procedure> = (...args: Parameters<T>) => ReturnType<T>;
454
+
455
+ declare type OptionalKeys = 'setupFiles' | 'testNamePattern' | 'plugins' | 'source' | 'resolve' | 'output' | 'performance' | 'tools' | 'dev' | 'onConsoleLog';
456
+
457
+ declare type Procedure = (...args: any[]) => any;
464
458
 
465
459
  declare type Promisify<O> = {
466
460
  [K in keyof O]: O[K] extends (...args: infer A) => infer R ? Promisify<O[K]> & ((...args: A) => Promise<R>) : O[K];
@@ -507,6 +501,14 @@ declare const reportersMap: {
507
501
 
508
502
  declare type ReporterWithOptions<Name extends BuiltInReporterNames = BuiltInReporterNames> = Name extends keyof BuiltinReporterOptions ? [Name, Partial<BuiltinReporterOptions[Name]>] : [Name, Record<string, unknown>];
509
503
 
504
+ declare type Ro<T> = T extends Array<infer V> ? V[] | Readonly<V[]> | RoArray<V> | Readonly<RoArray<V>> : T extends object ? T | Readonly<T> | RoObject<T> | Readonly<RoObject<T>> : T;
505
+
506
+ declare type RoArray<T> = Ro<T>[];
507
+
508
+ declare type RoObject<T> = {
509
+ [K in keyof T]: T[K] | Ro<T[K]>;
510
+ };
511
+
510
512
  export declare const rs: RstestUtilities;
511
513
 
512
514
  declare type Rstest = RunnerAPI & {
@@ -559,7 +561,7 @@ export declare interface RstestConfig {
559
561
  */
560
562
  retry?: number;
561
563
  /**
562
- * Allows the test suite to pass when no files are found.
564
+ * Pass when no tests are found.
563
565
  *
564
566
  * @default false
565
567
  */
@@ -659,7 +661,9 @@ export declare interface RstestConfig {
659
661
  onConsoleLog?: (content: string) => boolean | void;
660
662
  plugins?: RsbuildConfig['plugins'];
661
663
  source?: Pick<NonNullable<RsbuildConfig['source']>, 'define' | 'tsconfigPath' | 'decorators' | 'include' | 'exclude'>;
662
- output?: Pick<NonNullable<RsbuildConfig['output']>, 'cssModules'>;
664
+ performance?: Pick<NonNullable<RsbuildConfig['performance']>, 'bundleAnalyze'>;
665
+ dev?: Pick<NonNullable<RsbuildConfig['dev']>, 'writeToDisk'>;
666
+ output?: Pick<NonNullable<RsbuildConfig['output']>, 'cssModules' | 'externals' | 'cleanDistPath'>;
663
667
  resolve?: RsbuildConfig['resolve'];
664
668
  tools?: Pick<NonNullable<RsbuildConfig['tools']>, 'rspack' | 'swc' | 'bundlerChain'>;
665
669
  }
@@ -904,6 +908,7 @@ declare type TestResult = {
904
908
  parentNames?: string[];
905
909
  duration?: number;
906
910
  errors?: FormattedError[];
911
+ retryCount?: number;
907
912
  };
908
913
 
909
914
  declare type TestResultStatus = 'skip' | 'pass' | 'fail' | 'todo';
@@ -922,7 +927,7 @@ declare class TraceMap implements SourceMap {
922
927
  private _decodedMemo;
923
928
  private _bySources;
924
929
  private _bySourceMemos;
925
- constructor(map: SourceMapInput, mapUrl?: string | null);
930
+ constructor(map: Ro<SourceMapInput>, mapUrl?: string | null);
926
931
  }
927
932
 
928
933
  declare type Use<T> = (value: T) => Promise<void>;
@@ -211,7 +211,7 @@ declare type NormalizedFixture = {
211
211
 
212
212
  declare type NormalizedFixtures = Record<string, NormalizedFixture>;
213
213
 
214
- declare type OptionalKeys = 'setupFiles' | 'testNamePattern' | 'plugins' | 'source' | 'resolve' | 'output' | 'tools' | 'onConsoleLog';
214
+ declare type OptionalKeys = 'setupFiles' | 'testNamePattern' | 'plugins' | 'source' | 'resolve' | 'output' | 'performance' | 'tools' | 'dev' | 'onConsoleLog';
215
215
 
216
216
  declare type Promisify<O> = {
217
217
  [K in keyof O]: O[K] extends (...args: infer A) => infer R ? Promisify<O[K]> & ((...args: A) => Promise<R>) : O[K];
@@ -258,6 +258,14 @@ declare const reportersMap: {
258
258
 
259
259
  declare type ReporterWithOptions<Name extends BuiltInReporterNames = BuiltInReporterNames> = Name extends keyof BuiltinReporterOptions ? [Name, Partial<BuiltinReporterOptions[Name]>] : [Name, Record<string, unknown>];
260
260
 
261
+ declare type Ro<T> = T extends Array<infer V> ? V[] | Readonly<V[]> | RoArray<V> | Readonly<RoArray<V>> : T extends object ? T | Readonly<T> | RoObject<T> | Readonly<RoObject<T>> : T;
262
+
263
+ declare type RoArray<T> = Ro<T>[];
264
+
265
+ declare type RoObject<T> = {
266
+ [K in keyof T]: T[K] | Ro<T[K]>;
267
+ };
268
+
261
269
  declare type RstestCommand = 'watch' | 'run' | 'list';
262
270
 
263
271
  declare interface RstestConfig {
@@ -301,7 +309,7 @@ declare interface RstestConfig {
301
309
  */
302
310
  retry?: number;
303
311
  /**
304
- * Allows the test suite to pass when no files are found.
312
+ * Pass when no tests are found.
305
313
  *
306
314
  * @default false
307
315
  */
@@ -401,7 +409,9 @@ declare interface RstestConfig {
401
409
  onConsoleLog?: (content: string) => boolean | void;
402
410
  plugins?: RsbuildConfig['plugins'];
403
411
  source?: Pick<NonNullable<RsbuildConfig['source']>, 'define' | 'tsconfigPath' | 'decorators' | 'include' | 'exclude'>;
404
- output?: Pick<NonNullable<RsbuildConfig['output']>, 'cssModules'>;
412
+ performance?: Pick<NonNullable<RsbuildConfig['performance']>, 'bundleAnalyze'>;
413
+ dev?: Pick<NonNullable<RsbuildConfig['dev']>, 'writeToDisk'>;
414
+ output?: Pick<NonNullable<RsbuildConfig['output']>, 'cssModules' | 'externals' | 'cleanDistPath'>;
405
415
  resolve?: RsbuildConfig['resolve'];
406
416
  tools?: Pick<NonNullable<RsbuildConfig['tools']>, 'rspack' | 'swc' | 'bundlerChain'>;
407
417
  }
@@ -582,6 +592,7 @@ declare type TestResult = {
582
592
  parentNames?: string[];
583
593
  duration?: number;
584
594
  errors?: FormattedError[];
595
+ retryCount?: number;
585
596
  };
586
597
 
587
598
  declare type TestResultStatus = 'skip' | 'pass' | 'fail' | 'todo';
@@ -620,7 +631,7 @@ declare class TraceMap implements SourceMap {
620
631
  private _decodedMemo;
621
632
  private _bySources;
622
633
  private _bySourceMemos;
623
- constructor(map: SourceMapInput, mapUrl?: string | null);
634
+ constructor(map: Ro<SourceMapInput>, mapUrl?: string | null);
624
635
  }
625
636
 
626
637
  declare type Use<T> = (value: T) => Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rstest/core",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "The Rsbuild-based test tool.",
5
5
  "bugs": {
6
6
  "url": "https://github.com/web-infra-dev/rstest/issues"
@@ -48,7 +48,7 @@
48
48
  "importMeta.d.ts"
49
49
  ],
50
50
  "dependencies": {
51
- "@rsbuild/core": "1.4.0-rc.0",
51
+ "@rsbuild/core": "1.4.2",
52
52
  "@types/chai": "^5.2.2",
53
53
  "@vitest/expect": "^3.2.4",
54
54
  "@vitest/snapshot": "^3.2.4",
@@ -61,16 +61,16 @@
61
61
  "devDependencies": {
62
62
  "@sinonjs/fake-timers": "^14.0.0",
63
63
  "@babel/code-frame": "^7.27.1",
64
- "@jridgewell/trace-mapping": "0.3.25",
64
+ "@jridgewell/trace-mapping": "0.3.27",
65
65
  "@microsoft/api-extractor": "^7.52.8",
66
- "@rslib/core": "0.10.2",
66
+ "@rslib/core": "0.10.4",
67
67
  "@types/babel__code-frame": "^7.0.6",
68
68
  "@types/sinonjs__fake-timers": "^8.1.5",
69
69
  "@types/jsdom": "^21.1.7",
70
70
  "jsdom": "^26.1.0",
71
71
  "@types/source-map-support": "^0.5.10",
72
72
  "cac": "^6.7.14",
73
- "jest-diff": "^30.0.2",
73
+ "jest-diff": "^30.0.3",
74
74
  "license-webpack-plugin": "^4.0.2",
75
75
  "picocolors": "^1.1.1",
76
76
  "rslog": "^1.2.8",
@@ -98,6 +98,7 @@
98
98
  },
99
99
  "scripts": {
100
100
  "build": "rslib build",
101
+ "typecheck": "tsc --noEmit",
101
102
  "dev": "rslib build --watch",
102
103
  "test": "npx rstest run --globals"
103
104
  }