@rstest/core 0.8.2 → 0.8.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.
Files changed (52) hide show
  1. package/dist/0~130.js +1 -2
  2. package/dist/0~1472.js +2 -3
  3. package/dist/0~1981.js +1 -2
  4. package/dist/0~2173.js +6 -4
  5. package/dist/0~2255.js +2 -3
  6. package/dist/0~3062.js +1 -2
  7. package/dist/0~3346.js +1 -2
  8. package/dist/0~3919.js +1 -2
  9. package/dist/0~4403.js +1 -2
  10. package/dist/0~4809.js +1 -2
  11. package/dist/0~5835.js +6 -10
  12. package/dist/0~62.js +1 -2
  13. package/dist/0~6588.js +5 -5
  14. package/dist/0~6907.js +1 -2
  15. package/dist/0~6923.js +6 -10
  16. package/dist/0~7583.js +3 -4
  17. package/dist/0~7882.js +7 -8
  18. package/dist/0~8426.js +1 -2
  19. package/dist/0~89.js +212 -15
  20. package/dist/0~9348.js +1 -2
  21. package/dist/0~9634.js +5 -5
  22. package/dist/1157.js +4 -97
  23. package/dist/1294.js +1 -2
  24. package/dist/1672.js +1 -2
  25. package/dist/3160.js +106 -10
  26. package/dist/4397.js +1 -2
  27. package/dist/4484.js +1 -2
  28. package/dist/487.js +3 -4
  29. package/dist/4881.js +1 -2
  30. package/dist/4899.js +2 -2
  31. package/dist/5734.js +1 -2
  32. package/dist/6151.js +9 -2
  33. package/dist/6198.js +1 -2
  34. package/dist/6973.js +2 -3
  35. package/dist/7011.js +1 -2
  36. package/dist/721.js +1 -2
  37. package/dist/9131.js +35 -32
  38. package/dist/{3216.js → 9869.js} +20 -3
  39. package/dist/browser-runtime/389.js +9 -0
  40. package/dist/browser-runtime/389.js.LICENSE.txt +22 -0
  41. package/dist/browser-runtime/index.d.ts +27 -1
  42. package/dist/browser.d.ts +29 -1
  43. package/dist/browser.js +1 -2
  44. package/dist/globalSetupWorker.js +5 -6
  45. package/dist/index.d.ts +27 -1
  46. package/dist/index.js +1 -2
  47. package/dist/mockRuntimeCode.js +63 -174
  48. package/dist/rslib-runtime.js +1 -2
  49. package/dist/worker.d.ts +27 -1
  50. package/dist/worker.js +30 -20
  51. package/package.json +2 -2
  52. /package/dist/{1157.js.LICENSE.txt → 3160.js.LICENSE.txt} +0 -0
package/dist/0~9634.js CHANGED
@@ -1,11 +1,10 @@
1
- import 'module';
2
- /*#__PURE__*/ import.meta.url;
1
+ import "node:module";
3
2
  import { __webpack_require__ } from "./rslib-runtime.js";
4
3
  import { logger as logger_logger, getTaskNameWithPrefix, color, bgColor } from "./3160.js";
5
4
  import { prepareRsbuild, createPool, createRsbuildServer, runGlobalTeardown, runGlobalSetup } from "./0~89.js";
6
5
  import { getTestEntries, resolveShardedEntries, prettyTestPath, ROOT_SUITE_NAME } from "./1157.js";
7
- const external_node_fs_ = __webpack_require__("fs");
8
- const external_node_path_ = __webpack_require__("path");
6
+ const external_node_fs_ = __webpack_require__("node:fs");
7
+ const external_node_path_ = __webpack_require__("node:path");
9
8
  const collectNodeTests = async ({ context, nodeProjects, globTestSourceEntries })=>{
10
9
  const { getSetupFiles } = await import("./6973.js").then((mod)=>({
11
10
  getSetupFiles: mod.getSetupFiles
@@ -108,9 +107,10 @@ const collectBrowserTests = async ({ context, browserProjects, shardedEntries })
108
107
  loadBrowserModule: mod.loadBrowserModule
109
108
  }));
110
109
  const projectRoots = browserProjects.map((p)=>p.rootPath);
111
- const { listBrowserTests } = await loadBrowserModule({
110
+ const { validateBrowserConfig, listBrowserTests } = await loadBrowserModule({
112
111
  projectRoots
113
112
  });
113
+ validateBrowserConfig(context);
114
114
  return listBrowserTests(context, {
115
115
  shardedEntries
116
116
  });
package/dist/1157.js CHANGED
@@ -1,6 +1,4 @@
1
- /*! For license information please see 1157.js.LICENSE.txt */
2
- import 'module';
3
- /*#__PURE__*/ import.meta.url;
1
+ import "node:module";
4
2
  import { __webpack_require__ } from "./rslib-runtime.js";
5
3
  import promises, { lstat, readdir, realpath, stat as promises_stat } from "node:fs/promises";
6
4
  import { fileURLToPath } from "url";
@@ -1415,97 +1413,6 @@ __webpack_require__.add({
1415
1413
  };
1416
1414
  }
1417
1415
  });
1418
- /*!
1419
- * Copyright 2017 Vercel, Inc.
1420
- *
1421
- * This file is derived from Vercel's detect-agent:
1422
- * https://github.com/vercel/vercel/tree/main/packages/detect-agent
1423
- *
1424
- * Licensed under the Apache License, Version 2.0 (the "License");
1425
- * you may not use this file except in compliance with the License.
1426
- * You may obtain a copy of the License at
1427
- *
1428
- * http://www.apache.org/licenses/LICENSE-2.0
1429
- *
1430
- * Unless required by applicable law or agreed to in writing, software
1431
- * distributed under the License is distributed on an "AS IS" BASIS,
1432
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1433
- * See the License for the specific language governing permissions and
1434
- * limitations under the License.
1435
- *
1436
- * Modifications in this derived work:
1437
- * - Removed async determine logic, kept only env detection.
1438
- */ const CURSOR = 'cursor';
1439
- const CURSOR_CLI = 'cursor-cli';
1440
- const CLAUDE = 'claude';
1441
- const REPLIT = 'replit';
1442
- const GEMINI = 'gemini';
1443
- const CODEX = 'codex';
1444
- const AUGMENT_CLI = 'augment-cli';
1445
- const OPENCODE = 'opencode';
1446
- function determineAgent() {
1447
- if (process.env.AI_AGENT) {
1448
- const name = process.env.AI_AGENT.trim();
1449
- if (name) return {
1450
- isAgent: true,
1451
- agent: {
1452
- name: name
1453
- }
1454
- };
1455
- }
1456
- if (process.env.CURSOR_TRACE_ID) return {
1457
- isAgent: true,
1458
- agent: {
1459
- name: CURSOR
1460
- }
1461
- };
1462
- if (process.env.CURSOR_AGENT) return {
1463
- isAgent: true,
1464
- agent: {
1465
- name: CURSOR_CLI
1466
- }
1467
- };
1468
- if (process.env.GEMINI_CLI) return {
1469
- isAgent: true,
1470
- agent: {
1471
- name: GEMINI
1472
- }
1473
- };
1474
- if (process.env.CODEX_SANDBOX) return {
1475
- isAgent: true,
1476
- agent: {
1477
- name: CODEX
1478
- }
1479
- };
1480
- if (process.env.AUGMENT_AGENT) return {
1481
- isAgent: true,
1482
- agent: {
1483
- name: AUGMENT_CLI
1484
- }
1485
- };
1486
- if (process.env.OPENCODE) return {
1487
- isAgent: true,
1488
- agent: {
1489
- name: OPENCODE
1490
- }
1491
- };
1492
- if (process.env.CLAUDECODE || process.env.CLAUDE_CODE) return {
1493
- isAgent: true,
1494
- agent: {
1495
- name: CLAUDE
1496
- }
1497
- };
1498
- if (process.env.REPL_ID) return {
1499
- isAgent: true,
1500
- agent: {
1501
- name: REPLIT
1502
- }
1503
- };
1504
- return {
1505
- isAgent: false,
1506
- agent: void 0
1507
- };
1508
- }
1509
1416
  const DEFAULT_CONFIG_NAME = 'rstest.config';
1510
1417
  const ROOT_SUITE_NAME = 'Rstest:_internal_root_suite';
1511
1418
  const TEMP_RSTEST_OUTPUT_DIR = 'dist/.rstest-temp';
@@ -1534,8 +1441,8 @@ const globalApis = [
1534
1441
  'onTestFailed'
1535
1442
  ];
1536
1443
  const TS_CONFIG_FILE = 'tsconfig.json';
1537
- const external_node_path_ = __webpack_require__("path");
1538
- const external_node_fs_ = __webpack_require__("fs");
1444
+ const external_node_path_ = __webpack_require__("node:path");
1445
+ const external_node_fs_ = __webpack_require__("node:fs");
1539
1446
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
1540
1447
  function cleanPath(path) {
1541
1448
  let normalized = (0, external_node_path_.normalize)(path);
@@ -2410,4 +2317,4 @@ async function resolveShardedEntries(context) {
2410
2317
  });
2411
2318
  return entriesCache;
2412
2319
  }
2413
- export { DEFAULT_CONFIG_EXTENSIONS, DEFAULT_CONFIG_NAME, ROOT_SUITE_NAME, TEMP_RSTEST_OUTPUT_DIR, TEMP_RSTEST_OUTPUT_DIR_GLOB, TS_CONFIG_FILE, determineAgent, filterProjects, formatTestEntryName, formatTestPath, getTestEntries, glob, globalApis, isDynamicPattern, lstat, prettyTestPath, promises, promises_stat, readdir, realpath, resolveShardedEntries };
2320
+ export { DEFAULT_CONFIG_EXTENSIONS, DEFAULT_CONFIG_NAME, ROOT_SUITE_NAME, TEMP_RSTEST_OUTPUT_DIR, TEMP_RSTEST_OUTPUT_DIR_GLOB, TS_CONFIG_FILE, filterProjects, formatTestEntryName, formatTestPath, getTestEntries, glob, globalApis, isDynamicPattern, lstat, prettyTestPath, promises, promises_stat, readdir, realpath, resolveShardedEntries };
package/dist/1294.js CHANGED
@@ -1,6 +1,5 @@
1
1
  /*! For license information please see 1294.js.LICENSE.txt */
2
- import 'module';
3
- /*#__PURE__*/ import.meta.url;
2
+ import "node:module";
4
3
  import { __webpack_require__ } from "./rslib-runtime.js";
5
4
  import "./3160.js";
6
5
  __webpack_require__.add({
package/dist/1672.js CHANGED
@@ -1,5 +1,4 @@
1
- import 'module';
2
- /*#__PURE__*/ import.meta.url;
1
+ import "node:module";
3
2
  var UNKNOWN_FUNCTION = '<unknown>';
4
3
  function parse(stackString) {
5
4
  var lines = stackString.split('\n');
package/dist/3160.js CHANGED
@@ -1,5 +1,5 @@
1
- import 'module';
2
- /*#__PURE__*/ import.meta.url;
1
+ /*! For license information please see 3160.js.LICENSE.txt */
2
+ import "node:module";
3
3
  import * as __rspack_external_node_fs_5ea92f0c from "node:fs";
4
4
  import * as __rspack_external_node_os_74b4b876 from "node:os";
5
5
  import * as __rspack_external_node_path_c5b9b54f from "node:path";
@@ -73,13 +73,13 @@ __webpack_require__.add({
73
73
  module.exports = createColors();
74
74
  module.exports.createColors = createColors;
75
75
  },
76
- fs (module) {
76
+ "node:fs" (module) {
77
77
  module.exports = __rspack_external_node_fs_5ea92f0c;
78
78
  },
79
79
  "node:os" (module) {
80
80
  module.exports = __rspack_external_node_os_74b4b876;
81
81
  },
82
- path (module) {
82
+ "node:path" (module) {
83
83
  module.exports = __rspack_external_node_path_c5b9b54f;
84
84
  },
85
85
  "node:tty" (module) {
@@ -347,6 +347,101 @@ let createLogger = (options = {})=>{
347
347
  return logger;
348
348
  };
349
349
  let src_logger = createLogger();
350
+ /*!
351
+ * Copyright 2017 Vercel, Inc.
352
+ *
353
+ * This file is derived from Vercel's detect-agent:
354
+ * https://github.com/vercel/vercel/tree/main/packages/detect-agent
355
+ *
356
+ * Licensed under the Apache License, Version 2.0 (the "License");
357
+ * you may not use this file except in compliance with the License.
358
+ * You may obtain a copy of the License at
359
+ *
360
+ * http://www.apache.org/licenses/LICENSE-2.0
361
+ *
362
+ * Unless required by applicable law or agreed to in writing, software
363
+ * distributed under the License is distributed on an "AS IS" BASIS,
364
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
365
+ * See the License for the specific language governing permissions and
366
+ * limitations under the License.
367
+ *
368
+ * Modifications in this derived work:
369
+ * - Removed async determine logic, kept only env detection.
370
+ */ const CURSOR = 'cursor';
371
+ const CURSOR_CLI = 'cursor-cli';
372
+ const CLAUDE = 'claude';
373
+ const REPLIT = 'replit';
374
+ const GEMINI = 'gemini';
375
+ const CODEX = 'codex';
376
+ const AUGMENT_CLI = 'augment-cli';
377
+ const OPENCODE = 'opencode';
378
+ function determineAgent() {
379
+ if ('1' === process.env.RSTEST_NO_AGENT) return {
380
+ isAgent: false,
381
+ agent: void 0
382
+ };
383
+ if (process.env.AI_AGENT) {
384
+ const name = process.env.AI_AGENT.trim();
385
+ if (name) return {
386
+ isAgent: true,
387
+ agent: {
388
+ name: name
389
+ }
390
+ };
391
+ }
392
+ if (process.env.CURSOR_TRACE_ID) return {
393
+ isAgent: true,
394
+ agent: {
395
+ name: CURSOR
396
+ }
397
+ };
398
+ if (process.env.CURSOR_AGENT) return {
399
+ isAgent: true,
400
+ agent: {
401
+ name: CURSOR_CLI
402
+ }
403
+ };
404
+ if (process.env.GEMINI_CLI) return {
405
+ isAgent: true,
406
+ agent: {
407
+ name: GEMINI
408
+ }
409
+ };
410
+ if (process.env.CODEX_SANDBOX) return {
411
+ isAgent: true,
412
+ agent: {
413
+ name: CODEX
414
+ }
415
+ };
416
+ if (process.env.AUGMENT_AGENT) return {
417
+ isAgent: true,
418
+ agent: {
419
+ name: AUGMENT_CLI
420
+ }
421
+ };
422
+ if (process.env.OPENCODE) return {
423
+ isAgent: true,
424
+ agent: {
425
+ name: OPENCODE
426
+ }
427
+ };
428
+ if (process.env.CLAUDECODE || process.env.CLAUDE_CODE) return {
429
+ isAgent: true,
430
+ agent: {
431
+ name: CLAUDE
432
+ }
433
+ };
434
+ if (process.env.REPL_ID) return {
435
+ isAgent: true,
436
+ agent: {
437
+ name: REPLIT
438
+ }
439
+ };
440
+ return {
441
+ isAgent: false,
442
+ agent: void 0
443
+ };
444
+ }
350
445
  let _lazyMatch = ()=>{
351
446
  var __lib__ = (()=>{
352
447
  var m = Object.defineProperty, V = Object.getOwnPropertyDescriptor, G = Object.getOwnPropertyNames, T = Object.prototype.hasOwnProperty, q = (r, e)=>{
@@ -915,12 +1010,13 @@ const isDebug = ()=>{
915
1010
  '*'
916
1011
  ].some((key)=>values.includes(key));
917
1012
  };
918
- const ansiEnabled = picocolors.isColorSupported;
919
1013
  const getForceColorEnv = ()=>{
920
- const shouldForceColor = isTTY('stdout') && ansiEnabled && void 0 === process.env.NO_COLOR && void 0 === process.env.FORCE_COLOR;
921
- return shouldForceColor ? {
922
- FORCE_COLOR: '1'
923
- } : {};
1014
+ const userSetColorEnv = void 0 !== process.env.FORCE_COLOR || void 0 !== process.env.NO_COLOR;
1015
+ if (determineAgent().isAgent && !userSetColorEnv) return {
1016
+ NO_COLOR: '1',
1017
+ FORCE_COLOR: '0'
1018
+ };
1019
+ return {};
924
1020
  };
925
1021
  const color = (0, picocolors.createColors)();
926
1022
  if (isDebug()) src_logger.level = 'verbose';
@@ -948,4 +1044,4 @@ const logger_logger = {
948
1044
  console.error(message, ...args);
949
1045
  }
950
1046
  };
951
- export { ADDITIONAL_NODE_BUILTINS, _path, ansiEnabled, basename, bgColor, castArray, clearScreen, color, dirname, formatError, formatRootStr, getAbsolutePath, getForceColorEnv, getTaskNameWithPrefix, isAbsolute, isDebug, isDeno, isObject, isTTY, join, logger_logger as logger, needFlagExperimentalDetectModule, node_process, normalize, parsePosix, prettyTime, relative, resolve, serializableConfig, stdin, stdout, undoSerializableConfig };
1047
+ export { ADDITIONAL_NODE_BUILTINS, _path, basename, bgColor, castArray, clearScreen, color, determineAgent, dirname, formatError, formatRootStr, getAbsolutePath, getForceColorEnv, getTaskNameWithPrefix, isAbsolute, isDebug, isDeno, isObject, isTTY, join, logger_logger as logger, needFlagExperimentalDetectModule, node_process, normalize, parsePosix, prettyTime, relative, resolve, serializableConfig, stdin, stdout, undoSerializableConfig };
package/dist/4397.js CHANGED
@@ -1,5 +1,4 @@
1
- import 'module';
2
- /*#__PURE__*/ import.meta.url;
1
+ import "node:module";
3
2
  var comma = ",".charCodeAt(0);
4
3
  var semicolon = ";".charCodeAt(0);
5
4
  var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
package/dist/4484.js CHANGED
@@ -1,5 +1,4 @@
1
- import 'module';
2
- /*#__PURE__*/ import.meta.url;
1
+ import "node:module";
3
2
  import * as __rspack_external__rsbuild_core_1b356efc from "@rsbuild/core";
4
3
  const check = (name)=>{
5
4
  if (!globalThis.RSTEST_API?.[name]) throw new Error(`Rstest API '${name}' is not registered yet, please make sure you are running in a rstest environment.`);
package/dist/487.js CHANGED
@@ -1,5 +1,4 @@
1
- import 'module';
2
- /*#__PURE__*/ import.meta.url;
1
+ import "node:module";
3
2
  import { __webpack_require__ } from "./rslib-runtime.js";
4
3
  import "./3160.js";
5
4
  __webpack_require__.add({
@@ -36,10 +35,10 @@ __webpack_require__.add({
36
35
  "../../node_modules/.pnpm/source-map-support@0.5.21/node_modules/source-map-support/source-map-support.js" (module, exports, __webpack_require__) {
37
36
  module = __webpack_require__.nmd(module);
38
37
  var SourceMapConsumer = __webpack_require__("../../node_modules/.pnpm/source-map@0.6.1/node_modules/source-map/source-map.js").SourceMapConsumer;
39
- var path = __webpack_require__("path");
38
+ var path = __webpack_require__("node:path");
40
39
  var fs;
41
40
  try {
42
- fs = __webpack_require__("fs");
41
+ fs = __webpack_require__("node:fs");
43
42
  if (!fs.existsSync || !fs.readFileSync) fs = null;
44
43
  } catch (err) {}
45
44
  var bufferFrom = __webpack_require__("../../node_modules/.pnpm/buffer-from@1.1.2/node_modules/buffer-from/index.js");
package/dist/4881.js CHANGED
@@ -1,3 +1,2 @@
1
- import 'module';
2
- /*#__PURE__*/ import.meta.url;
1
+ import "node:module";
3
2
  export { createRequire, isBuiltin } from "node:module";
package/dist/4899.js CHANGED
@@ -1,5 +1,5 @@
1
- import __rslib_shim_module__ from 'module';
2
- const require = /*#__PURE__*/ __rslib_shim_module__.createRequire(import.meta.url);
1
+ import __rslib_shim_module__ from "node:module";
2
+ const require = /*#__PURE__*/ __rslib_shim_module__.createRequire(/*#__PURE__*/ (()=>import.meta.url)());
3
3
  import { __webpack_require__ } from "./rslib-runtime.js";
4
4
  __webpack_require__.add({
5
5
  timers (module) {
package/dist/5734.js CHANGED
@@ -1,5 +1,4 @@
1
- import 'module';
2
- /*#__PURE__*/ import.meta.url;
1
+ import "node:module";
3
2
  import { createRequire } from "./4881.js";
4
3
  import { pathToFileURL } from "./6198.js";
5
4
  import "./1157.js";
package/dist/6151.js CHANGED
@@ -1,6 +1,5 @@
1
1
  /*! For license information please see 6151.js.LICENSE.txt */
2
- import 'module';
3
- /*#__PURE__*/ import.meta.url;
2
+ import "node:module";
4
3
  import { __webpack_require__ } from "./rslib-runtime.js";
5
4
  import { getTaskNameWithPrefix, isObject as helper_isObject, castArray, resolve as pathe_M_eThtNZ_resolve, normalize } from "./3160.js";
6
5
  import { getRealTimers, TestRegisterError, formatTestError, formatName } from "./1294.js";
@@ -13474,6 +13473,14 @@ const initSpy = ()=>{
13474
13473
  }, defaultName, mockFn);
13475
13474
  };
13476
13475
  const spyOn = (obj, methodName, accessType)=>{
13476
+ if (accessType) {
13477
+ const descriptor = Object.getOwnPropertyDescriptor(obj, methodName);
13478
+ const accessor = 'get' === accessType ? Reflect.get(descriptor ?? {}, 'get') : Reflect.get(descriptor ?? {}, 'set');
13479
+ if ('function' == typeof accessor && spy_isMockFunction(accessor)) return accessor;
13480
+ } else {
13481
+ const method = obj[methodName];
13482
+ if (spy_isMockFunction(method)) return method;
13483
+ }
13477
13484
  const accessTypeMap = {
13478
13485
  get: 'getter',
13479
13486
  set: 'setter'
package/dist/6198.js CHANGED
@@ -1,3 +1,2 @@
1
- import 'module';
2
- /*#__PURE__*/ import.meta.url;
1
+ import "node:module";
3
2
  export { fileURLToPath, pathToFileURL } from "node:url";
package/dist/6973.js CHANGED
@@ -1,12 +1,11 @@
1
- import 'module';
2
- /*#__PURE__*/ import.meta.url;
1
+ import "node:module";
3
2
  import { __webpack_require__ } from "./rslib-runtime.js";
4
3
  import { getAbsolutePath, color } from "./3160.js";
5
4
  import { fileURLToPath } from "./6198.js";
6
5
  import { rsbuild as __rspack_external__rsbuild_core_1b356efc } from "./4484.js";
7
6
  import { formatTestEntryName } from "./1157.js";
8
7
  import { posix } from "./7011.js";
9
- const external_node_fs_ = __webpack_require__("fs");
8
+ const external_node_fs_ = __webpack_require__("node:fs");
10
9
  const tryResolve = (request, rootPath)=>{
11
10
  const { resolver } = __rspack_external__rsbuild_core_1b356efc.rspack.experiments;
12
11
  const esmFirstResolver = new resolver.ResolverFactory({
package/dist/7011.js CHANGED
@@ -1,5 +1,4 @@
1
- import 'module';
2
- /*#__PURE__*/ import.meta.url;
1
+ import "node:module";
3
2
  import { _path } from "./3160.js";
4
3
  const delimiter = /* @__PURE__ */ (()=>globalThis.process?.platform === "win32" ? ";" : ":")();
5
4
  const _platforms = {
package/dist/721.js CHANGED
@@ -1,5 +1,4 @@
1
- import 'module';
2
- /*#__PURE__*/ import.meta.url;
1
+ import "node:module";
3
2
  import * as __rspack_external_node_util_1b29d436 from "node:util";
4
3
  import { __webpack_require__ } from "./rslib-runtime.js";
5
4
  __webpack_require__.add({
package/dist/9131.js CHANGED
@@ -1,10 +1,9 @@
1
- import 'module';
2
- /*#__PURE__*/ import.meta.url;
1
+ import "node:module";
3
2
  import { __webpack_require__ } from "./rslib-runtime.js";
4
3
  import { EventEmitter } from "events";
5
- import { basename, isTTY, dirname as pathe_M_eThtNZ_dirname, resolve as pathe_M_eThtNZ_resolve, node_process, relative, getAbsolutePath, join, bgColor, formatRootStr, logger as logger_logger, castArray, prettyTime, isDebug, color, isAbsolute, getTaskNameWithPrefix, normalize, formatError } from "./3160.js";
4
+ import { basename, isTTY, dirname as pathe_M_eThtNZ_dirname, resolve as pathe_M_eThtNZ_resolve, node_process, relative, getAbsolutePath, join, bgColor, formatRootStr, determineAgent, logger as logger_logger, castArray, prettyTime, isDebug, color, isAbsolute, getTaskNameWithPrefix, normalize, formatError } from "./3160.js";
6
5
  import "./721.js";
7
- import { isDynamicPattern, glob, DEFAULT_CONFIG_NAME, prettyTestPath, globalApis, promises, TEMP_RSTEST_OUTPUT_DIR_GLOB, formatTestPath, filterProjects, DEFAULT_CONFIG_EXTENSIONS, TS_CONFIG_FILE, determineAgent } from "./1157.js";
6
+ import { isDynamicPattern, glob, DEFAULT_CONFIG_NAME, prettyTestPath, globalApis, promises, TEMP_RSTEST_OUTPUT_DIR_GLOB, formatTestPath, filterProjects, DEFAULT_CONFIG_EXTENSIONS, TS_CONFIG_FILE } from "./1157.js";
8
7
  import { rsbuild as __rspack_external__rsbuild_core_1b356efc } from "./4484.js";
9
8
  import { posix } from "./7011.js";
10
9
  import { parse as stack_trace_parser_esm_parse } from "./1672.js";
@@ -505,7 +504,7 @@ function prepareCli() {
505
504
  if (!npm_execpath || npm_execpath.includes('npx-cli.js') || npm_execpath.includes('.bun')) logger_logger.log();
506
505
  }
507
506
  function showRstest() {
508
- logger_logger.greet(" Rstest v0.8.2");
507
+ logger_logger.greet(" Rstest v0.8.4");
509
508
  logger_logger.log('');
510
509
  }
511
510
  const applyCommonOptions = (cli)=>{
@@ -563,7 +562,7 @@ const runRest = async ({ options, filters, command })=>{
563
562
  function setupCommands() {
564
563
  const cli = dist('rstest');
565
564
  cli.help();
566
- cli.version("0.8.2");
565
+ cli.version("0.8.4");
567
566
  applyCommonOptions(cli);
568
567
  cli.command('[...filters]', 'run tests').option('-w, --watch', 'Run tests in watch mode').action(async (filters, options)=>{
569
568
  if (!determineAgent().isAgent) showRstest();
@@ -988,7 +987,7 @@ function G() {
988
987
  }
989
988
  const P = G();
990
989
  P?.name;
991
- const external_node_fs_ = __webpack_require__("fs");
990
+ const external_node_fs_ = __webpack_require__("node:fs");
992
991
  const findConfig = (basePath)=>DEFAULT_CONFIG_EXTENSIONS.map((ext)=>basePath + ext).find(external_node_fs_["default"].existsSync);
993
992
  const resolveConfigPath = (root, customConfig)=>{
994
993
  if (customConfig) {
@@ -1135,13 +1134,6 @@ const createDefaultConfig = ()=>({
1135
1134
  }
1136
1135
  });
1137
1136
  const withDefaultConfig = (config)=>{
1138
- if (config.browser?.enabled === true) {
1139
- if (!config.browser.provider) throw new Error('browser.provider is required when browser.enabled is true.');
1140
- const supportedProviders = [
1141
- 'playwright'
1142
- ];
1143
- if (!supportedProviders.includes(config.browser.provider)) throw new Error(`browser.provider must be one of: ${supportedProviders.join(', ')}.`);
1144
- }
1145
1137
  const merged = mergeRstestConfig(createDefaultConfig(), config);
1146
1138
  merged.setupFiles = castArray(merged.setupFiles);
1147
1139
  merged.globalSetup = castArray(merged.globalSetup);
@@ -1160,7 +1152,8 @@ const withDefaultConfig = (config)=>{
1160
1152
  browser: merged.browser?.browser ?? 'chromium',
1161
1153
  headless: merged.browser?.headless ?? T,
1162
1154
  port: merged.browser?.port,
1163
- strictPort: merged.browser?.strictPort ?? false
1155
+ strictPort: merged.browser?.strictPort ?? false,
1156
+ viewport: merged.browser?.viewport
1164
1157
  };
1165
1158
  return {
1166
1159
  ...merged,
@@ -1754,35 +1747,36 @@ const logFileTitle = (test, relativePath, alwaysShowTime = false, showProjectNam
1754
1747
  class DefaultReporter {
1755
1748
  rootPath;
1756
1749
  config;
1750
+ projectConfigs;
1757
1751
  options = {};
1758
1752
  statusRenderer;
1759
1753
  testState;
1760
- constructor({ rootPath, options, config, testState }){
1754
+ constructor({ rootPath, options, config, testState, projectConfigs }){
1761
1755
  this.rootPath = rootPath;
1762
1756
  this.config = config;
1757
+ this.projectConfigs = projectConfigs ?? new Map();
1763
1758
  this.options = options;
1764
1759
  this.testState = testState;
1765
- }
1766
- ensureStatusRenderer() {
1767
- if (this.statusRenderer) return;
1768
- if (isTTY() || this.options.logger) this.statusRenderer = new StatusRenderer(this.rootPath, this.testState, this.options.logger);
1760
+ if (isTTY() || options.logger) this.statusRenderer = new StatusRenderer(rootPath, testState, options.logger);
1769
1761
  }
1770
1762
  onTestFileStart() {
1771
- this.ensureStatusRenderer();
1772
1763
  this.statusRenderer?.onTestFileStart();
1773
1764
  }
1774
1765
  onTestFileResult(test) {
1775
1766
  this.statusRenderer?.onTestFileResult();
1776
- if (this.config.hideSkippedTestFiles && 'skip' === test.status) return;
1767
+ const projectConfig = this.projectConfigs.get(test.project);
1768
+ const hideSkippedTestFiles = projectConfig?.hideSkippedTestFiles ?? this.config.hideSkippedTestFiles;
1769
+ if (hideSkippedTestFiles && 'skip' === test.status) return;
1777
1770
  const relativePath = relative(this.rootPath, test.testPath);
1778
- const { slowTestThreshold } = this.config;
1771
+ const slowTestThreshold = projectConfig?.slowTestThreshold ?? this.config.slowTestThreshold;
1779
1772
  logFileTitle(test, relativePath, false, this.options.showProjectName);
1780
1773
  const showAllCases = this.testState.getTestFiles()?.length === 1;
1774
+ const hideSkippedTests = projectConfig?.hideSkippedTests ?? this.config.hideSkippedTests;
1781
1775
  for (const result of test.results){
1782
1776
  const isDisplayed = showAllCases || 'fail' === result.status || (result.duration ?? 0) > slowTestThreshold || (result.retryCount ?? 0) > 0;
1783
1777
  isDisplayed && logCase(result, {
1784
1778
  slowTestThreshold,
1785
- hideSkippedTests: this.config.hideSkippedTests
1779
+ hideSkippedTests
1786
1780
  });
1787
1781
  }
1788
1782
  }
@@ -2197,7 +2191,7 @@ function traceSegmentInternal(segments, memo, line, column, bias) {
2197
2191
  if (-1 === index || index === segments.length) return -1;
2198
2192
  return index;
2199
2193
  }
2200
- const external_node_path_ = __webpack_require__("path");
2194
+ const external_node_path_ = __webpack_require__("node:path");
2201
2195
  const isRelativePath = (p)=>/^\.\.?\//.test(p);
2202
2196
  const hintNotDefinedError = (message)=>{
2203
2197
  const [, varName] = message.match(/(\w+) is not defined/) || [];
@@ -3458,7 +3452,7 @@ class MdReporter {
3458
3452
  }
3459
3453
  renderFrontMatter(lines) {
3460
3454
  const frontMatter = {
3461
- tool: "@rstest/core@0.8.2",
3455
+ tool: "@rstest/core@0.8.4",
3462
3456
  timestamp: new Date().toISOString()
3463
3457
  };
3464
3458
  if (this.options.header.env) frontMatter.runtime = {
@@ -3694,7 +3688,7 @@ class MdReporter {
3694
3688
  }
3695
3689
  class VerboseReporter extends DefaultReporter {
3696
3690
  verboseOptions = {};
3697
- constructor({ rootPath, options, config, testState }){
3691
+ constructor({ rootPath, options, config, testState, projectConfigs }){
3698
3692
  super({
3699
3693
  rootPath,
3700
3694
  options: {
@@ -3702,19 +3696,23 @@ class VerboseReporter extends DefaultReporter {
3702
3696
  summary: true
3703
3697
  },
3704
3698
  config,
3705
- testState
3699
+ testState,
3700
+ projectConfigs
3706
3701
  });
3707
3702
  this.verboseOptions = options;
3708
3703
  }
3709
3704
  onTestFileResult(test) {
3710
3705
  this.statusRenderer?.onTestFileResult();
3711
- if (this.config.hideSkippedTestFiles && 'skip' === test.status) return;
3706
+ const projectConfig = this.projectConfigs.get(test.project);
3707
+ const hideSkippedTestFiles = projectConfig?.hideSkippedTestFiles ?? this.config.hideSkippedTestFiles;
3708
+ if (hideSkippedTestFiles && 'skip' === test.status) return;
3712
3709
  const relativePath = relative(this.rootPath, test.testPath);
3713
- const { slowTestThreshold } = this.config;
3710
+ const slowTestThreshold = projectConfig?.slowTestThreshold ?? this.config.slowTestThreshold;
3711
+ const hideSkippedTests = projectConfig?.hideSkippedTests ?? this.config.hideSkippedTests;
3714
3712
  logFileTitle(test, relativePath, true, this.verboseOptions.showProjectName);
3715
3713
  for (const result of test.results)logCase(result, {
3716
3714
  slowTestThreshold,
3717
- hideSkippedTests: this.config.hideSkippedTests
3715
+ hideSkippedTests
3718
3716
  });
3719
3717
  }
3720
3718
  }
@@ -3824,7 +3822,7 @@ class Rstest {
3824
3822
  updateSnapshot: rstestConfig.update ? 'all' : T ? 'none' : 'new'
3825
3823
  });
3826
3824
  this.snapshotManager = snapshotManager;
3827
- this.version = "0.8.2";
3825
+ this.version = "0.8.4";
3828
3826
  this.rootPath = rootPath;
3829
3827
  this.originalConfig = userConfig;
3830
3828
  this.normalizedConfig = rstestConfig;
@@ -3864,11 +3862,16 @@ class Rstest {
3864
3862
  normalizedConfig: rstestConfig
3865
3863
  }
3866
3864
  ];
3865
+ const projectConfigs = new Map(this.projects.map((p)=>[
3866
+ p.name,
3867
+ p.normalizedConfig
3868
+ ]));
3867
3869
  const reporters = 'list' !== command ? createReporters(rstestConfig.reporters, {
3868
3870
  rootPath,
3869
3871
  config: rstestConfig,
3870
3872
  testState: this.testState,
3871
3873
  fileFilters: this.fileFilters,
3874
+ projectConfigs,
3872
3875
  options: {
3873
3876
  showProjectName: projects.length > 1
3874
3877
  }
@@ -1,5 +1,22 @@
1
- import 'module';
2
- /*#__PURE__*/ import.meta.url;
1
+ import "node:module";
2
+ const WORKER_META_MESSAGE_TYPE = 'rstest:worker-meta';
3
+ const WORKER_META_MESSAGE_VERSION = 1;
4
+ const WORKER_META_MESSAGE_NAMESPACE = 'rstest';
5
+ const isRecord = (value)=>'object' == typeof value && null !== value;
6
+ const createWorkerMetaMessage = (pid)=>({
7
+ __rstest_internal__: WORKER_META_MESSAGE_NAMESPACE,
8
+ payload: {
9
+ pid
10
+ },
11
+ type: WORKER_META_MESSAGE_TYPE,
12
+ version: WORKER_META_MESSAGE_VERSION
13
+ });
14
+ const parseWorkerMetaMessage = (message)=>{
15
+ if (!isRecord(message)) return;
16
+ if (message.__rstest_internal__ === WORKER_META_MESSAGE_NAMESPACE && message.type === WORKER_META_MESSAGE_TYPE && message.version === WORKER_META_MESSAGE_VERSION && isRecord(message.payload) && 'number' == typeof message.payload.pid) return {
17
+ pid: message.payload.pid
18
+ };
19
+ };
3
20
  const TYPE_REQUEST = "q";
4
21
  const TYPE_RESPONSE = "s";
5
22
  const DEFAULT_TIMEOUT = 6e4;
@@ -206,4 +223,4 @@ function nanoid(size = 21) {
206
223
  return id;
207
224
  }
208
225
  export { default as node_v8 } from "node:v8";
209
- export { createBirpc };
226
+ export { createBirpc, createWorkerMetaMessage, parseWorkerMetaMessage };