@rstest/core 0.5.0 → 0.5.1

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~33.js CHANGED
@@ -9,7 +9,7 @@ export const __webpack_modules__ = {
9
9
  __webpack_require__.d(__webpack_exports__, {
10
10
  runTests: ()=>runTests
11
11
  });
12
- var coverage = __webpack_require__("./src/coverage/index.ts");
12
+ var src_coverage = __webpack_require__("./src/coverage/index.ts");
13
13
  var src_pool = __webpack_require__("./src/pool/index.ts");
14
14
  var utils = __webpack_require__("./src/utils/index.ts");
15
15
  const isCliShortcutsEnabled = ()=>(0, utils.Un)('stdin');
@@ -155,7 +155,7 @@ export const __webpack_modules__ = {
155
155
  }
156
156
  var rsbuild = __webpack_require__("./src/core/rsbuild.ts");
157
157
  async function runTests(context) {
158
- const { rootPath, reporters, projects, snapshotManager, command } = context;
158
+ const { rootPath, reporters, projects, snapshotManager, command, normalizedConfig: { coverage } } = context;
159
159
  const entriesCache = new Map();
160
160
  const globTestSourceEntries = async (name)=>{
161
161
  const { include, exclude, includeSource, root } = projects.find((p)=>p.environmentName === name).normalizedConfig;
@@ -199,8 +199,8 @@ export const __webpack_modules__ = {
199
199
  context,
200
200
  recommendWorkerCount
201
201
  });
202
- const coverageProvider = context.normalizedConfig.coverage.enabled ? await (0, coverage.e)(context.normalizedConfig.coverage || {}, context.rootPath) : null;
203
- if (coverageProvider) utils.vF.log(` ${utils.yW.gray('Coverage enabled with')} %s\n`, utils.yW.yellow(context.normalizedConfig.coverage.provider));
202
+ const coverageProvider = coverage.enabled ? await (0, src_coverage.e)(coverage, context.rootPath) : null;
203
+ if (coverageProvider) utils.vF.log(` ${utils.yW.gray('Coverage enabled with')} %s\n`, utils.yW.yellow(coverage.provider));
204
204
  const run = async ({ fileFilters, mode = 'all' } = {})=>{
205
205
  let testStart;
206
206
  const buildStart = Date.now();
@@ -265,7 +265,8 @@ export const __webpack_modules__ = {
265
265
  });
266
266
  }
267
267
  }
268
- if (results.some((r)=>'fail' === r.status)) process.exitCode = 1;
268
+ const isFailure = results.some((r)=>'fail' === r.status);
269
+ if (isFailure) process.exitCode = 1;
269
270
  for (const reporter of reporters)await reporter.onTestRunEnd?.({
270
271
  results: context.reporterResults.results,
271
272
  testResults: context.reporterResults.testResults,
@@ -274,7 +275,7 @@ export const __webpack_modules__ = {
274
275
  getSourcemap: (name)=>sourceMaps[name] || null,
275
276
  filterRerunTestPaths: currentEntries.length ? currentEntries.map((e)=>e.testPath) : void 0
276
277
  });
277
- if (coverageProvider) {
278
+ if (coverageProvider && (!isFailure || coverage.reportOnFailure)) {
278
279
  const { generateCoverage } = await __webpack_require__.e("204").then(__webpack_require__.bind(__webpack_require__, "./src/coverage/generate.ts"));
279
280
  await generateCoverage(context, results, coverageProvider);
280
281
  }
package/dist/0~816.js CHANGED
@@ -106,7 +106,7 @@ export const __webpack_modules__ = {
106
106
  });
107
107
  }
108
108
  });
109
- var external_node_path_ = __webpack_require__("path");
109
+ var external_node_path_ = __webpack_require__("node:path");
110
110
  var external_node_url_ = __webpack_require__("node:url");
111
111
  const PLUGIN_CSS_FILTER = 'rstest:css-filter';
112
112
  const css_filter_dirname = external_node_path_["default"].dirname((0, external_node_url_.fileURLToPath)(import.meta.url));
@@ -183,6 +183,7 @@ export const __webpack_modules__ = {
183
183
  });
184
184
  }
185
185
  });
186
+ var external_node_module_ = __webpack_require__("node:module");
186
187
  const autoExternalNodeModules = ({ context, request, dependencyType, getResolve }, callback)=>{
187
188
  if (!request) return callback();
188
189
  if (request.startsWith('@swc/helpers/')) return callback();
@@ -199,7 +200,7 @@ export const __webpack_modules__ = {
199
200
  };
200
201
  function autoExternalNodeBuiltin({ request, dependencyType }, callback) {
201
202
  if (!request) return void callback();
202
- const isNodeBuiltin = utils.Kv.some((builtin)=>{
203
+ const isNodeBuiltin = (0, external_node_module_.isBuiltin)(request) || utils.Uq.some((builtin)=>{
203
204
  if ('string' == typeof builtin) return builtin === request;
204
205
  return builtin.test(request);
205
206
  });
@@ -940,7 +941,7 @@ global.__rstest_clean_core_cache__ = __rstest_clean_core_cache__;
940
941
  return parsed > 0 ? parsed : 1;
941
942
  };
942
943
  const getRuntimeConfig = (context)=>{
943
- const { testNamePattern, testTimeout, passWithNoTests, retry, globals, clearMocks, resetMocks, restoreMocks, unstubEnvs, unstubGlobals, maxConcurrency, printConsoleTrace, disableConsoleIntercept, testEnvironment, hookTimeout, isolate, coverage } = context.normalizedConfig;
944
+ const { testNamePattern, testTimeout, passWithNoTests, retry, globals, clearMocks, resetMocks, restoreMocks, unstubEnvs, unstubGlobals, maxConcurrency, printConsoleTrace, disableConsoleIntercept, testEnvironment, hookTimeout, isolate, coverage, snapshotFormat } = context.normalizedConfig;
944
945
  return {
945
946
  testNamePattern,
946
947
  testTimeout,
@@ -958,7 +959,8 @@ global.__rstest_clean_core_cache__ = __rstest_clean_core_cache__;
958
959
  disableConsoleIntercept,
959
960
  testEnvironment,
960
961
  isolate,
961
- coverage
962
+ coverage,
963
+ snapshotFormat
962
964
  };
963
965
  };
964
966
  const filterAssetsByEntry = (entryInfo, assetFiles, setupAssets, sourceMaps, entryLength)=>{
package/dist/0~876.js CHANGED
@@ -559,7 +559,7 @@ export const __webpack_modules__ = {
559
559
  });
560
560
  this.reporters = reporters;
561
561
  this.snapshotManager = snapshotManager;
562
- this.version = "0.5.0";
562
+ this.version = "0.5.1";
563
563
  this.rootPath = rootPath;
564
564
  this.originalConfig = userConfig;
565
565
  this.normalizedConfig = rstestConfig;
@@ -682,6 +682,16 @@ export const __webpack_modules__ = {
682
682
  _utils__WEBPACK_IMPORTED_MODULE_3__.vF.log(`${_utils__WEBPACK_IMPORTED_MODULE_3__.yW.red(tips.join('\n'))}\n`);
683
683
  return;
684
684
  }
685
+ if (error.message.includes('is not defined')) {
686
+ const [, varName] = error.message.match(/(.*) is not defined/) || [];
687
+ if (varName) {
688
+ if (_utils__WEBPACK_IMPORTED_MODULE_3__.TE.includes(varName)) error.message = error.message.replace(`${varName} is not defined`, `${varName} is not defined. Did you forget to enable "globals" configuration?`);
689
+ else if ([
690
+ 'jest',
691
+ 'vitest'
692
+ ].includes(varName)) error.message = error.message.replace(`${varName} is not defined`, `${varName} is not defined. Did you mean rstest?`);
693
+ }
694
+ }
685
695
  _utils__WEBPACK_IMPORTED_MODULE_3__.vF.log(`${_utils__WEBPACK_IMPORTED_MODULE_3__.yW.red(_utils__WEBPACK_IMPORTED_MODULE_3__.yW.bold(errorName))}${_utils__WEBPACK_IMPORTED_MODULE_3__.yW.red(`: ${error.message}`)}\n`);
686
696
  if (error.diff) {
687
697
  _utils__WEBPACK_IMPORTED_MODULE_3__.vF.log(error.diff);
package/dist/0~928.js CHANGED
@@ -13,7 +13,7 @@ export const __webpack_modules__ = {
13
13
  var external_node_fs_ = __webpack_require__("node:fs");
14
14
  var promises_ = __webpack_require__("fs/promises");
15
15
  var external_events_ = __webpack_require__("events");
16
- var external_node_path_ = __webpack_require__("path");
16
+ var external_node_path_ = __webpack_require__("node:path");
17
17
  var external_node_fs_promises_ = __webpack_require__("node:fs/promises");
18
18
  var external_node_stream_ = __webpack_require__("node:stream");
19
19
  const EntryTypes = {
package/dist/0~967.js CHANGED
@@ -10,7 +10,7 @@ export const __webpack_modules__ = {
10
10
  onBeforeRestart: ()=>onBeforeRestart,
11
11
  watchFilesForRestart: ()=>watchFilesForRestart
12
12
  });
13
- var external_node_path_ = __webpack_require__("path");
13
+ var external_node_path_ = __webpack_require__("node:path");
14
14
  var commands = __webpack_require__("./src/cli/commands.ts");
15
15
  var utils = __webpack_require__("./src/utils/index.ts");
16
16
  const GLOB_REGEX = /[*?{}[\]()!@+|]/;
package/dist/0~969.js CHANGED
@@ -38,7 +38,7 @@ export const __webpack_modules__ = {
38
38
  "../../node_modules/.pnpm/source-map-support@0.5.21/node_modules/source-map-support/source-map-support.js": function(module, exports, __webpack_require__) {
39
39
  module = __webpack_require__.nmd(module);
40
40
  var SourceMapConsumer = __webpack_require__("../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/source-map.js").SourceMapConsumer;
41
- var path = __webpack_require__("path");
41
+ var path = __webpack_require__("node:path");
42
42
  var fs;
43
43
  try {
44
44
  fs = __webpack_require__("node:fs");
package/dist/0~971.js CHANGED
@@ -10,7 +10,7 @@ export const __webpack_modules__ = {
10
10
  listTests: ()=>listTests
11
11
  });
12
12
  var node_fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("node:fs");
13
- var node_path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("path");
13
+ var node_path__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("node:path");
14
14
  var _pool__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("./src/pool/index.ts");
15
15
  var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("./src/utils/index.ts");
16
16
  var _rsbuild__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("./src/core/rsbuild.ts");
package/dist/index.js CHANGED
@@ -2017,7 +2017,7 @@ ${section.body}` : section.body).join("\n\n"));
2017
2017
  function setupCommands() {
2018
2018
  const cli = dist('rstest');
2019
2019
  cli.help();
2020
- cli.version("0.5.0");
2020
+ cli.version("0.5.1");
2021
2021
  applyCommonOptions(cli);
2022
2022
  cli.command('[...filters]', 'run tests').option('-w, --watch', 'Run tests in watch mode').action(async (filters, options)=>{
2023
2023
  (0, prepare.N)();
@@ -2090,7 +2090,7 @@ ${section.body}` : section.body).join("\n\n"));
2090
2090
  if (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) console.log();
2091
2091
  }
2092
2092
  function showRstest() {
2093
- _utils_logger__WEBPACK_IMPORTED_MODULE_0__.vF.greet(" Rstest v0.5.0");
2093
+ _utils_logger__WEBPACK_IMPORTED_MODULE_0__.vF.greet(" Rstest v0.5.1");
2094
2094
  _utils_logger__WEBPACK_IMPORTED_MODULE_0__.vF.log('');
2095
2095
  }
2096
2096
  },
@@ -2193,6 +2193,7 @@ ${section.body}` : section.body).join("\n\n"));
2193
2193
  maxConcurrency: 5,
2194
2194
  printConsoleTrace: false,
2195
2195
  disableConsoleIntercept: false,
2196
+ snapshotFormat: {},
2196
2197
  coverage: {
2197
2198
  exclude: [
2198
2199
  '**/node_modules/**',
@@ -2216,7 +2217,8 @@ ${section.body}` : section.body).join("\n\n"));
2216
2217
  'json'
2217
2218
  ],
2218
2219
  reportsDirectory: './coverage',
2219
- clean: true
2220
+ clean: true,
2221
+ reportOnFailure: false
2220
2222
  }
2221
2223
  });
2222
2224
  const withDefaultConfig = (config)=>{
@@ -2243,6 +2245,7 @@ ${section.body}` : section.body).join("\n\n"));
2243
2245
  "./src/utils/constants.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
2244
2246
  __webpack_require__.d(__webpack_exports__, {
2245
2247
  EJ: ()=>TEMP_RSTEST_OUTPUT_DIR_GLOB,
2248
+ TE: ()=>globalApis,
2246
2249
  WB: ()=>TS_CONFIG_FILE,
2247
2250
  kv: ()=>DEFAULT_CONFIG_EXTENSIONS,
2248
2251
  t: ()=>DEFAULT_CONFIG_NAME,
@@ -2259,16 +2262,31 @@ ${section.body}` : section.body).join("\n\n"));
2259
2262
  '.cjs',
2260
2263
  '.cts'
2261
2264
  ];
2265
+ const globalApis = [
2266
+ 'test',
2267
+ 'describe',
2268
+ 'it',
2269
+ 'expect',
2270
+ 'afterAll',
2271
+ 'afterEach',
2272
+ 'beforeAll',
2273
+ 'beforeEach',
2274
+ 'rstest',
2275
+ 'rs',
2276
+ 'assert',
2277
+ 'onTestFinished',
2278
+ 'onTestFailed'
2279
+ ];
2262
2280
  const TS_CONFIG_FILE = 'tsconfig.json';
2263
2281
  },
2264
2282
  "./src/utils/helper.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
2265
2283
  __webpack_require__.d(__webpack_exports__, {
2266
2284
  C3: ()=>needFlagExperimentalDetectModule,
2267
2285
  FI: ()=>getAbsolutePath,
2268
- Kv: ()=>NODE_BUILTINS,
2269
2286
  Ok: ()=>serializableConfig,
2270
2287
  P2: ()=>parsePosix,
2271
2288
  Un: ()=>isTTY,
2289
+ Uq: ()=>ADDITIONAL_NODE_BUILTINS,
2272
2290
  Wk: ()=>formatError,
2273
2291
  bg: ()=>castArray,
2274
2292
  fN: ()=>getTaskNameWithPrefix,
@@ -2358,61 +2376,7 @@ ${section.body}` : section.body).join("\n\n"));
2358
2376
  if (22 === major && minor < 7) return true;
2359
2377
  return false;
2360
2378
  };
2361
- const NODE_BUILTINS = [
2362
- 'assert',
2363
- 'assert/strict',
2364
- 'async_hooks',
2365
- 'buffer',
2366
- 'child_process',
2367
- 'cluster',
2368
- 'console',
2369
- 'constants',
2370
- 'crypto',
2371
- 'dgram',
2372
- 'diagnostics_channel',
2373
- 'dns',
2374
- 'dns/promises',
2375
- 'domain',
2376
- 'events',
2377
- 'fs',
2378
- 'fs/promises',
2379
- 'http',
2380
- 'http2',
2381
- 'https',
2382
- 'inspector',
2383
- 'inspector/promises',
2384
- 'module',
2385
- 'net',
2386
- 'os',
2387
- 'path',
2388
- 'path/posix',
2389
- 'path/win32',
2390
- 'perf_hooks',
2391
- 'process',
2392
- 'punycode',
2393
- 'querystring',
2394
- 'readline',
2395
- 'readline/promises',
2396
- 'repl',
2397
- 'stream',
2398
- 'stream/consumers',
2399
- 'stream/promises',
2400
- 'stream/web',
2401
- 'string_decoder',
2402
- 'sys',
2403
- 'timers',
2404
- 'timers/promises',
2405
- 'tls',
2406
- 'trace_events',
2407
- 'tty',
2408
- 'url',
2409
- 'util',
2410
- 'util/types',
2411
- 'v8',
2412
- 'vm',
2413
- 'wasi',
2414
- 'worker_threads',
2415
- 'zlib',
2379
+ const ADDITIONAL_NODE_BUILTINS = [
2416
2380
  /^node:/,
2417
2381
  'pnpapi'
2418
2382
  ];
@@ -2420,22 +2384,23 @@ ${section.body}` : section.body).join("\n\n"));
2420
2384
  },
2421
2385
  "./src/utils/index.ts": function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
2422
2386
  __webpack_require__.d(__webpack_exports__, {
2387
+ TE: ()=>constants.TE,
2423
2388
  C3: ()=>helper.C3,
2424
- Ok: ()=>helper.Ok,
2425
2389
  XJ: ()=>formatTestPath,
2426
2390
  zZ: ()=>constants.zZ,
2427
2391
  fN: ()=>helper.fN,
2428
2392
  vF: ()=>logger.vF,
2393
+ Ok: ()=>helper.Ok,
2429
2394
  vO: ()=>">",
2430
2395
  tG: ()=>getTestEntries,
2431
2396
  FI: ()=>helper.FI,
2432
- kv: ()=>constants.kv,
2397
+ Uq: ()=>helper.Uq,
2433
2398
  yW: ()=>helper.yW,
2399
+ kv: ()=>constants.kv,
2434
2400
  WB: ()=>constants.WB,
2435
- _o: ()=>logger._o,
2436
2401
  pr: ()=>getSetupFiles,
2402
+ _o: ()=>logger._o,
2437
2403
  EQ: ()=>prettyTestPath,
2438
- Kv: ()=>helper.Kv,
2439
2404
  zz: ()=>filterProjects,
2440
2405
  mT: ()=>logger.mT,
2441
2406
  t: ()=>constants.t,
@@ -2858,7 +2823,7 @@ ${section.body}` : section.body).join("\n\n"));
2858
2823
  "node:os": function(module) {
2859
2824
  module.exports = __WEBPACK_EXTERNAL_MODULE_node_os_74b4b876__;
2860
2825
  },
2861
- path: function(module) {
2826
+ "node:path": function(module) {
2862
2827
  module.exports = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__;
2863
2828
  },
2864
2829
  "node:tty": function(module) {
@@ -3352,7 +3317,7 @@ ${section.body}` : section.body).join("\n\n"));
3352
3317
  glob: ()=>glob
3353
3318
  });
3354
3319
  var external_node_fs_ = __webpack_require__("node:fs");
3355
- var external_node_path_ = __webpack_require__("path");
3320
+ var external_node_path_ = __webpack_require__("node:path");
3356
3321
  var __require = /* @__PURE__ */ (0, __WEBPACK_EXTERNAL_MODULE_module__.createRequire)(import.meta.url);
3357
3322
  function cleanPath(path) {
3358
3323
  let normalized = (0, external_node_path_.normalize)(path);
package/dist/worker.js CHANGED
@@ -5451,7 +5451,7 @@ var __webpack_modules__ = {
5451
5451
  "node:os": function(module) {
5452
5452
  module.exports = __WEBPACK_EXTERNAL_MODULE_node_os_74b4b876__;
5453
5453
  },
5454
- path: function(module) {
5454
+ "node:path": function(module) {
5455
5455
  module.exports = __WEBPACK_EXTERNAL_MODULE_node_path_c5b9b54f__;
5456
5456
  },
5457
5457
  "node:tty": function(module) {
@@ -6082,7 +6082,7 @@ async function createCoverageProvider(options, root) {
6082
6082
  var constants = __webpack_require__("./src/utils/constants.ts");
6083
6083
  var helper = __webpack_require__("./src/utils/helper.ts");
6084
6084
  var util = __webpack_require__("./src/runtime/util.ts");
6085
- var external_node_path_ = __webpack_require__("path");
6085
+ var external_node_path_ = __webpack_require__("node:path");
6086
6086
  var pathe_M_eThtNZ = __webpack_require__("../../node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs");
6087
6087
  const delimiter = /* @__PURE__ */ (()=>globalThis.process?.platform === "win32" ? ";" : ":")();
6088
6088
  const _platforms = {
@@ -6501,7 +6501,7 @@ const preparePool = async ({ entryInfo: { distPath, testPath }, sourceMaps, upda
6501
6501
  context.runtimeConfig = (0, helper.gy)(context.runtimeConfig);
6502
6502
  const cleanupFns = [];
6503
6503
  const { rpc } = createRuntimeRpc(createForksRpcOptions());
6504
- const { runtimeConfig: { globals, printConsoleTrace, disableConsoleIntercept, testEnvironment } } = context;
6504
+ const { runtimeConfig: { globals, printConsoleTrace, disableConsoleIntercept, testEnvironment, snapshotFormat } } = context;
6505
6505
  if (!disableConsoleIntercept) {
6506
6506
  const { createCustomConsole } = await __webpack_require__.e("493").then(__webpack_require__.bind(__webpack_require__, "./src/runtime/worker/console.ts"));
6507
6507
  global.console = createCustomConsole({
@@ -6515,7 +6515,8 @@ const preparePool = async ({ entryInfo: { distPath, testPath }, sourceMaps, upda
6515
6515
  ...context,
6516
6516
  snapshotOptions: {
6517
6517
  updateSnapshot,
6518
- snapshotEnvironment: new RstestSnapshotEnvironment()
6518
+ snapshotEnvironment: new RstestSnapshotEnvironment(),
6519
+ snapshotFormat
6519
6520
  },
6520
6521
  distPath,
6521
6522
  testPath,
@@ -415,6 +415,11 @@ export declare type CoverageOptions = {
415
415
  * @default undefined
416
416
  */
417
417
  thresholds?: CoverageThresholds;
418
+ /**
419
+ * Whether to report coverage when tests fail.
420
+ * @default false
421
+ */
422
+ reportOnFailure?: boolean;
418
423
  };
419
424
 
420
425
  export declare class CoverageProvider {
@@ -2212,6 +2217,8 @@ export declare interface RstestConfig {
2212
2217
  * Custom handler for console log in tests
2213
2218
  */
2214
2219
  onConsoleLog?: (content: string) => boolean | void;
2220
+ /** Format snapshot output */
2221
+ snapshotFormat?: SnapshotFormat;
2215
2222
  /**
2216
2223
  * Coverage options
2217
2224
  */
@@ -2413,7 +2420,7 @@ declare type RunnerAPI = {
2413
2420
  onTestFailed: (fn: OnTestFailedHandler, timeout?: number) => void;
2414
2421
  };
2415
2422
 
2416
- declare type RuntimeConfig = Pick<RstestContext['normalizedConfig'], 'testTimeout' | 'testNamePattern' | 'globals' | 'passWithNoTests' | 'retry' | 'clearMocks' | 'resetMocks' | 'restoreMocks' | 'unstubEnvs' | 'unstubGlobals' | 'maxConcurrency' | 'printConsoleTrace' | 'disableConsoleIntercept' | 'testEnvironment' | 'isolate' | 'hookTimeout' | 'coverage'>;
2423
+ declare type RuntimeConfig = Pick<RstestContext['normalizedConfig'], 'testTimeout' | 'testNamePattern' | 'globals' | 'passWithNoTests' | 'retry' | 'clearMocks' | 'resetMocks' | 'restoreMocks' | 'unstubEnvs' | 'unstubGlobals' | 'maxConcurrency' | 'printConsoleTrace' | 'disableConsoleIntercept' | 'testEnvironment' | 'isolate' | 'hookTimeout' | 'coverage' | 'snapshotFormat'>;
2417
2424
 
2418
2425
  declare type RuntimeOptions = Partial<Pick<RuntimeConfig, 'testTimeout' | 'hookTimeout' | 'clearMocks' | 'resetMocks' | 'restoreMocks' | 'maxConcurrency' | 'retry'>>;
2419
2426
 
@@ -2433,6 +2440,8 @@ declare interface SnapshotEnvironment {
2433
2440
  processStackTrace?: (stack: ParsedStack) => ParsedStack;
2434
2441
  }
2435
2442
 
2443
+ declare type SnapshotFormat = Omit<NonNullable<SnapshotStateOptions['snapshotFormat']>, 'plugins' | 'compareKeys'>;
2444
+
2436
2445
  declare class SnapshotManager {
2437
2446
  options: Omit<SnapshotStateOptions, "snapshotEnvironment">;
2438
2447
  summary: SnapshotSummary;
@@ -391,6 +391,11 @@ declare type CoverageOptions = {
391
391
  * @default undefined
392
392
  */
393
393
  thresholds?: CoverageThresholds;
394
+ /**
395
+ * Whether to report coverage when tests fail.
396
+ * @default false
397
+ */
398
+ reportOnFailure?: boolean;
394
399
  };
395
400
 
396
401
  declare class CoverageSummary {
@@ -1930,6 +1935,8 @@ declare interface RstestConfig {
1930
1935
  * Custom handler for console log in tests
1931
1936
  */
1932
1937
  onConsoleLog?: (content: string) => boolean | void;
1938
+ /** Format snapshot output */
1939
+ snapshotFormat?: SnapshotFormat;
1933
1940
  /**
1934
1941
  * Coverage options
1935
1942
  */
@@ -2005,7 +2012,7 @@ declare type RunnerAPI = {
2005
2012
  onTestFailed: (fn: OnTestFailedHandler, timeout?: number) => void;
2006
2013
  };
2007
2014
 
2008
- declare type RuntimeConfig = Pick<RstestContext['normalizedConfig'], 'testTimeout' | 'testNamePattern' | 'globals' | 'passWithNoTests' | 'retry' | 'clearMocks' | 'resetMocks' | 'restoreMocks' | 'unstubEnvs' | 'unstubGlobals' | 'maxConcurrency' | 'printConsoleTrace' | 'disableConsoleIntercept' | 'testEnvironment' | 'isolate' | 'hookTimeout' | 'coverage'>;
2015
+ declare type RuntimeConfig = Pick<RstestContext['normalizedConfig'], 'testTimeout' | 'testNamePattern' | 'globals' | 'passWithNoTests' | 'retry' | 'clearMocks' | 'resetMocks' | 'restoreMocks' | 'unstubEnvs' | 'unstubGlobals' | 'maxConcurrency' | 'printConsoleTrace' | 'disableConsoleIntercept' | 'testEnvironment' | 'isolate' | 'hookTimeout' | 'coverage' | 'snapshotFormat'>;
2009
2016
 
2010
2017
  /** Runtime to Server */
2011
2018
  declare type RuntimeRPC = {
@@ -2044,6 +2051,8 @@ declare interface SnapshotEnvironment {
2044
2051
  processStackTrace?: (stack: ParsedStack) => ParsedStack;
2045
2052
  }
2046
2053
 
2054
+ declare type SnapshotFormat = Omit<NonNullable<SnapshotStateOptions['snapshotFormat']>, 'plugins' | 'compareKeys'>;
2055
+
2047
2056
  declare class SnapshotManager {
2048
2057
  options: Omit<SnapshotStateOptions, "snapshotEnvironment">;
2049
2058
  summary: SnapshotSummary;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rstest/core",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "The Rsbuild-based test tool.",
5
5
  "bugs": {
6
6
  "url": "https://github.com/web-infra-dev/rstest/issues"