@rstest/core 0.7.5 → 0.7.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/LICENSE.md +1 -1
  2. package/dist/0~130.js +2 -2
  3. package/dist/{0~173.js → 0~2173.js} +10 -8
  4. package/dist/{0~255.js → 0~2255.js} +2 -2
  5. package/dist/{0~346.js → 0~3346.js} +2 -2
  6. package/dist/{0~919.js → 0~3919.js} +1 -1
  7. package/dist/{0~403.js → 0~4403.js} +3 -3
  8. package/dist/{0~809.js → 0~4809.js} +2 -2
  9. package/dist/{0~835.js → 0~5835.js} +12 -8
  10. package/dist/{0~151.js → 0~6151.js} +163 -292
  11. package/dist/0~62.js +2 -2
  12. package/dist/{0~588.js → 0~6588.js} +6 -6
  13. package/dist/{0~907.js → 0~6907.js} +2 -2
  14. package/dist/{0~923.js → 0~6923.js} +11 -7
  15. package/dist/{0~973.js → 0~6973.js} +6 -6
  16. package/dist/{0~583.js → 0~7583.js} +5 -5
  17. package/dist/{0~426.js → 0~8426.js} +3 -3
  18. package/dist/0~89.js +20 -12
  19. package/dist/0~8957.js +149 -0
  20. package/dist/{0~634.js → 0~9634.js} +7 -7
  21. package/dist/{157.js → 1157.js} +5 -5
  22. package/dist/{216.js → 3216.js} +2 -2
  23. package/dist/{278.js → 3278.js} +2 -2
  24. package/dist/{397.js → 4397.js} +1 -1
  25. package/dist/4881.js +3 -0
  26. package/dist/554.js +27 -22
  27. package/dist/{693.js → 5693.js} +1 -1
  28. package/dist/{734.js → 5734.js} +4 -4
  29. package/dist/6198.js +3 -0
  30. package/dist/{913.js → 7913.js} +8 -8
  31. package/dist/{131.js → 9131.js} +24 -15
  32. package/dist/globalSetupWorker.js +8 -6
  33. package/dist/index.d.ts +4 -0
  34. package/dist/index.js +1 -1
  35. package/dist/rslib-runtime.js +1 -1
  36. package/dist/worker.d.ts +4 -0
  37. package/package.json +5 -5
  38. package/dist/198.js +0 -4
  39. package/dist/881.js +0 -4
  40. /package/dist/{0~681.js → 0~3062.js} +0 -0
  41. /package/dist/{0~151.js.LICENSE.txt → 0~6151.js.LICENSE.txt} +0 -0
  42. /package/dist/{0~583.js.LICENSE.txt → 0~7583.js.LICENSE.txt} +0 -0
  43. /package/dist/{672.js → 1672.js} +0 -0
  44. /package/dist/{913.js.LICENSE.txt → 7913.js.LICENSE.txt} +0 -0
@@ -1,9 +1,9 @@
1
- /*! For license information please see 913.js.LICENSE.txt */
1
+ /*! For license information please see 7913.js.LICENSE.txt */
2
2
  import 'module';
3
3
  /*#__PURE__*/ import.meta.url;
4
4
  import { __webpack_require__ } from "./rslib-runtime.js";
5
- import "./693.js";
6
- import { createRequire } from "./881.js";
5
+ import "./5693.js";
6
+ import { createRequire } from "./4881.js";
7
7
  __webpack_require__.add({
8
8
  "../../node_modules/.pnpm/@jest+diff-sequences@30.0.1/node_modules/@jest/diff-sequences/build/index.js" (module) {
9
9
  /*!
@@ -871,7 +871,7 @@ __webpack_require__.add({
871
871
  },
872
872
  "../../node_modules/.pnpm/buffer-from@1.1.2/node_modules/buffer-from/index.js" (module) {
873
873
  var toString = Object.prototype.toString;
874
- var isModern = 'undefined' != typeof Buffer && 'function' == typeof Buffer.alloc && 'function' == typeof Buffer.allocUnsafe && 'function' == typeof Buffer.from;
874
+ var isModern = "u" > typeof Buffer && 'function' == typeof Buffer.alloc && 'function' == typeof Buffer.allocUnsafe && 'function' == typeof Buffer.from;
875
875
  function isArrayBuffer(input) {
876
876
  return 'ArrayBuffer' === toString.call(input).slice(8, -1);
877
877
  }
@@ -4378,7 +4378,7 @@ __webpack_require__.add({
4378
4378
  const errorToString = Error.prototype.toString;
4379
4379
  const regExpToString = RegExp.prototype.toString;
4380
4380
  const getConstructorName = (val)=>'function' == typeof val.constructor && val.constructor.name || 'Object';
4381
- const isWindow = (val)=>'undefined' != typeof window && val === window;
4381
+ const isWindow = (val)=>"u" > typeof window && val === window;
4382
4382
  const SYMBOL_REGEXP = /^Symbol\((.*)\)(.*)$/;
4383
4383
  const NEWLINE_REGEXP = /\n/gi;
4384
4384
  class PrettyFormatPluginError extends Error {
@@ -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__("node:fs");
4860
+ fs = __webpack_require__("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");
@@ -4876,7 +4876,7 @@ __webpack_require__.add({
4876
4876
  function isInBrowser() {
4877
4877
  if ("browser" === environment) return true;
4878
4878
  if ("node" === environment) return false;
4879
- return 'undefined' != typeof window && 'function' == typeof XMLHttpRequest && !(window.require && window.module && window.process && "renderer" === window.process.type);
4879
+ return "u" > typeof window && 'function' == typeof XMLHttpRequest && !(window.require && window.module && window.process && "renderer" === window.process.type);
4880
4880
  }
4881
4881
  function hasGlobalProcessEventEmitter() {
4882
4882
  return 'object' == typeof process && null !== process && 'function' == typeof process.on;
@@ -5242,7 +5242,7 @@ __webpack_require__.add({
5242
5242
  "../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/lib/array-set.js" (__unused_rspack_module, exports, __webpack_require__) {
5243
5243
  var util = __webpack_require__("../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/lib/util.js");
5244
5244
  var has = Object.prototype.hasOwnProperty;
5245
- var hasNativeMap = "undefined" != typeof Map;
5245
+ var hasNativeMap = "u" > typeof Map;
5246
5246
  function ArraySet() {
5247
5247
  this._array = [];
5248
5248
  this._set = hasNativeMap ? new Map() : Object.create(null);
@@ -3,11 +3,11 @@ import 'module';
3
3
  import { __webpack_require__ } from "./rslib-runtime.js";
4
4
  import { EventEmitter } from "events";
5
5
  import { createRsbuild, loadConfig, logger as core_logger, mergeRsbuildConfig, rspack } from "@rsbuild/core";
6
- import "./693.js";
7
- import { basename, logger_logger, dirname, posix, resolve as pathe_M_eThtNZ_resolve, isDebug, isAbsolute, relative, join, normalize } from "./278.js";
8
- import { isTTY, DEFAULT_CONFIG_NAME, globalApis, filterProjects, getAbsolutePath, bgColor, formatRootStr, isDynamicPattern, glob, writeFile, castArray, prettyTestPath, prettyTime, TEMP_RSTEST_OUTPUT_DIR_GLOB, getTaskNameWithPrefix, formatTestPath, formatError, DEFAULT_CONFIG_EXTENSIONS, TS_CONFIG_FILE } from "./157.js";
9
- import { parse as stack_trace_parser_esm_parse } from "./672.js";
10
- import { decode } from "./397.js";
6
+ import "./5693.js";
7
+ import { basename, logger_logger, dirname, posix, resolve as pathe_M_eThtNZ_resolve, isDebug, isAbsolute, relative, join, normalize } from "./3278.js";
8
+ import { isTTY, DEFAULT_CONFIG_NAME, globalApis, filterProjects, getAbsolutePath, bgColor, formatRootStr, isDynamicPattern, glob, writeFile, castArray, prettyTestPath, prettyTime, TEMP_RSTEST_OUTPUT_DIR_GLOB, getTaskNameWithPrefix, formatTestPath, formatError, DEFAULT_CONFIG_EXTENSIONS, TS_CONFIG_FILE } from "./1157.js";
9
+ import { parse as stack_trace_parser_esm_parse } from "./1672.js";
10
+ import { decode } from "./4397.js";
11
11
  function toArr(any) {
12
12
  return null == any ? [] : Array.isArray(any) ? any : [
13
13
  any
@@ -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.5");
506
+ logger_logger.greet(" Rstest v0.7.6");
507
507
  logger_logger.log('');
508
508
  }
509
509
  const applyCommonOptions = (cli)=>{
@@ -527,7 +527,7 @@ const runRest = async ({ options, filters, command })=>{
527
527
  projects
528
528
  }, command, filters.map(normalize));
529
529
  if ('watch' === command && configFilePath) {
530
- const { watchFilesForRestart } = await import("./0~588.js").then((mod)=>({
530
+ const { watchFilesForRestart } = await import("./0~6588.js").then((mod)=>({
531
531
  watchFilesForRestart: mod.watchFilesForRestart
532
532
  }));
533
533
  watchFilesForRestart({
@@ -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.5");
550
+ cli.version("0.7.6");
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__("node:fs");
610
+ const external_node_fs_ = __webpack_require__("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);
@@ -1595,10 +1595,12 @@ class DefaultReporter {
1595
1595
  config;
1596
1596
  options = {};
1597
1597
  statusRenderer;
1598
+ testState;
1598
1599
  constructor({ rootPath, options, config, testState }){
1599
1600
  this.rootPath = rootPath;
1600
1601
  this.config = config;
1601
1602
  this.options = options;
1603
+ this.testState = testState;
1602
1604
  if (isTTY() || options.logger) this.statusRenderer = new StatusRenderer(rootPath, testState, options.logger);
1603
1605
  }
1604
1606
  onTestFileStart() {
@@ -1609,8 +1611,9 @@ class DefaultReporter {
1609
1611
  const relativePath = relative(this.rootPath, test.testPath);
1610
1612
  const { slowTestThreshold } = this.config;
1611
1613
  logFileTitle(test, relativePath);
1614
+ const showAllCases = this.testState.getTestFiles()?.length === 1;
1612
1615
  for (const result of test.results){
1613
- const isDisplayed = 'fail' === result.status || (result.duration ?? 0) > slowTestThreshold || (result.retryCount ?? 0) > 0;
1616
+ const isDisplayed = showAllCases || 'fail' === result.status || (result.duration ?? 0) > slowTestThreshold || (result.retryCount ?? 0) > 0;
1614
1617
  isDisplayed && logCase(result, {
1615
1618
  slowTestThreshold,
1616
1619
  hideSkippedTests: this.config.hideSkippedTests
@@ -2076,7 +2079,7 @@ async function printCodeFrame(frame) {
2076
2079
  if (!filePath) return;
2077
2080
  const source = external_node_fs_["default"].existsSync(filePath) ? external_node_fs_["default"].readFileSync(filePath, 'utf-8') : void 0;
2078
2081
  if (!source) return;
2079
- const { codeFrameColumns } = await import("./0~919.js").then(__webpack_require__.bind(__webpack_require__, "../../node_modules/.pnpm/@babel+code-frame@7.27.1/node_modules/@babel/code-frame/lib/index.js"));
2082
+ const { codeFrameColumns } = await import("./0~3919.js").then(__webpack_require__.bind(__webpack_require__, "../../node_modules/.pnpm/@babel+code-frame@7.27.1/node_modules/@babel/code-frame/lib/index.js"));
2080
2083
  const result = codeFrameColumns(source, {
2081
2084
  start: {
2082
2085
  line: frame.lineNumber,
@@ -2265,6 +2268,7 @@ class VerboseReporter extends DefaultReporter {
2265
2268
  class TestStateManager {
2266
2269
  runningModules = new Map();
2267
2270
  testModules = [];
2271
+ testFiles = void 0;
2268
2272
  onTestFileStart(testPath) {
2269
2273
  this.runningModules.set(testPath, {
2270
2274
  runningTests: [],
@@ -2318,6 +2322,7 @@ class TestStateManager {
2318
2322
  reset() {
2319
2323
  this.runningModules.clear();
2320
2324
  this.testModules = [];
2325
+ this.testFiles = void 0;
2321
2326
  }
2322
2327
  }
2323
2328
  function formatEnvironmentName(name) {
@@ -2341,7 +2346,11 @@ class Rstest {
2341
2346
  stateManager = new TestStateManager();
2342
2347
  testState = {
2343
2348
  getRunningModules: ()=>this.stateManager.runningModules,
2344
- getTestModules: ()=>this.stateManager.testModules
2349
+ getTestModules: ()=>this.stateManager.testModules,
2350
+ getTestFiles: ()=>{
2351
+ if ('watch' === this.command) return;
2352
+ return this.stateManager.testFiles;
2353
+ }
2345
2354
  };
2346
2355
  projects = [];
2347
2356
  constructor({ cwd = process.cwd(), command, fileFilters, configFilePath, projects }, userConfig){
@@ -2364,7 +2373,7 @@ class Rstest {
2364
2373
  });
2365
2374
  this.reporters = reporters;
2366
2375
  this.snapshotManager = snapshotManager;
2367
- this.version = "0.7.5";
2376
+ this.version = "0.7.6";
2368
2377
  this.rootPath = rootPath;
2369
2378
  this.originalConfig = userConfig;
2370
2379
  this.normalizedConfig = rstestConfig;
@@ -2452,13 +2461,13 @@ function core_createRstest({ config, projects, configFilePath }, command, fileFi
2452
2461
  projects
2453
2462
  }, config);
2454
2463
  const runTests = async ()=>{
2455
- const { runTests } = await import("./0~173.js").then((mod)=>({
2464
+ const { runTests } = await import("./0~2173.js").then((mod)=>({
2456
2465
  runTests: mod.runTests
2457
2466
  }));
2458
2467
  await runTests(context);
2459
2468
  };
2460
2469
  const listTests = async (options)=>{
2461
- const { listTests } = await import("./0~634.js").then((mod)=>({
2470
+ const { listTests } = await import("./0~9634.js").then((mod)=>({
2462
2471
  listTests: mod.listTests
2463
2472
  }));
2464
2473
  return listTests(context, options);
@@ -1,8 +1,8 @@
1
1
  import 'module';
2
2
  /*#__PURE__*/ import.meta.url;
3
3
  import { __webpack_require__ } from "./rslib-runtime.js";
4
- import { formatTestError } from "./913.js";
5
- import "./693.js";
4
+ import { formatTestError } from "./7913.js";
5
+ import "./5693.js";
6
6
  const source_map_support = __webpack_require__("../../node_modules/.pnpm/source-map-support@0.5.21/node_modules/source-map-support/source-map-support.js");
7
7
  const picocolors = __webpack_require__("../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js");
8
8
  var picocolors_default = /*#__PURE__*/ __webpack_require__.n(picocolors);
@@ -41,13 +41,15 @@ const runGlobalSetup = async (data)=>{
41
41
  for (const entry of data.entries){
42
42
  const { distPath, testPath } = entry;
43
43
  const setupCodeContent = data.assetFiles[distPath];
44
- const { loadModule } = data.outputModule ? await import("./0~923.js").then((mod)=>({
44
+ const { loadModule } = data.outputModule ? await import("./0~6923.js").then((mod)=>({
45
45
  EsmMode: mod.loadEsModule_EsmMode,
46
46
  asModule: mod.asModule,
47
- loadModule: mod.loadModule
48
- })) : await import("./0~835.js").then((mod)=>({
47
+ loadModule: mod.loadModule,
48
+ updateLatestAssetFiles: mod.updateLatestAssetFiles
49
+ })) : await import("./0~5835.js").then((mod)=>({
49
50
  cacheableLoadModule: mod.cacheableLoadModule,
50
- loadModule: mod.loadModule
51
+ loadModule: mod.loadModule,
52
+ updateLatestAssetFiles: mod.updateLatestAssetFiles
51
53
  }));
52
54
  const module = await loadModule({
53
55
  codeContent: setupCodeContent,
package/dist/index.d.ts CHANGED
@@ -642,6 +642,7 @@ declare class DefaultReporter implements Reporter {
642
642
  protected config: NormalizedConfig;
643
643
  private options;
644
644
  protected statusRenderer: StatusRenderer | undefined;
645
+ private testState;
645
646
  constructor({ rootPath, options, config, testState, }: {
646
647
  rootPath: string;
647
648
  config: NormalizedConfig;
@@ -2577,6 +2578,8 @@ declare type RstestPoolType = 'forks';
2577
2578
  declare type RstestTestState = {
2578
2579
  getRunningModules: () => RunningModules;
2579
2580
  getTestModules: () => TestFileResult[];
2581
+ /** Get the test files paths. return `undefined` in watch mode. */
2582
+ getTestFiles: () => string[] | undefined;
2580
2583
  };
2581
2584
 
2582
2585
  export declare interface RstestUtilities {
@@ -3102,6 +3105,7 @@ declare class TestStateManager {
3102
3105
  results: TestResult[];
3103
3106
  }>;
3104
3107
  testModules: TestFileResult[];
3108
+ testFiles: string[] | undefined;
3105
3109
  onTestFileStart(testPath: string): void;
3106
3110
  onTestCaseResult(result: TestResult): void;
3107
3111
  onTestCaseStart(test: TestCaseInfo): void;
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  import 'module';
2
2
  /*#__PURE__*/ import.meta.url;
3
- export { afterAll, afterEach, assert, beforeAll, beforeEach, createRstest, defineConfig, defineProject, describe, expect, initCli, it, loadConfig, mergeProjectConfig, mergeRstestConfig, onTestFailed, onTestFinished, rs, rstest, runCLI, test } from "./131.js";
3
+ export { afterAll, afterEach, assert, beforeAll, beforeEach, createRstest, defineConfig, defineProject, describe, expect, initCli, it, loadConfig, mergeProjectConfig, mergeRstestConfig, onTestFailed, onTestFinished, rs, rstest, runCLI, test } from "./9131.js";
@@ -42,7 +42,7 @@ __webpack_require__.m = __webpack_modules__;
42
42
  })();
43
43
  (()=>{
44
44
  __webpack_require__.r = (exports)=>{
45
- if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports, Symbol.toStringTag, {
45
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports, Symbol.toStringTag, {
46
46
  value: 'Module'
47
47
  });
48
48
  Object.defineProperty(exports, '__esModule', {
package/dist/worker.d.ts CHANGED
@@ -548,6 +548,7 @@ declare class DefaultReporter implements Reporter {
548
548
  protected config: NormalizedConfig;
549
549
  private options;
550
550
  protected statusRenderer: StatusRenderer | undefined;
551
+ private testState;
551
552
  constructor({ rootPath, options, config, testState, }: {
552
553
  rootPath: string;
553
554
  config: NormalizedConfig;
@@ -2180,6 +2181,8 @@ declare type RstestPoolType = 'forks';
2180
2181
  declare type RstestTestState = {
2181
2182
  getRunningModules: () => RunningModules;
2182
2183
  getTestModules: () => TestFileResult[];
2184
+ /** Get the test files paths. return `undefined` in watch mode. */
2185
+ getTestFiles: () => string[] | undefined;
2183
2186
  };
2184
2187
 
2185
2188
  declare const runInPool: (options: RunWorkerOptions["options"]) => Promise<{
@@ -2606,6 +2609,7 @@ declare class TestStateManager {
2606
2609
  results: TestResult[];
2607
2610
  }>;
2608
2611
  testModules: TestFileResult[];
2612
+ testFiles: string[] | undefined;
2609
2613
  onTestFileStart(testPath: string): void;
2610
2614
  onTestCaseResult(result: TestResult): void;
2611
2615
  onTestCaseStart(test: TestCaseInfo): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rstest/core",
3
- "version": "0.7.5",
3
+ "version": "0.7.6",
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.0",
50
+ "@rsbuild/core": "1.7.0-beta.1",
51
51
  "tinypool": "^1.1.1"
52
52
  },
53
53
  "devDependencies": {
@@ -58,9 +58,9 @@
58
58
  "@vitest/snapshot": "^3.2.4",
59
59
  "@babel/code-frame": "^7.27.1",
60
60
  "@jridgewell/trace-mapping": "0.3.31",
61
- "@microsoft/api-extractor": "^7.53.3",
62
- "@rslib/core": "0.18.3",
63
- "@sinonjs/fake-timers": "^15.0.0",
61
+ "@microsoft/api-extractor": "^7.55.2",
62
+ "@rslib/core": "0.18.5",
63
+ "@sinonjs/fake-timers": "^15.1.0",
64
64
  "@types/babel__code-frame": "^7.0.6",
65
65
  "@types/istanbul-reports": "^3.0.4",
66
66
  "@types/istanbul-lib-coverage": "^2.0.6",
package/dist/198.js DELETED
@@ -1,4 +0,0 @@
1
- import 'module';
2
- /*#__PURE__*/ import.meta.url;
3
- import { fileURLToPath, pathToFileURL } from "node:url";
4
- export { fileURLToPath, pathToFileURL };
package/dist/881.js DELETED
@@ -1,4 +0,0 @@
1
- import 'module';
2
- /*#__PURE__*/ import.meta.url;
3
- import { createRequire, isBuiltin } from "node:module";
4
- export { createRequire, isBuiltin };
File without changes
File without changes