pi-lean-dimension 0.2.4 → 0.3.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.
Files changed (159) hide show
  1. package/README.md +1 -1
  2. package/node_modules/pi-lean-portal/AGENTS.md +15 -23
  3. package/node_modules/pi-lean-portal/README.md +35 -7
  4. package/node_modules/pi-lean-portal/__tests__/browser-toggle-profile.test.ts +12 -1
  5. package/node_modules/pi-lean-portal/__tests__/browser-toggle.test.ts +263 -1126
  6. package/node_modules/pi-lean-portal/__tests__/fetch-backend.test.ts +6 -32
  7. package/node_modules/pi-lean-portal/__tests__/helpers/mock-python-bridge.py +1 -1
  8. package/node_modules/pi-lean-portal/__tests__/helpers/probe-user-backend.ts +1 -2
  9. package/node_modules/pi-lean-portal/__tests__/helpers/setup-temp-dir.ts +26 -0
  10. package/node_modules/pi-lean-portal/__tests__/plugin-config-browser.test.ts +1 -1
  11. package/node_modules/pi-lean-portal/__tests__/plugin-contract.test.ts +1 -1
  12. package/node_modules/pi-lean-portal/__tests__/plugin-loading.test.ts +1 -1
  13. package/node_modules/pi-lean-portal/__tests__/probe-user-backend.test.ts +1 -1
  14. package/node_modules/pi-lean-portal/__tests__/python-adapter.test.ts +65 -69
  15. package/node_modules/pi-lean-portal/__tests__/router-dispatch.test.ts +1 -14
  16. package/node_modules/pi-lean-portal/__tests__/run-contributed-suites.test.ts +31 -16
  17. package/node_modules/pi-lean-portal/__tests__/snapshot-cache.test.ts +1 -1
  18. package/node_modules/pi-lean-portal/__tests__/web-guides.test.ts +146 -19
  19. package/node_modules/pi-lean-portal/backends/playwright-base/playwright-plugin.ts +1 -1
  20. package/node_modules/pi-lean-portal/backends/python-adapter.ts +3 -3
  21. package/node_modules/pi-lean-portal/backends/python-base/pi_browser_bridge/__init__.py +2 -4
  22. package/node_modules/pi-lean-portal/backends/python-base/pi_browser_bridge/__pycache__/__init__.cpython-312.pyc +0 -0
  23. package/node_modules/pi-lean-portal/backends/python-base/pi_browser_bridge/__pycache__/__init__.cpython-313.pyc +0 -0
  24. package/node_modules/pi-lean-portal/backends/python-base/pi_browser_bridge/__pycache__/playwright_base.cpython-312.pyc +0 -0
  25. package/node_modules/pi-lean-portal/backends/python-base/pi_browser_bridge/__pycache__/playwright_base.cpython-313.pyc +0 -0
  26. package/node_modules/pi-lean-portal/backends/python-base/pi_browser_bridge/playwright_base.py +572 -81
  27. package/node_modules/pi-lean-portal/backends/python-base/tests/__pycache__/test_playwright_base_quirks.cpython-313-pytest-9.1.1.pyc +0 -0
  28. package/node_modules/pi-lean-portal/backends/python-base/tests/test_playwright_base_quirks.py +13 -43
  29. package/node_modules/pi-lean-portal/browser-profile.ts +2 -3
  30. package/node_modules/pi-lean-portal/browser-toggle.ts +168 -385
  31. package/node_modules/pi-lean-portal/contributed/CHOOSING.md +2 -2
  32. package/node_modules/pi-lean-portal/contributed/README.md +65 -6
  33. package/node_modules/pi-lean-portal/contributed/camoufox-py/__pycache__/bridge.cpython-312.pyc +0 -0
  34. package/node_modules/pi-lean-portal/contributed/camoufox-py/bridge.py +108 -14
  35. package/node_modules/pi-lean-portal/contributed/camoufox-py/pin.json +4 -0
  36. package/node_modules/pi-lean-portal/core/fetch-backend.ts +10 -30
  37. package/node_modules/pi-lean-portal/core/guides.ts +14 -18
  38. package/node_modules/pi-lean-portal/core/router.ts +2 -20
  39. package/node_modules/pi-lean-portal/core/shared/bot-detection.ts +19 -30
  40. package/node_modules/pi-lean-portal/core/shared/browser-data.ts +4 -4
  41. package/node_modules/pi-lean-portal/core/shared/nav-settle.ts +2 -2
  42. package/node_modules/pi-lean-portal/core/shared/paths.ts +16 -2
  43. package/node_modules/pi-lean-portal/core/shared/settings-reader.ts +2 -7
  44. package/node_modules/pi-lean-portal/core/shared/snapshot-cache.ts +1 -1
  45. package/node_modules/pi-lean-portal/index.ts +8 -1
  46. package/node_modules/pi-lean-portal/package.json +2 -1
  47. package/node_modules/pi-lean-portal/tools/web-learn.ts +1 -4
  48. package/node_modules/pi-lean-search/__tests__/web-search.test.ts +87 -0
  49. package/node_modules/pi-lean-search/index.ts +134 -64
  50. package/node_modules/pi-lean-search/package.json +2 -1
  51. package/node_modules/playwright/README.md +3 -3
  52. package/node_modules/playwright/lib/agents/copilot-setup-steps.yml +2 -2
  53. package/node_modules/playwright/lib/cli/reportActions.js +2 -2
  54. package/node_modules/playwright/lib/common/index.js +77 -52
  55. package/node_modules/playwright/lib/common/index.js.txt +10 -11
  56. package/node_modules/playwright/lib/errorContext.js +2 -3
  57. package/node_modules/playwright/lib/index.js +30 -8
  58. package/node_modules/playwright/lib/matchers/expect.js +4811 -4379
  59. package/node_modules/playwright/lib/matchers/expect.js.LICENSE +87 -140
  60. package/node_modules/playwright/lib/matchers/expect.js.txt +30 -35
  61. package/node_modules/playwright/lib/program.js +19 -0
  62. package/node_modules/playwright/lib/runner/index.js +309 -153
  63. package/node_modules/playwright/lib/runner/index.js.txt +13 -12
  64. package/node_modules/playwright/lib/transform/babelBundle.js +12899 -11654
  65. package/node_modules/playwright/lib/transform/babelBundle.js.LICENSE +379 -354
  66. package/node_modules/playwright/lib/transform/babelBundle.js.txt +39 -39
  67. package/node_modules/playwright/lib/transform/esmLoader.js +3129 -1116
  68. package/node_modules/playwright/lib/transform/esmLoader.js.LICENSE +81 -61
  69. package/node_modules/playwright/lib/transform/esmLoader.js.txt +21 -18
  70. package/node_modules/playwright/lib/util.js +2 -29
  71. package/node_modules/playwright/lib/worker/workerProcessEntry.js +14 -32
  72. package/node_modules/playwright/lib/worker/workerProcessEntry.js.txt +7 -8
  73. package/node_modules/playwright/package.json +3 -6
  74. package/node_modules/playwright/types/test.d.ts +391 -4
  75. package/node_modules/playwright/types/testReporter.d.ts +79 -4
  76. package/node_modules/playwright-core/browsers.json +12 -18
  77. package/node_modules/playwright-core/lib/bootstrap.js +1 -1
  78. package/node_modules/playwright-core/lib/coreBundle.js +11344 -9900
  79. package/node_modules/playwright-core/lib/server/electron/loader.js +5 -2
  80. package/node_modules/playwright-core/lib/serverRegistry.js +5 -1
  81. package/node_modules/playwright-core/lib/tools/cli-client/help.json +21 -6
  82. package/node_modules/playwright-core/lib/tools/cli-client/program.js +1 -1
  83. package/node_modules/playwright-core/lib/tools/cli-client/session.js +4 -0
  84. package/node_modules/playwright-core/lib/tools/{cli-client/skill → skills/playwright-cli}/SKILL.md +21 -5
  85. package/node_modules/playwright-core/lib/tools/{cli-client/skill/references/spec-driven-testing.md → skills/playwright-cli/references/test-generation.md} +135 -7
  86. package/node_modules/playwright-core/lib/tools/skills/playwright-component-testing/SKILL.md +143 -0
  87. package/node_modules/playwright-core/lib/tools/skills/playwright-component-testing/references/gallery-spec.md +144 -0
  88. package/node_modules/playwright-core/lib/tools/skills/playwright-component-testing/references/migration.md +85 -0
  89. package/node_modules/playwright-core/lib/tools/skills/playwright-component-testing/references/react.md +67 -0
  90. package/node_modules/playwright-core/lib/tools/skills/playwright-component-testing/references/vue.md +75 -0
  91. package/node_modules/playwright-core/lib/tools/utils/extension.js +31 -8
  92. package/node_modules/playwright-core/lib/utilsBundle.js +37698 -33670
  93. package/node_modules/playwright-core/lib/utilsBundle.js.LICENSE +391 -268
  94. package/node_modules/playwright-core/lib/vite/dashboard/assets/index-CyWAfh-p.js +11 -0
  95. package/node_modules/playwright-core/lib/vite/dashboard/assets/index-DhC616m4.css +1 -0
  96. package/node_modules/playwright-core/lib/vite/dashboard/index.html +2 -2
  97. package/node_modules/playwright-core/lib/vite/htmlReport/report.css +2 -1
  98. package/node_modules/playwright-core/lib/vite/htmlReport/report.js +15 -55
  99. package/node_modules/playwright-core/lib/vite/recorder/assets/codeMirrorModule--QdMvsKi.css +1 -0
  100. package/node_modules/playwright-core/lib/vite/recorder/assets/codeMirrorModule-CwYYHbcZ.js +32 -0
  101. package/node_modules/playwright-core/lib/vite/recorder/assets/index-DYjdXIbE.js +129 -0
  102. package/node_modules/playwright-core/lib/vite/recorder/assets/index-l_lX622x.css +1 -0
  103. package/node_modules/playwright-core/lib/vite/recorder/index.html +2 -2
  104. package/node_modules/playwright-core/lib/vite/traceViewer/assets/codeMirrorModule-By56iMx7.js +32 -0
  105. package/node_modules/playwright-core/lib/vite/traceViewer/assets/defaultSettingsView-B34OrIms.js +181 -0
  106. package/node_modules/playwright-core/lib/vite/traceViewer/assets/urlMatch-L3liM589.js +1 -0
  107. package/node_modules/playwright-core/lib/vite/traceViewer/assets/xtermModule-COQkjINf.js +7 -0
  108. package/node_modules/playwright-core/lib/vite/traceViewer/codeMirrorModule.-QdMvsKi.css +1 -0
  109. package/node_modules/playwright-core/lib/vite/traceViewer/defaultSettingsView.BLFoOugd.css +1 -0
  110. package/node_modules/playwright-core/lib/vite/traceViewer/index.B_TqY17P.css +1 -0
  111. package/node_modules/playwright-core/lib/vite/traceViewer/index.Dl36UVQT.js +1 -0
  112. package/node_modules/playwright-core/lib/vite/traceViewer/index.html +5 -5
  113. package/node_modules/playwright-core/lib/vite/traceViewer/snapshot.B_Jk1wbt.js +1 -0
  114. package/node_modules/playwright-core/lib/vite/traceViewer/snapshot.html +2 -2
  115. package/node_modules/playwright-core/lib/vite/traceViewer/sw.bundle.js +3 -4
  116. package/node_modules/playwright-core/lib/vite/traceViewer/uiMode.C7UW1sC9.css +1 -0
  117. package/node_modules/playwright-core/lib/vite/traceViewer/uiMode.D962mr9b.js +5 -0
  118. package/node_modules/playwright-core/lib/vite/traceViewer/uiMode.html +5 -5
  119. package/node_modules/playwright-core/lib/vite/traceViewer/xtermModule.kHJ-D0s7.css +1 -0
  120. package/node_modules/playwright-core/lib/webp_codec.LICENSE +173 -0
  121. package/node_modules/playwright-core/lib/webp_codec.wasm +0 -0
  122. package/node_modules/playwright-core/lib/xdg-open +338 -137
  123. package/node_modules/playwright-core/package.json +2 -2
  124. package/node_modules/playwright-core/types/protocol.d.ts +249 -36
  125. package/node_modules/playwright-core/types/structs.d.ts +3 -1
  126. package/node_modules/playwright-core/types/types.d.ts +2009 -266
  127. package/package.json +3 -3
  128. package/node_modules/pi-lean-portal/__tests__/url-safety.test.ts +0 -188
  129. package/node_modules/pi-lean-portal/backends/python-base/pi_browser_bridge/bridge.py +0 -525
  130. package/node_modules/pi-lean-portal/core/shared/url-safety.ts +0 -164
  131. package/node_modules/playwright-core/lib/server/deviceDescriptorsSource.json +0 -2739
  132. package/node_modules/playwright-core/lib/tools/cli-client/skill/references/test-generation.md +0 -134
  133. package/node_modules/playwright-core/lib/vite/dashboard/assets/index-BY2S1tHT.css +0 -1
  134. package/node_modules/playwright-core/lib/vite/dashboard/assets/index-C_5TMfeg.js +0 -52
  135. package/node_modules/playwright-core/lib/vite/recorder/assets/codeMirrorModule-DYBRYzYX.css +0 -1
  136. package/node_modules/playwright-core/lib/vite/recorder/assets/codeMirrorModule-DeBYQozu.js +0 -32
  137. package/node_modules/playwright-core/lib/vite/recorder/assets/index-4ZiSSCmn.css +0 -1
  138. package/node_modules/playwright-core/lib/vite/recorder/assets/index-Bq-mQf8S.js +0 -193
  139. package/node_modules/playwright-core/lib/vite/traceViewer/assets/codeMirrorModule-LEHpjmcn.js +0 -32
  140. package/node_modules/playwright-core/lib/vite/traceViewer/assets/defaultSettingsView-BNmKHKpQ.js +0 -264
  141. package/node_modules/playwright-core/lib/vite/traceViewer/assets/urlMatch-BYQrIQwR.js +0 -1
  142. package/node_modules/playwright-core/lib/vite/traceViewer/assets/xtermModule-CsJ4vdCR.js +0 -9
  143. package/node_modules/playwright-core/lib/vite/traceViewer/codeMirrorModule.DYBRYzYX.css +0 -1
  144. package/node_modules/playwright-core/lib/vite/traceViewer/defaultSettingsView.CjdS-WJx.css +0 -1
  145. package/node_modules/playwright-core/lib/vite/traceViewer/index.CzXZzn5A.css +0 -1
  146. package/node_modules/playwright-core/lib/vite/traceViewer/index.DMMX1gXU.js +0 -2
  147. package/node_modules/playwright-core/lib/vite/traceViewer/snapshot.v8KI4P3m.js +0 -2
  148. package/node_modules/playwright-core/lib/vite/traceViewer/uiMode.BZQ54Kgt.css +0 -1
  149. package/node_modules/playwright-core/lib/vite/traceViewer/uiMode.Ut8wwJNp.js +0 -6
  150. package/node_modules/playwright-core/lib/vite/traceViewer/xtermModule.DYP7pi_n.css +0 -32
  151. /package/node_modules/playwright-core/lib/tools/{cli-client/skill → skills/playwright-cli}/references/element-attributes.md +0 -0
  152. /package/node_modules/playwright-core/lib/tools/{cli-client/skill → skills/playwright-cli}/references/playwright-tests.md +0 -0
  153. /package/node_modules/playwright-core/lib/tools/{cli-client/skill → skills/playwright-cli}/references/request-mocking.md +0 -0
  154. /package/node_modules/playwright-core/lib/tools/{cli-client/skill → skills/playwright-cli}/references/running-code.md +0 -0
  155. /package/node_modules/playwright-core/lib/tools/{cli-client/skill → skills/playwright-cli}/references/session-management.md +0 -0
  156. /package/node_modules/playwright-core/lib/tools/{cli-client/skill → skills/playwright-cli}/references/storage-state.md +0 -0
  157. /package/node_modules/playwright-core/lib/tools/{cli-client/skill → skills/playwright-cli}/references/tracing.md +0 -0
  158. /package/node_modules/playwright-core/lib/tools/{cli-client/skill → skills/playwright-cli}/references/video-recording.md +0 -0
  159. /package/node_modules/playwright-core/lib/tools/{trace → skills/playwright-trace}/SKILL.md +0 -0
@@ -56,7 +56,7 @@ var import_events2 = __toESM(require("events"));
56
56
  var import_fs13 = __toESM(require("fs"));
57
57
  var import_path17 = __toESM(require("path"));
58
58
  var import_coreBundle2 = require("playwright-core/lib/coreBundle");
59
- var import_common9 = require("../common");
59
+ var import_common10 = require("../common");
60
60
 
61
61
  // packages/playwright/src/runner/fsWatcher.ts
62
62
  var chokidar = require("playwright-core/lib/utilsBundle").chokidar;
@@ -432,6 +432,18 @@ var TeleSuite = class {
432
432
  suite.parent = this;
433
433
  this._entries.push(suite);
434
434
  }
435
+ skip(_reason) {
436
+ throw new Error("Disposition methods are not supported on a TeleSuite (read-only).");
437
+ }
438
+ fixme(_reason) {
439
+ throw new Error("Disposition methods are not supported on a TeleSuite (read-only).");
440
+ }
441
+ fail(_reason) {
442
+ throw new Error("Disposition methods are not supported on a TeleSuite (read-only).");
443
+ }
444
+ exclude() {
445
+ throw new Error("Disposition methods are not supported on a TeleSuite (read-only).");
446
+ }
435
447
  };
436
448
  var TeleTestCase = class {
437
449
  constructor(id, title, location, repeatEachIndex) {
@@ -467,6 +479,18 @@ var TeleTestCase = class {
467
479
  this.results.push(result);
468
480
  return result;
469
481
  }
482
+ skip(_reason) {
483
+ throw new Error("Disposition methods are not supported on a TeleTestCase (read-only).");
484
+ }
485
+ fixme(_reason) {
486
+ throw new Error("Disposition methods are not supported on a TeleTestCase (read-only).");
487
+ }
488
+ fail(_reason) {
489
+ throw new Error("Disposition methods are not supported on a TeleTestCase (read-only).");
490
+ }
491
+ exclude() {
492
+ throw new Error("Disposition methods are not supported on a TeleTestCase (read-only).");
493
+ }
470
494
  };
471
495
  var TeleTestStep = class {
472
496
  constructor(payload, parentStep, location, result) {
@@ -1011,10 +1035,10 @@ var import_util2 = require("../util");
1011
1035
  var realColors = require("playwright-core/lib/utilsBundle").colors;
1012
1036
  var { noColors } = require("playwright-core/lib/coreBundle").iso;
1013
1037
  var { msToString } = require("playwright-core/lib/coreBundle").iso;
1014
- var { parseErrorStack } = require("playwright-core/lib/coreBundle").iso;
1038
+ var { parseErrorStack } = require("playwright-core/lib/coreBundle").utils;
1015
1039
  var { getPackageManagerExecCommand } = require("playwright-core/lib/coreBundle").utils;
1016
1040
  var { fitToWidth } = require("playwright-core/lib/coreBundle").utils;
1017
- var kOutputSymbol = Symbol("output");
1041
+ var kOutputSymbol = /* @__PURE__ */ Symbol("output");
1018
1042
  var DEFAULT_TTY_WIDTH = 100;
1019
1043
  var DEFAULT_TTY_HEIGHT = 40;
1020
1044
  var originalProcessStdout = process.stdout;
@@ -1024,8 +1048,9 @@ var StripAnsiStream = class extends import_stream.Writable {
1024
1048
  super();
1025
1049
  this._target = target;
1026
1050
  }
1027
- _write(chunk, encoding, callback) {
1028
- this._target.write((0, import_util2.stripAnsiEscapes)(chunk.toString()), callback);
1051
+ write(chunk, encodingOrCallback, callback) {
1052
+ const cb = typeof encodingOrCallback === "function" ? encodingOrCallback : callback;
1053
+ return this._target.write((0, import_util2.stripAnsiEscapes)(chunk.toString()), cb);
1029
1054
  }
1030
1055
  };
1031
1056
  var terminalScreen = (() => {
@@ -1373,7 +1398,7 @@ function quotePathIfNeeded(path20) {
1373
1398
  return `"${path20}"`;
1374
1399
  return path20;
1375
1400
  }
1376
- var kReportedSymbol = Symbol("reported");
1401
+ var kReportedSymbol = /* @__PURE__ */ Symbol("reported");
1377
1402
  function markErrorsAsReported(result) {
1378
1403
  result[kReportedSymbol] = result.errors.length;
1379
1404
  }
@@ -1482,7 +1507,7 @@ function indent(lines, tab) {
1482
1507
  return lines.replace(/^(?=.+$)/gm, tab);
1483
1508
  }
1484
1509
  function prepareErrorStack(stack) {
1485
- return parseErrorStack(stack, import_path2.default.sep, !!process.env.PWDEBUGIMPL);
1510
+ return parseErrorStack(stack);
1486
1511
  }
1487
1512
  function resolveFromEnv(name) {
1488
1513
  const value = process.env[name];
@@ -1546,52 +1571,61 @@ function groupAttachments(attachments) {
1546
1571
  var import_fs = __toESM(require("fs"));
1547
1572
 
1548
1573
  // packages/playwright/src/reporters/multiplexer.ts
1574
+ var import_util3 = require("../util");
1549
1575
  var Multiplexer = class {
1550
1576
  constructor(reporters) {
1577
+ this._hasReporterErrors = false;
1551
1578
  this._reporters = reporters;
1552
1579
  }
1553
1580
  version() {
1554
1581
  return "v2";
1555
1582
  }
1583
+ hasReporterErrors() {
1584
+ return this._hasReporterErrors;
1585
+ }
1556
1586
  onConfigure(config2) {
1557
1587
  for (const reporter of this._reporters)
1558
- wrap(() => reporter.onConfigure?.(config2));
1588
+ this._wrap(() => reporter.onConfigure?.(config2));
1589
+ }
1590
+ async preprocess(params) {
1591
+ for (const reporter of this._reporters)
1592
+ await reporter.preprocess?.(params);
1559
1593
  }
1560
1594
  onBegin(suite) {
1561
1595
  for (const reporter of this._reporters)
1562
- wrap(() => reporter.onBegin?.(suite));
1596
+ this._wrap(() => reporter.onBegin?.(suite));
1563
1597
  }
1564
1598
  onTestBegin(test, result) {
1565
1599
  for (const reporter of this._reporters)
1566
- wrap(() => reporter.onTestBegin?.(test, result));
1600
+ this._wrap(() => reporter.onTestBegin?.(test, result));
1567
1601
  }
1568
1602
  onStdOut(chunk, test, result) {
1569
1603
  for (const reporter of this._reporters)
1570
- wrap(() => reporter.onStdOut?.(chunk, test, result));
1604
+ this._wrap(() => reporter.onStdOut?.(chunk, test, result));
1571
1605
  }
1572
1606
  onStdErr(chunk, test, result) {
1573
1607
  for (const reporter of this._reporters)
1574
- wrap(() => reporter.onStdErr?.(chunk, test, result));
1608
+ this._wrap(() => reporter.onStdErr?.(chunk, test, result));
1575
1609
  }
1576
1610
  async onTestPaused(test, result) {
1577
1611
  for (const reporter of this._reporters)
1578
- await wrapAsync(() => reporter.onTestPaused?.(test, result));
1612
+ await this._wrapAsync(() => reporter.onTestPaused?.(test, result));
1579
1613
  }
1580
1614
  onTestEnd(test, result) {
1581
1615
  for (const reporter of this._reporters)
1582
- wrap(() => reporter.onTestEnd?.(test, result));
1616
+ this._wrap(() => reporter.onTestEnd?.(test, result));
1583
1617
  }
1584
1618
  onReportConfigure(params) {
1585
1619
  for (const reporter of this._reporters)
1586
- wrap(() => reporter.onReportConfigure?.(params));
1620
+ this._wrap(() => reporter.onReportConfigure?.(params));
1587
1621
  }
1588
1622
  onReportEnd(params) {
1589
1623
  for (const reporter of this._reporters)
1590
- wrap(() => reporter.onReportEnd?.(params));
1624
+ this._wrap(() => reporter.onReportEnd?.(params));
1591
1625
  }
1592
1626
  async onEnd(result) {
1593
1627
  for (const reporter of this._reporters) {
1594
- const outResult = await wrapAsync(() => reporter.onEnd?.(result));
1628
+ const outResult = await this._wrapAsync(() => reporter.onEnd?.(result));
1595
1629
  if (outResult?.status)
1596
1630
  result.status = outResult.status;
1597
1631
  }
@@ -1599,42 +1633,45 @@ var Multiplexer = class {
1599
1633
  }
1600
1634
  async onExit() {
1601
1635
  for (const reporter of this._reporters)
1602
- await wrapAsync(() => reporter.onExit?.());
1636
+ await this._wrapAsync(() => reporter.onExit?.());
1603
1637
  }
1604
1638
  onError(error, workerInfo) {
1605
1639
  for (const reporter of this._reporters)
1606
- wrap(() => reporter.onError?.(error, workerInfo));
1640
+ this._wrap(() => reporter.onError?.(error, workerInfo), false);
1607
1641
  }
1608
1642
  onStepBegin(test, result, step) {
1609
1643
  for (const reporter of this._reporters)
1610
- wrap(() => reporter.onStepBegin?.(test, result, step));
1644
+ this._wrap(() => reporter.onStepBegin?.(test, result, step));
1611
1645
  }
1612
1646
  onStepEnd(test, result, step) {
1613
1647
  for (const reporter of this._reporters)
1614
- wrap(() => reporter.onStepEnd?.(test, result, step));
1648
+ this._wrap(() => reporter.onStepEnd?.(test, result, step));
1615
1649
  }
1616
1650
  printsToStdio() {
1617
1651
  return this._reporters.some((r) => {
1618
1652
  let prints = false;
1619
- wrap(() => prints = r.printsToStdio ? r.printsToStdio() : true);
1653
+ this._wrap(() => prints = r.printsToStdio ? r.printsToStdio() : true, false);
1620
1654
  return prints;
1621
1655
  });
1622
1656
  }
1623
- };
1624
- async function wrapAsync(callback) {
1625
- try {
1626
- return await callback();
1627
- } catch (e) {
1628
- console.error("Error in reporter", e);
1657
+ _wrap(callback, redispatch = true) {
1658
+ try {
1659
+ callback();
1660
+ } catch (e) {
1661
+ this._hasReporterErrors = true;
1662
+ if (redispatch)
1663
+ this.onError((0, import_util3.serializeError)(e));
1664
+ }
1629
1665
  }
1630
- }
1631
- function wrap(callback) {
1632
- try {
1633
- callback();
1634
- } catch (e) {
1635
- console.error("Error in reporter", e);
1666
+ async _wrapAsync(callback) {
1667
+ try {
1668
+ return await callback();
1669
+ } catch (e) {
1670
+ this._hasReporterErrors = true;
1671
+ this.onError((0, import_util3.serializeError)(e));
1672
+ }
1636
1673
  }
1637
- }
1674
+ };
1638
1675
 
1639
1676
  // packages/playwright/src/reporters/internalReporter.ts
1640
1677
  var import_common = require("../common");
@@ -1660,6 +1697,9 @@ var ReporterV2Wrapper = class {
1660
1697
  onConfigure(config2) {
1661
1698
  this._config = config2;
1662
1699
  }
1700
+ preprocess(params) {
1701
+ return this._reporter.preprocess?.(params);
1702
+ }
1663
1703
  onBegin(suite) {
1664
1704
  this._reporter.onBegin?.(this._config, suite);
1665
1705
  const deferred = this._deferred;
@@ -1727,12 +1767,18 @@ var InternalReporter = class {
1727
1767
  version() {
1728
1768
  return "v2";
1729
1769
  }
1770
+ hasReporterErrors() {
1771
+ return this._reporter.hasReporterErrors();
1772
+ }
1730
1773
  onConfigure(config2) {
1731
1774
  this._config = config2;
1732
1775
  this._startTime = /* @__PURE__ */ new Date();
1733
1776
  this._monotonicStartTime = monotonicTime3();
1734
1777
  this._reporter.onConfigure?.(config2);
1735
1778
  }
1779
+ async preprocess(params) {
1780
+ await this._reporter.preprocess(params);
1781
+ }
1736
1782
  onBegin(suite) {
1737
1783
  this._didBegin = true;
1738
1784
  this._reporter.onBegin?.(suite);
@@ -1779,7 +1825,7 @@ var InternalReporter = class {
1779
1825
  this._reporter.onStepEnd?.(test, result, step);
1780
1826
  }
1781
1827
  printsToStdio() {
1782
- return this._reporter.printsToStdio ? this._reporter.printsToStdio() : true;
1828
+ return this._reporter.printsToStdio?.() ?? true;
1783
1829
  }
1784
1830
  _addSnippetToTestErrors(test, result) {
1785
1831
  for (const error of result.errors)
@@ -1813,7 +1859,7 @@ function addLocationAndSnippetToError(config2, error, file) {
1813
1859
  }
1814
1860
 
1815
1861
  // packages/playwright/src/runner/testRunner.ts
1816
- var import_util14 = require("../util");
1862
+ var import_util15 = require("../util");
1817
1863
 
1818
1864
  // packages/playwright/src/runner/reporters.ts
1819
1865
  var reporters_exports = {};
@@ -2040,7 +2086,7 @@ var OutOfProcessLoaderHost = class {
2040
2086
  };
2041
2087
 
2042
2088
  // packages/playwright/src/runner/loadUtils.ts
2043
- var import_util5 = require("../util");
2089
+ var import_util6 = require("../util");
2044
2090
 
2045
2091
  // packages/playwright/src/runner/projectUtils.ts
2046
2092
  var projectUtils_exports = {};
@@ -2054,12 +2100,12 @@ __export(projectUtils_exports, {
2054
2100
  });
2055
2101
  var import_fs2 = __toESM(require("fs"));
2056
2102
  var import_path3 = __toESM(require("path"));
2057
- var import_util3 = require("util");
2058
- var import_util4 = require("../util");
2059
- var minimatch = require("playwright-core/lib/utilsBundle").minimatch;
2103
+ var import_util4 = require("util");
2104
+ var import_util5 = require("../util");
2105
+ var { minimatch } = require("playwright-core/lib/utilsBundle");
2060
2106
  var { escapeRegExp } = require("playwright-core/lib/coreBundle").iso;
2061
- var readFileAsync = (0, import_util3.promisify)(import_fs2.default.readFile);
2062
- var readDirAsync = (0, import_util3.promisify)(import_fs2.default.readdir);
2107
+ var readFileAsync = (0, import_util4.promisify)(import_fs2.default.readFile);
2108
+ var readDirAsync = (0, import_util4.promisify)(import_fs2.default.readdir);
2063
2109
  function wildcardPatternToRegExp(pattern) {
2064
2110
  return new RegExp("^" + pattern.split("*").map(escapeRegExp).join(".*") + "$", "ig");
2065
2111
  }
@@ -2164,8 +2210,8 @@ async function collectFilesForProject(project, fsCache = /* @__PURE__ */ new Map
2164
2210
  const extensions = /* @__PURE__ */ new Set([".js", ".ts", ".mjs", ".mts", ".cjs", ".cts", ".jsx", ".tsx", ".mjsx", ".mtsx", ".cjsx", ".ctsx"]);
2165
2211
  const testFileExtension = (file) => extensions.has(import_path3.default.extname(file));
2166
2212
  const allFiles = await cachedCollectFiles(project.project.testDir, project.respectGitIgnore, fsCache);
2167
- const testMatch = (0, import_util4.createFileMatcher)(project.project.testMatch);
2168
- const testIgnore = (0, import_util4.createFileMatcher)(project.project.testIgnore);
2213
+ const testMatch = (0, import_util5.createFileMatcher)(project.project.testMatch);
2214
+ const testIgnore = (0, import_util5.createFileMatcher)(project.project.testIgnore);
2169
2215
  const testFiles = allFiles.filter((file) => {
2170
2216
  if (!testFileExtension(file))
2171
2217
  return false;
@@ -2247,6 +2293,65 @@ async function collectFiles(testDir, respectGitIgnore) {
2247
2293
  return files;
2248
2294
  }
2249
2295
 
2296
+ // packages/playwright/src/runner/reporterTestRun.ts
2297
+ var import_common3 = require("../common");
2298
+ var ReporterTestRunImpl = class {
2299
+ constructor(_rootSuite, _readonlyProjectSuites) {
2300
+ this._rootSuite = _rootSuite;
2301
+ this._readonlyProjectSuites = _readonlyProjectSuites;
2302
+ this._active = true;
2303
+ this._skipSharding = false;
2304
+ this.skip = import_common3.transform.wrapFunctionWithLocation((location, target, reason) => this._modifier("skip", location, target, reason));
2305
+ this.fixme = import_common3.transform.wrapFunctionWithLocation((location, target, reason) => this._modifier("fixme", location, target, reason));
2306
+ this.fail = import_common3.transform.wrapFunctionWithLocation((location, target, reason) => this._modifier("fail", location, target, reason));
2307
+ }
2308
+ close() {
2309
+ this._active = false;
2310
+ }
2311
+ shouldSkipSharding() {
2312
+ return this._skipSharding;
2313
+ }
2314
+ skipSharding() {
2315
+ if (!this._active)
2316
+ throw new Error(`TestRun.skipSharding() can only be called from Reporter.preprocess().`);
2317
+ if (this._skipSharding)
2318
+ throw new Error(`Multiple reporters called 'skipSharding'. Only one reporter may handle sharding.`);
2319
+ this._skipSharding = true;
2320
+ }
2321
+ exclude(target) {
2322
+ if (!this._active)
2323
+ throw new Error(`TestRun.exclude() can only be called from Reporter.preprocess().`);
2324
+ const internalTarget = target;
2325
+ this._checkTarget("exclude", internalTarget);
2326
+ internalTarget.parent._detach(internalTarget);
2327
+ }
2328
+ _modifier(type, location, _target, reason) {
2329
+ if (!this._active)
2330
+ throw new Error(`TestRun.${type}() can only be called from Reporter.preprocess().`);
2331
+ const target = _target;
2332
+ this._checkTarget(type, target);
2333
+ const annotation = { type, description: reason, location };
2334
+ if (target instanceof import_common3.test.Suite) {
2335
+ for (const test of target.allTests())
2336
+ test._applyPlanAnnotation(annotation);
2337
+ } else {
2338
+ target._applyPlanAnnotation(annotation);
2339
+ }
2340
+ }
2341
+ _checkTarget(method, target) {
2342
+ if (target === this._rootSuite)
2343
+ throw new Error(`TestRun.${method}() cannot be called on the root suite.`);
2344
+ let suite = target instanceof import_common3.test.Suite ? target : target.parent;
2345
+ while (suite) {
2346
+ if (this._readonlyProjectSuites.has(suite)) {
2347
+ const targetType = target instanceof import_common3.test.TestCase ? " test" : "";
2348
+ throw new Error(`TestRun.${method}() cannot be called on a setup or teardown project${targetType}; these always run in full.`);
2349
+ }
2350
+ suite = suite.parent;
2351
+ }
2352
+ }
2353
+ };
2354
+
2250
2355
  // packages/playwright/src/runner/testGroups.ts
2251
2356
  function createTestGroups(projectSuite, expectedParallelism) {
2252
2357
  const groups = /* @__PURE__ */ new Map();
@@ -2346,7 +2451,7 @@ function filterForShard(shard, weights, testGroups) {
2346
2451
  }
2347
2452
 
2348
2453
  // packages/playwright/src/runner/loadUtils.ts
2349
- var import_common3 = require("../common");
2454
+ var import_common4 = require("../common");
2350
2455
  var sourceMapSupport = require("playwright-core/lib/utilsBundle").sourceMapSupport;
2351
2456
  var { toPosixPath } = require("playwright-core/lib/coreBundle").utils;
2352
2457
  async function collectProjectsAndTestFiles(testRun, doNotRunTestsOutsideProjectFilter) {
@@ -2399,7 +2504,7 @@ async function loadFileSuites(testRun, mode, errors) {
2399
2504
  await loaderHost.stop();
2400
2505
  }
2401
2506
  for (const file of allTestFiles) {
2402
- for (const dependency of import_common3.cc.dependenciesForTestFile(file)) {
2507
+ for (const dependency of import_common4.cc.dependenciesForTestFile(file)) {
2403
2508
  if (allTestFiles.has(dependency)) {
2404
2509
  const importer = import_path4.default.relative(config2.config.rootDir, file);
2405
2510
  const importee = import_path4.default.relative(config2.config.rootDir, dependency);
@@ -2417,7 +2522,7 @@ async function loadFileSuites(testRun, mode, errors) {
2417
2522
  }
2418
2523
  async function createRootSuite(testRun, errors, shouldFilterOnly) {
2419
2524
  const config2 = testRun.config;
2420
- const rootSuite = new import_common3.test.Suite("", "root");
2525
+ const rootSuite = new import_common4.test.Suite("", "root");
2421
2526
  const projectSuites = /* @__PURE__ */ new Map();
2422
2527
  const filteredProjectSuites = /* @__PURE__ */ new Map();
2423
2528
  {
@@ -2429,10 +2534,10 @@ async function createRootSuite(testRun, errors, shouldFilterOnly) {
2429
2534
  }
2430
2535
  }
2431
2536
  if (shouldFilterOnly) {
2432
- const filteredRoot = new import_common3.test.Suite("", "root");
2537
+ const filteredRoot = new import_common4.test.Suite("", "root");
2433
2538
  for (const filteredProjectSuite of filteredProjectSuites.values())
2434
2539
  filteredRoot._addSuite(filteredProjectSuite);
2435
- import_common3.suiteUtils.filterOnly(filteredRoot);
2540
+ import_common4.suiteUtils.filterOnly(filteredRoot);
2436
2541
  for (const [project, filteredProjectSuite] of filteredProjectSuites) {
2437
2542
  if (!filteredRoot.suites.includes(filteredProjectSuite))
2438
2543
  filteredProjectSuites.delete(project);
@@ -2452,7 +2557,24 @@ async function createRootSuite(testRun, errors, shouldFilterOnly) {
2452
2557
  errors.push(...createForbidOnlyErrors(onlyTestsAndSuites, config2.configCLIOverrides.forbidOnly, configFilePath));
2453
2558
  }
2454
2559
  }
2455
- if (config2.config.shard) {
2560
+ const dependencySuites = /* @__PURE__ */ new Map();
2561
+ for (const [project, type] of projectClosure) {
2562
+ if (type !== "dependency")
2563
+ continue;
2564
+ const dependencySuite = buildProjectSuite(project, projectSuites.get(project));
2565
+ dependencySuites.set(project, dependencySuite);
2566
+ rootSuite._prependSuite(dependencySuite);
2567
+ }
2568
+ const reporterTestRun = new ReporterTestRunImpl(rootSuite, new Set(dependencySuites.values()));
2569
+ await testRun.reporter.preprocess({
2570
+ config: config2.config,
2571
+ suite: rootSuite,
2572
+ testRun: reporterTestRun
2573
+ });
2574
+ reporterTestRun.close();
2575
+ for (const dependencySuite of dependencySuites.values())
2576
+ rootSuite._detach(dependencySuite);
2577
+ if (config2.config.shard && !reporterTestRun.shouldSkipSharding()) {
2456
2578
  const testGroups = [];
2457
2579
  for (const projectSuite of rootSuite.suites) {
2458
2580
  for (const group of createTestGroups(projectSuite, config2.config.shard.total))
@@ -2464,30 +2586,31 @@ async function createRootSuite(testRun, errors, shouldFilterOnly) {
2464
2586
  for (const test of group.tests)
2465
2587
  testsInThisShard.add(test);
2466
2588
  }
2467
- import_common3.suiteUtils.filterTestsRemoveEmptySuites(rootSuite, (test) => testsInThisShard.has(test));
2589
+ import_common4.suiteUtils.filterTestsRemoveEmptySuites(rootSuite, (test) => testsInThisShard.has(test));
2468
2590
  }
2469
2591
  if (testRun.postShardTestFilters.length)
2470
- import_common3.suiteUtils.filterTestsRemoveEmptySuites(rootSuite, (test) => testRun.postShardTestFilters.every((filter) => filter(test)));
2592
+ import_common4.suiteUtils.filterTestsRemoveEmptySuites(rootSuite, (test) => testRun.postShardTestFilters.every((filter) => filter(test)));
2471
2593
  const topLevelProjects = [];
2472
2594
  {
2473
- const projectClosure2 = new Map(buildProjectsClosure(rootSuite.suites.map((suite) => suite._fullProject)));
2474
- for (const [project, level] of projectClosure2.entries()) {
2475
- if (level === "dependency")
2476
- rootSuite._prependSuite(buildProjectSuite(project, projectSuites.get(project)));
2595
+ const finalProjectClosure = buildProjectsClosure(rootSuite.suites.map((suite) => suite._fullProject));
2596
+ for (const [project, type] of finalProjectClosure) {
2597
+ if (type === "dependency")
2598
+ rootSuite._addSuite(dependencySuites.get(project));
2477
2599
  else
2478
2600
  topLevelProjects.push(project);
2479
2601
  }
2480
2602
  }
2603
+ rootSuite._entries.sort((a, b) => config2.projects.indexOf(a._fullProject) - config2.projects.indexOf(b._fullProject));
2481
2604
  testRun.rootSuite = rootSuite;
2482
2605
  testRun.topLevelProjects = topLevelProjects;
2483
2606
  }
2484
2607
  function createProjectSuite(project, fileSuites) {
2485
- const projectSuite = new import_common3.test.Suite(project.project.name, "project");
2608
+ const projectSuite = new import_common4.test.Suite(project.project.name, "project");
2486
2609
  for (const fileSuite of fileSuites)
2487
- projectSuite._addSuite(import_common3.suiteUtils.bindFileSuiteToProject(project, fileSuite));
2488
- const grepMatcher = (0, import_util5.createTitleMatcher)(project.project.grep);
2489
- const grepInvertMatcher = project.project.grepInvert ? (0, import_util5.createTitleMatcher)(project.project.grepInvert) : null;
2490
- import_common3.suiteUtils.filterTestsRemoveEmptySuites(projectSuite, (test) => {
2610
+ projectSuite._addSuite(import_common4.suiteUtils.bindFileSuiteToProject(project, fileSuite));
2611
+ const grepMatcher = (0, import_util6.createTitleMatcher)(project.project.grep);
2612
+ const grepInvertMatcher = project.project.grepInvert ? (0, import_util6.createTitleMatcher)(project.project.grepInvert) : null;
2613
+ import_common4.suiteUtils.filterTestsRemoveEmptySuites(projectSuite, (test) => {
2491
2614
  const grepTitle = test._grepTitleWithTags();
2492
2615
  if (grepInvertMatcher?.(grepTitle))
2493
2616
  return false;
@@ -2499,11 +2622,11 @@ function filterProjectSuite(projectSuite, testFilters) {
2499
2622
  if (!testFilters.length)
2500
2623
  return projectSuite;
2501
2624
  const result = projectSuite._deepClone();
2502
- import_common3.suiteUtils.filterTestsRemoveEmptySuites(result, (test) => testFilters.every((filter) => filter(test)));
2625
+ import_common4.suiteUtils.filterTestsRemoveEmptySuites(result, (test) => testFilters.every((filter) => filter(test)));
2503
2626
  return result;
2504
2627
  }
2505
2628
  function buildProjectSuite(project, projectSuite) {
2506
- const result = new import_common3.test.Suite(project.project.name, "project");
2629
+ const result = new import_common4.test.Suite(project.project.name, "project");
2507
2630
  result._fullProject = project;
2508
2631
  if (project.fullyParallel)
2509
2632
  result._parallelMode = "parallel";
@@ -2511,7 +2634,7 @@ function buildProjectSuite(project, projectSuite) {
2511
2634
  result._addSuite(fileSuite);
2512
2635
  for (let repeatEachIndex = 1; repeatEachIndex < project.project.repeatEach; repeatEachIndex++) {
2513
2636
  const clone = fileSuite._deepClone();
2514
- import_common3.suiteUtils.applyRepeatEachIndex(project, clone, repeatEachIndex);
2637
+ import_common4.suiteUtils.applyRepeatEachIndex(project, clone, repeatEachIndex);
2515
2638
  result._addSuite(clone);
2516
2639
  }
2517
2640
  }
@@ -2554,11 +2677,11 @@ function buildItemLocation(rootDir, testOrSuite) {
2554
2677
  return `${import_path4.default.relative(rootDir, testOrSuite.location.file)}:${testOrSuite.location.line}`;
2555
2678
  }
2556
2679
  async function requireOrImportDefaultFunction(file, expectConstructor) {
2557
- let func = await import_common3.transform.requireOrImport(file);
2680
+ let func = await import_common4.transform.requireOrImport(file);
2558
2681
  if (func && typeof func === "object" && "default" in func)
2559
2682
  func = func["default"];
2560
2683
  if (typeof func !== "function")
2561
- throw (0, import_util5.errorWithFile)(file, `file must export a single ${expectConstructor ? "class" : "function"}.`);
2684
+ throw (0, import_util6.errorWithFile)(file, `file must export a single ${expectConstructor ? "class" : "function"}.`);
2562
2685
  return func;
2563
2686
  }
2564
2687
  function loadGlobalHook(config2, file) {
@@ -2597,7 +2720,7 @@ async function loadTestList(config2, filePath) {
2597
2720
  project = tokens[0].substring(1, tokens[0].length - 1);
2598
2721
  tokens.shift();
2599
2722
  }
2600
- return { project, file: toPosixPath((0, import_util5.parseLocationArg)(tokens[0]).file), titlePath: tokens.slice(1) };
2723
+ return { project, file: toPosixPath((0, import_util6.parseLocationArg)(tokens[0]).file), titlePath: tokens.slice(1) };
2601
2724
  });
2602
2725
  const testFilter = (test) => descriptions.some((d) => {
2603
2726
  const [projectName, , ...titles] = test.titlePath();
@@ -2614,7 +2737,7 @@ async function loadTestList(config2, filePath) {
2614
2737
  };
2615
2738
  return { testFilter, fileFilter };
2616
2739
  } catch (e) {
2617
- throw (0, import_util5.errorWithFile)(filePath, "Cannot read test list file: " + e.message);
2740
+ throw (0, import_util6.errorWithFile)(filePath, "Cannot read test list file: " + e.message);
2618
2741
  }
2619
2742
  }
2620
2743
 
@@ -2633,7 +2756,7 @@ var TeleReporterEmitter = class {
2633
2756
  this._resultKnownErrorCounts = /* @__PURE__ */ new Map();
2634
2757
  // In case there is blob reporter and UI mode, make sure one doesn't override
2635
2758
  // the id assigned by the other.
2636
- this._idSymbol = Symbol("id");
2759
+ this._idSymbol = /* @__PURE__ */ Symbol("id");
2637
2760
  this._messageSink = messageSink;
2638
2761
  this._emitterOptions = options;
2639
2762
  }
@@ -3102,14 +3225,17 @@ var empty_default = EmptyReporter;
3102
3225
 
3103
3226
  // packages/playwright/src/reporters/github.ts
3104
3227
  var import_path7 = __toESM(require("path"));
3105
- var import_util6 = require("../util");
3228
+ var import_util7 = require("../util");
3106
3229
  var { noColors: noColors2 } = require("playwright-core/lib/coreBundle").iso;
3107
3230
  var { msToString: msToString2 } = require("playwright-core/lib/coreBundle").iso;
3108
3231
  var GitHubLogger = class {
3232
+ newLine() {
3233
+ process.stdout.write("\n");
3234
+ }
3109
3235
  _log(message, type = "notice", options = {}) {
3110
3236
  message = message.replace(/\n/g, "%0A");
3111
3237
  const configs = Object.entries(options).map(([key, option]) => `${key}=${option}`).join(",");
3112
- process.stdout.write((0, import_util6.stripAnsiEscapes)(`::${type} ${configs}::${message}
3238
+ process.stdout.write((0, import_util7.stripAnsiEscapes)(`::${type} ${configs}::${message}
3113
3239
  `));
3114
3240
  }
3115
3241
  debug(message, options) {
@@ -3142,6 +3268,7 @@ var GitHubReporter = class extends TerminalReporter {
3142
3268
  if (!this._shouldPrintFailureAnnotations(test))
3143
3269
  return;
3144
3270
  this._failedTestCount++;
3271
+ this.githubLogger.newLine();
3145
3272
  for (const r of test.results)
3146
3273
  this._printFailureAnnotation(test, r, this._failedTestCount);
3147
3274
  }
@@ -3218,7 +3345,7 @@ var import_os = __toESM(require("os"));
3218
3345
  var import_path8 = __toESM(require("path"));
3219
3346
  var import_stream3 = require("stream");
3220
3347
  var babel2 = __toESM(require("../transform/babelBundle"));
3221
- var import_util7 = require("../util");
3348
+ var import_util8 = require("../util");
3222
3349
  var colors2 = require("playwright-core/lib/utilsBundle").colors;
3223
3350
  var mime2 = require("playwright-core/lib/utilsBundle").mime;
3224
3351
  var open = require("playwright-core/lib/utilsBundle").open;
@@ -3276,7 +3403,7 @@ var HtmlReporter = class {
3276
3403
  this.suite = suite;
3277
3404
  }
3278
3405
  _resolveOptions() {
3279
- const outputFolder = reportFolderFromEnv() ?? (0, import_util7.resolveReporterOutputPath)("playwright-report", this._options.configDir, this._options.outputFolder);
3406
+ const outputFolder = reportFolderFromEnv() ?? (0, import_util8.resolveReporterOutputPath)("playwright-report", this._options.configDir, this._options.outputFolder);
3280
3407
  return {
3281
3408
  outputFolder,
3282
3409
  open: getHtmlReportOptionProcessEnv() || this._options.open || "on-failure",
@@ -3306,10 +3433,12 @@ var HtmlReporter = class {
3306
3433
  const noSnippets = parseBooleanEnvVar("PLAYWRIGHT_HTML_NO_SNIPPETS") ?? this._options.noSnippets;
3307
3434
  const noCopyPrompt = parseBooleanEnvVar("PLAYWRIGHT_HTML_NO_COPY_PROMPT") ?? this._options.noCopyPrompt;
3308
3435
  const doNotInlineAssets = parseBooleanEnvVar("PLAYWRIGHT_HTML_DO_NOT_INLINE_ASSETS") ?? this._options.doNotInlineAssets ?? false;
3436
+ const mergeFiles = parseBooleanEnvVar("PLAYWRIGHT_HTML_MERGE_FILES") ?? this._options.mergeFiles;
3309
3437
  const builder = new HtmlBuilder(yazl2, this.config, this._outputFolder, this._attachmentsBaseURL, doNotInlineAssets, {
3310
3438
  title: process.env.PLAYWRIGHT_HTML_TITLE || this._options.title,
3311
3439
  noSnippets,
3312
- noCopyPrompt
3440
+ noCopyPrompt,
3441
+ mergeFiles
3313
3442
  });
3314
3443
  this._buildResult = await builder.build(this.config.metadata, projectSuites, result, this._topLevelErrors, this._machines);
3315
3444
  }
@@ -3356,7 +3485,7 @@ function parseBooleanEnvVar(name) {
3356
3485
  return void 0;
3357
3486
  }
3358
3487
  function standaloneDefaultFolder() {
3359
- return reportFolderFromEnv() ?? (0, import_util7.resolveReporterOutputPath)("playwright-report", process.cwd(), void 0);
3488
+ return reportFolderFromEnv() ?? (0, import_util8.resolveReporterOutputPath)("playwright-report", process.cwd(), void 0);
3360
3489
  }
3361
3490
  async function resolveReportFolder(reportPath) {
3362
3491
  const stat = await import_fs5.default.promises.stat(reportPath).catch(() => null);
@@ -3621,10 +3750,10 @@ var HtmlBuilder = class {
3621
3750
  this._hasTraces = true;
3622
3751
  if ((a.name === "stdout" || a.name === "stderr") && a.contentType === "text/plain") {
3623
3752
  if (lastAttachment && lastAttachment.name === a.name && lastAttachment.contentType === a.contentType) {
3624
- lastAttachment.body += (0, import_util7.stripAnsiEscapes)(a.body);
3753
+ lastAttachment.body += (0, import_util8.stripAnsiEscapes)(a.body);
3625
3754
  return null;
3626
3755
  }
3627
- a.body = (0, import_util7.stripAnsiEscapes)(a.body);
3756
+ a.body = (0, import_util8.stripAnsiEscapes)(a.body);
3628
3757
  lastAttachment = a;
3629
3758
  return a;
3630
3759
  }
@@ -3855,7 +3984,7 @@ function createErrorCodeframe(message, location) {
3855
3984
  highlightCode: false,
3856
3985
  linesAbove: 100,
3857
3986
  linesBelow: 100,
3858
- message: (0, import_util7.stripAnsiEscapes)(message).split("\n")[0] || void 0
3987
+ message: (0, import_util8.stripAnsiEscapes)(message).split("\n")[0] || void 0
3859
3988
  }
3860
3989
  );
3861
3990
  }
@@ -3867,7 +3996,7 @@ var html_default = HtmlReporter;
3867
3996
  // packages/playwright/src/reporters/json.ts
3868
3997
  var import_fs6 = __toESM(require("fs"));
3869
3998
  var import_path9 = __toESM(require("path"));
3870
- var import_common4 = require("../common");
3999
+ var import_common5 = require("../common");
3871
4000
  var { MultiMap: MultiMap2 } = require("playwright-core/lib/coreBundle").iso;
3872
4001
  var { toPosixPath: toPosixPath3 } = require("playwright-core/lib/coreBundle").utils;
3873
4002
  var JSONReporter = class {
@@ -3904,7 +4033,7 @@ var JSONReporter = class {
3904
4033
  repeatEach: project.repeatEach,
3905
4034
  retries: project.retries,
3906
4035
  metadata: project.metadata,
3907
- id: import_common4.config.getProjectId(project),
4036
+ id: import_common5.config.getProjectId(project),
3908
4037
  name: project.name,
3909
4038
  testDir: toPosixPath3(project.testDir),
3910
4039
  testIgnore: serializePatterns(project.testIgnore),
@@ -3931,7 +4060,7 @@ var JSONReporter = class {
3931
4060
  _mergeSuites(suites) {
3932
4061
  const fileSuites = new MultiMap2();
3933
4062
  for (const projectSuite of suites) {
3934
- const projectId = import_common4.config.getProjectId(projectSuite.project());
4063
+ const projectId = import_common5.config.getProjectId(projectSuite.project());
3935
4064
  const projectName = projectSuite.project().name;
3936
4065
  for (const fileSuite of projectSuite.suites) {
3937
4066
  const file = fileSuite.location.file;
@@ -4085,7 +4214,7 @@ var json_default = JSONReporter;
4085
4214
  // packages/playwright/src/reporters/junit.ts
4086
4215
  var import_fs7 = __toESM(require("fs"));
4087
4216
  var import_path10 = __toESM(require("path"));
4088
- var import_util8 = require("../util");
4217
+ var import_util9 = require("../util");
4089
4218
  var { getAsBooleanFromENV } = require("playwright-core/lib/coreBundle").utils;
4090
4219
  var JUnitReporter = class {
4091
4220
  constructor(options) {
@@ -4251,7 +4380,7 @@ var JUnitReporter = class {
4251
4380
  entry.children.push({
4252
4381
  name: errorInfo.elementName,
4253
4382
  attributes: { message: errorInfo.message, type: errorInfo.type },
4254
- text: (0, import_util8.stripAnsiEscapes)(formatFailure(nonTerminalScreen, this.config, test))
4383
+ text: (0, import_util9.stripAnsiEscapes)(formatFailure(nonTerminalScreen, this.config, test))
4255
4384
  });
4256
4385
  return errorInfo.elementName;
4257
4386
  }
@@ -4261,7 +4390,7 @@ var JUnitReporter = class {
4261
4390
  message: `${import_path10.default.basename(test.location.file)}:${test.location.line}:${test.location.column} ${test.title}`,
4262
4391
  type: "FAILURE"
4263
4392
  },
4264
- text: (0, import_util8.stripAnsiEscapes)(formatFailure(nonTerminalScreen, this.config, test))
4393
+ text: (0, import_util9.stripAnsiEscapes)(formatFailure(nonTerminalScreen, this.config, test))
4265
4394
  });
4266
4395
  return "failure";
4267
4396
  }
@@ -4308,7 +4437,7 @@ Warning: attachment ${attachmentPath} is missing`);
4308
4437
  children: []
4309
4438
  };
4310
4439
  const stackTrace = result.error?.stack || result.error?.message || result.error?.value || "";
4311
- entry.children.push({ name: "stackTrace", text: (0, import_util8.stripAnsiEscapes)(stackTrace) });
4440
+ entry.children.push({ name: "stackTrace", text: (0, import_util9.stripAnsiEscapes)(stackTrace) });
4312
4441
  await this._appendStdIO(entry, [result]);
4313
4442
  return entry;
4314
4443
  }
@@ -4317,7 +4446,7 @@ function classifyResultError(result) {
4317
4446
  const error = result.error;
4318
4447
  if (!error)
4319
4448
  return null;
4320
- const rawMessage = (0, import_util8.stripAnsiEscapes)(error.message || error.value || "");
4449
+ const rawMessage = (0, import_util9.stripAnsiEscapes)(error.message || error.value || "");
4321
4450
  const nameMatch = rawMessage.match(/^(\w+): /);
4322
4451
  const errorName = nameMatch ? nameMatch[1] : "";
4323
4452
  const messageBody = nameMatch ? rawMessage.slice(nameMatch[0].length) : rawMessage;
@@ -4359,7 +4488,7 @@ function serializeXML(entry, tokens, stripANSIControlSequences) {
4359
4488
  var discouragedXMLCharacters = /[\u0000-\u0008\u000b-\u000c\u000e-\u001f\u007f-\u0084\u0086-\u009f]/g;
4360
4489
  function escape(text, stripANSIControlSequences, isCharacterData) {
4361
4490
  if (stripANSIControlSequences)
4362
- text = (0, import_util8.stripAnsiEscapes)(text);
4491
+ text = (0, import_util9.stripAnsiEscapes)(text);
4363
4492
  if (isCharacterData) {
4364
4493
  text = "<![CDATA[" + text.replace(/]]>/g, "]]&gt;") + "]]>";
4365
4494
  } else {
@@ -4481,7 +4610,7 @@ var LineReporter = class extends TerminalReporter {
4481
4610
  var line_default = LineReporter;
4482
4611
 
4483
4612
  // packages/playwright/src/reporters/list.ts
4484
- var import_util9 = require("../util");
4613
+ var import_util10 = require("../util");
4485
4614
  var { msToString: msToString3 } = require("playwright-core/lib/coreBundle").iso;
4486
4615
  var { getAsBooleanFromENV: getAsBooleanFromENV2 } = require("playwright-core/lib/coreBundle").utils;
4487
4616
  var DOES_NOT_SUPPORT_UTF8_IN_TERMINAL = process.platform === "win32" && process.env.TERM_PROGRAM !== "vscode" && !process.env.WT_SESSION;
@@ -4699,7 +4828,7 @@ var ListReporter = class extends TerminalReporter {
4699
4828
  this.screen.stdout.write(`\x1B[${this._lastRow - row}E`);
4700
4829
  }
4701
4830
  _testPrefix(index, statusMark) {
4702
- const statusMarkLength = (0, import_util9.stripAnsiEscapes)(statusMark).length;
4831
+ const statusMarkLength = (0, import_util10.stripAnsiEscapes)(statusMark).length;
4703
4832
  const indexLength = Math.ceil(Math.log10(this.totalTestCount + 1));
4704
4833
  return " " + statusMark + " ".repeat(3 - statusMarkLength) + this.screen.colors.dim(index.padStart(indexLength) + " ");
4705
4834
  }
@@ -4719,7 +4848,7 @@ var ListReporter = class extends TerminalReporter {
4719
4848
  this.epilogue(!this._printFailuresInline);
4720
4849
  }
4721
4850
  };
4722
- var lastStepOrdinalSymbol = Symbol("lastStepOrdinal");
4851
+ var lastStepOrdinalSymbol = /* @__PURE__ */ Symbol("lastStepOrdinal");
4723
4852
  var list_default = ListReporter;
4724
4853
 
4725
4854
  // packages/playwright/src/reporters/listModeReporter.ts
@@ -4851,7 +4980,7 @@ function computeCommandHash(config2, runOptions) {
4851
4980
  // packages/playwright/src/runner/tasks.ts
4852
4981
  var import_fs11 = __toESM(require("fs"));
4853
4982
  var import_path15 = __toESM(require("path"));
4854
- var import_util12 = require("util");
4983
+ var import_util13 = require("util");
4855
4984
 
4856
4985
  // packages/playwright/src/runner/rebase.ts
4857
4986
  var import_fs9 = __toESM(require("fs"));
@@ -5005,7 +5134,7 @@ function applyPatchWithConflictMarkers(oldText, newText) {
5005
5134
  // packages/playwright/src/runner/workerHost.ts
5006
5135
  var import_fs10 = __toESM(require("fs"));
5007
5136
  var import_path13 = __toESM(require("path"));
5008
- var import_common5 = require("../common");
5137
+ var import_common6 = require("../common");
5009
5138
 
5010
5139
  // packages/playwright/src/isomorphic/folders.ts
5011
5140
  function artifactsFolderName(workerIndex) {
@@ -5041,8 +5170,8 @@ var WorkerHost = class extends ProcessHost {
5041
5170
  async start() {
5042
5171
  await import_fs10.default.promises.mkdir(this._params.artifactsDir, { recursive: true });
5043
5172
  return await this.startRunner(this._params, {
5044
- onStdOut: (chunk) => this.emit("stdOut", import_common5.ipc.stdioChunkToParams(chunk)),
5045
- onStdErr: (chunk) => this.emit("stdErr", import_common5.ipc.stdioChunkToParams(chunk))
5173
+ onStdOut: (chunk) => this.emit("stdOut", import_common6.ipc.stdioChunkToParams(chunk)),
5174
+ onStdErr: (chunk) => this.emit("stdErr", import_common6.ipc.stdioChunkToParams(chunk))
5046
5175
  });
5047
5176
  }
5048
5177
  async onExit() {
@@ -5074,16 +5203,17 @@ var WorkerHost = class extends ProcessHost {
5074
5203
  };
5075
5204
 
5076
5205
  // packages/playwright/src/runner/dispatcher.ts
5077
- var import_common6 = require("../common");
5078
- var import_util10 = require("../util");
5206
+ var import_common7 = require("../common");
5207
+ var import_util11 = require("../util");
5079
5208
  var colors4 = require("playwright-core/lib/utilsBundle").colors;
5080
5209
  var { ManualPromise: ManualPromise3 } = require("playwright-core/lib/coreBundle").iso;
5081
5210
  var { eventsHelper } = require("playwright-core/lib/coreBundle").utils;
5082
5211
  var Dispatcher = class {
5083
- constructor(testRun) {
5212
+ constructor(testRun, options = {}) {
5084
5213
  // Worker slot is claimed when it has jobDispatcher assigned.
5085
5214
  this._workerSlots = [];
5086
5215
  this._queue = [];
5216
+ this._isolatedJobs = /* @__PURE__ */ new Set();
5087
5217
  this._workerLimitPerProjectId = /* @__PURE__ */ new Map();
5088
5218
  this._queuedOrRunningHashCount = /* @__PURE__ */ new Map();
5089
5219
  this._finished = new ManualPromise3();
@@ -5091,6 +5221,7 @@ var Dispatcher = class {
5091
5221
  this._extraEnvByProjectId = /* @__PURE__ */ new Map();
5092
5222
  this._producedEnvByProjectId = /* @__PURE__ */ new Map();
5093
5223
  this._testRun = testRun;
5224
+ this._ignoreMaxFailures = !!options.ignoreMaxFailures;
5094
5225
  for (const project of testRun.config.projects) {
5095
5226
  if (project.workers)
5096
5227
  this._workerLimitPerProjectId.set(project.id, project.workers);
@@ -5099,6 +5230,8 @@ var Dispatcher = class {
5099
5230
  _findFirstJobToRun() {
5100
5231
  for (let index = 0; index < this._queue.length; index++) {
5101
5232
  const job = this._queue[index];
5233
+ if (this._isolatedJobs.has(job) && this._workerSlots.some((w) => !!w.jobDispatcher))
5234
+ continue;
5102
5235
  const projectIdWorkerLimit = this._workerLimitPerProjectId.get(job.projectId);
5103
5236
  if (!projectIdWorkerLimit)
5104
5237
  return index;
@@ -5122,7 +5255,7 @@ var Dispatcher = class {
5122
5255
  return;
5123
5256
  }
5124
5257
  this._queue.splice(jobIndex, 1);
5125
- const jobDispatcher = new JobDispatcher(job, this._testRun, () => this.stop().catch(() => {
5258
+ const jobDispatcher = new JobDispatcher(job, this._testRun, this._ignoreMaxFailures ? void 0 : () => this.stop().catch(() => {
5126
5259
  }));
5127
5260
  this._workerSlots[workerIndex].jobDispatcher = jobDispatcher;
5128
5261
  void this._runJobInWorker(workerIndex, jobDispatcher).then(() => {
@@ -5144,7 +5277,7 @@ var Dispatcher = class {
5144
5277
  }
5145
5278
  let startError;
5146
5279
  if (!worker) {
5147
- worker = this._createWorker(job, index, import_common6.ipc.serializeConfig(this._testRun.config, true));
5280
+ worker = this._createWorker(job, index, import_common7.ipc.serializeConfig(this._testRun.config, true));
5148
5281
  this._workerSlots[index].worker = worker;
5149
5282
  worker.on("exit", () => this._workerSlots[index].worker = void 0);
5150
5283
  startError = await worker.start();
@@ -5164,9 +5297,16 @@ var Dispatcher = class {
5164
5297
  );
5165
5298
  else if (this._isWorkerRedundant(worker))
5166
5299
  void worker.stop();
5167
- if (!this._isStopped && result.newJob) {
5168
- this._queue.unshift(result.newJob);
5169
- this._updateCounterForWorkerHash(result.newJob.workerHash, 1);
5300
+ if (!this._isStopped) {
5301
+ if (result.remainingJob) {
5302
+ this._queue.unshift(result.remainingJob);
5303
+ this._updateCounterForWorkerHash(result.remainingJob.workerHash, 1);
5304
+ }
5305
+ if (result.isolatedRetriesJob) {
5306
+ this._isolatedJobs.add(result.isolatedRetriesJob);
5307
+ this._queue.push(result.isolatedRetriesJob);
5308
+ this._updateCounterForWorkerHash(result.isolatedRetriesJob.workerHash, 1);
5309
+ }
5170
5310
  }
5171
5311
  }
5172
5312
  _checkFinished() {
@@ -5196,7 +5336,7 @@ var Dispatcher = class {
5196
5336
  this._updateCounterForWorkerHash(group.workerHash, 1);
5197
5337
  this._isStopped = false;
5198
5338
  this._workerSlots = [];
5199
- if (this._testRun.hasReachedMaxFailures())
5339
+ if (!this._ignoreMaxFailures && this._testRun.hasReachedMaxFailures())
5200
5340
  void this.stop();
5201
5341
  for (let i = 0; i < this._testRun.config.config.workers; i++)
5202
5342
  this._workerSlots.push({});
@@ -5269,7 +5409,7 @@ var Dispatcher = class {
5269
5409
  }
5270
5410
  };
5271
5411
  var JobDispatcher = class {
5272
- constructor(job, testRun, stopCallback) {
5412
+ constructor(job, testRun, onMaxFailuresReached) {
5273
5413
  this.jobResult = new ManualPromise3();
5274
5414
  this._listeners = [];
5275
5415
  this._failedTests = /* @__PURE__ */ new Set();
@@ -5280,9 +5420,12 @@ var JobDispatcher = class {
5280
5420
  this._workerIndex = 0;
5281
5421
  this.job = job;
5282
5422
  this._testRun = testRun;
5283
- this._stopCallback = stopCallback;
5423
+ this._onMaxFailuresReached = onMaxFailuresReached;
5284
5424
  this._remainingByTestId = new Map(this.job.tests.map((e) => [e.id, e]));
5285
5425
  }
5426
+ _isStoppedByMaxFailures() {
5427
+ return !!this._onMaxFailuresReached && this._testRun.hasReachedMaxFailures();
5428
+ }
5286
5429
  _onTestBegin(params) {
5287
5430
  const test = this._remainingByTestId.get(params.testId);
5288
5431
  if (!test) {
@@ -5297,7 +5440,7 @@ var JobDispatcher = class {
5297
5440
  this._currentlyRunning = { test, result };
5298
5441
  }
5299
5442
  _onTestEnd(params) {
5300
- if (this._testRun.hasReachedMaxFailures()) {
5443
+ if (this._isStoppedByMaxFailures()) {
5301
5444
  params.status = "interrupted";
5302
5445
  params.errors = [];
5303
5446
  }
@@ -5416,7 +5559,7 @@ var JobDispatcher = class {
5416
5559
  for (const test of this._remainingByTestId.values()) {
5417
5560
  if (!testIds.has(test.id))
5418
5561
  continue;
5419
- if (!this._testRun.hasReachedMaxFailures()) {
5562
+ if (!this._isStoppedByMaxFailures()) {
5420
5563
  this._failTestWithErrors(test, errors);
5421
5564
  errors = [];
5422
5565
  }
@@ -5475,12 +5618,18 @@ var JobDispatcher = class {
5475
5618
  serialSuite.allTests().forEach((test) => retryCandidates.add(test));
5476
5619
  }
5477
5620
  const remaining = [...this._remainingByTestId.values()];
5621
+ const isolatedRetries = [];
5478
5622
  for (const test of retryCandidates) {
5479
- if (test.results.length < test.retries + 1)
5480
- remaining.push(test);
5623
+ if (test.results.length < test.retries + 1) {
5624
+ if (this._testRun.config.retryStrategy === "immediate")
5625
+ remaining.push(test);
5626
+ else
5627
+ isolatedRetries.push(test);
5628
+ }
5481
5629
  }
5482
- const newJob = remaining.length ? { ...this.job, tests: remaining } : void 0;
5483
- this._finished({ didFail: true, newJob });
5630
+ const remainingJob = remaining.length ? { ...this.job, tests: remaining } : void 0;
5631
+ const isolatedRetriesJob = isolatedRetries.length ? { ...this.job, tests: isolatedRetries } : void 0;
5632
+ this._finished({ didFail: true, remainingJob, isolatedRetriesJob });
5484
5633
  }
5485
5634
  onExit(data) {
5486
5635
  const unexpectedExitError = data.unexpectedly ? {
@@ -5498,7 +5647,7 @@ var JobDispatcher = class {
5498
5647
  const runPayload = {
5499
5648
  file: this.job.requireFile,
5500
5649
  entries: this.job.tests.map((test) => {
5501
- return { testId: test.id, retry: test.results.length };
5650
+ return { testId: test.id, retry: test.results.length, planAnnotations: test._planAnnotations };
5502
5651
  })
5503
5652
  };
5504
5653
  worker.runTestGroup(runPayload);
@@ -5527,7 +5676,7 @@ var JobDispatcher = class {
5527
5676
  addLocationAndSnippetToError(this._testRun.config.config, response.error);
5528
5677
  return response;
5529
5678
  } catch (e) {
5530
- const error = (0, import_util10.serializeError)(e);
5679
+ const error = (0, import_util11.serializeError)(e);
5531
5680
  addLocationAndSnippetToError(this._testRun.config.config, error);
5532
5681
  return { response: void 0, error };
5533
5682
  }
@@ -5542,7 +5691,7 @@ var JobDispatcher = class {
5542
5691
  }
5543
5692
  skipWholeJob() {
5544
5693
  const allTestsSkipped = this.job.tests.every((test) => test.expectedStatus === "skipped");
5545
- if (allTestsSkipped && !this._testRun.hasReachedMaxFailures()) {
5694
+ if (allTestsSkipped && !this._isStoppedByMaxFailures()) {
5546
5695
  for (const test of this.job.tests) {
5547
5696
  const result = test._appendTestResult();
5548
5697
  this._testRun.reporter.onTestBegin?.(test, result);
@@ -5559,11 +5708,11 @@ var JobDispatcher = class {
5559
5708
  }
5560
5709
  _reportTestEnd(test, result) {
5561
5710
  this._testRun.reporter.onTestEnd?.(test, result);
5562
- const hadMaxFailures = this._testRun.hasReachedMaxFailures();
5711
+ const hadMaxFailures = this._isStoppedByMaxFailures();
5563
5712
  if (test.outcome() === "unexpected" && test.results.length > test.retries)
5564
5713
  ++this._testRun.failedTestCount;
5565
- if (!hadMaxFailures && this._testRun.hasReachedMaxFailures()) {
5566
- this._stopCallback();
5714
+ if (!hadMaxFailures && this._isStoppedByMaxFailures()) {
5715
+ this._onMaxFailuresReached?.();
5567
5716
  this._testRun.reporter.onError?.({ message: colors4.red(`Testing stopped early after ${this._testRun.config.config.maxFailures} maximum allowed failures.`) });
5568
5717
  }
5569
5718
  }
@@ -5646,7 +5795,7 @@ var FixedNodeSIGINTHandler = class {
5646
5795
  };
5647
5796
 
5648
5797
  // packages/playwright/src/runner/taskRunner.ts
5649
- var import_util11 = require("../util");
5798
+ var import_util12 = require("../util");
5650
5799
  var colors5 = require("playwright-core/lib/utilsBundle").colors;
5651
5800
  var debug4 = require("playwright-core/lib/utilsBundle").debug;
5652
5801
  var { ManualPromise: ManualPromise4 } = require("playwright-core/lib/coreBundle").iso;
@@ -5687,7 +5836,7 @@ var TaskRunner = class _TaskRunner {
5687
5836
  await task.setup?.(context, errors, softErrors);
5688
5837
  } catch (e) {
5689
5838
  debug4("pw:test:task")(`error in "${task.title}": `, e);
5690
- errors.push((0, import_util11.serializeError)(e));
5839
+ errors.push((0, import_util12.serializeError)(e));
5691
5840
  } finally {
5692
5841
  for (const error of [...softErrors, ...errors])
5693
5842
  this._reporter.onError?.(error);
@@ -5750,7 +5899,7 @@ var TimeoutWatcher = class {
5750
5899
  // packages/playwright/src/runner/vcs.ts
5751
5900
  var import_child_process2 = __toESM(require("child_process"));
5752
5901
  var import_path14 = __toESM(require("path"));
5753
- var import_common7 = require("../common");
5902
+ var import_common8 = require("../common");
5754
5903
  async function detectChangedTestFiles(baseCommit, configDir) {
5755
5904
  function gitFileList(args) {
5756
5905
  try {
@@ -5782,17 +5931,17 @@ async function detectChangedTestFiles(baseCommit, configDir) {
5782
5931
  const untrackedFiles = gitFileList(["ls-files", "--others", "--exclude-standard"]).map((file) => import_path14.default.join(configDir, file));
5783
5932
  const [gitRoot] = gitFileList(["rev-parse", "--show-toplevel"]);
5784
5933
  const trackedFilesWithChanges = gitFileList(["diff", baseCommit, "--name-only"]).map((file) => import_path14.default.join(gitRoot, file));
5785
- return new Set(import_common7.cc.affectedTestFiles([...untrackedFiles, ...trackedFilesWithChanges]));
5934
+ return new Set(import_common8.cc.affectedTestFiles([...untrackedFiles, ...trackedFilesWithChanges]));
5786
5935
  }
5787
5936
 
5788
5937
  // packages/playwright/src/runner/tasks.ts
5789
- var import_common8 = require("../common");
5790
- var import_util13 = require("../util");
5938
+ var import_common9 = require("../common");
5939
+ var import_util14 = require("../util");
5791
5940
  var debug5 = require("playwright-core/lib/utilsBundle").debug;
5792
5941
  var { ManualPromise: ManualPromise5 } = require("playwright-core/lib/coreBundle").iso;
5793
5942
  var { monotonicTime: monotonicTime6 } = require("playwright-core/lib/coreBundle").iso;
5794
5943
  var { removeFolders: removeFolders4 } = require("playwright-core/lib/coreBundle").utils;
5795
- var readDirAsync2 = (0, import_util12.promisify)(import_fs11.default.readdir);
5944
+ var readDirAsync2 = (0, import_util13.promisify)(import_fs11.default.readdir);
5796
5945
  var TestRun = class {
5797
5946
  constructor(config2, reporter, options) {
5798
5947
  this.rootSuite = void 0;
@@ -5820,7 +5969,7 @@ var TestRun = class {
5820
5969
  result() {
5821
5970
  const hasFailedTests = this.rootSuite?.allTests().some((test) => !test.ok());
5822
5971
  const hasFlakyTests = this.rootSuite?.allTests().some((test) => test.outcome() === "flaky");
5823
- return this.hasWorkerErrors || this.hasReachedMaxFailures() || hasFailedTests || this.config.config.failOnFlakyTests && hasFlakyTests ? "failed" : "passed";
5972
+ return this.hasWorkerErrors || this.reporter.hasReporterErrors() || this.hasReachedMaxFailures() || hasFailedTests || this.config.config.failOnFlakyTests && hasFlakyTests ? "failed" : "passed";
5824
5973
  }
5825
5974
  };
5826
5975
  async function runTasks(testRun, tasks, globalTimeout, cancelPromise) {
@@ -5847,6 +5996,8 @@ async function finishTaskRun(testRun, status) {
5847
5996
  if (modifiedResult && modifiedResult.status)
5848
5997
  status = modifiedResult.status;
5849
5998
  await testRun.reporter.onExit();
5999
+ if (status === "passed" && testRun.reporter.hasReporterErrors())
6000
+ status = "failed";
5850
6001
  return status;
5851
6002
  }
5852
6003
  function createGlobalSetupTasks(config2) {
@@ -5869,7 +6020,7 @@ function createClearCacheTask(config2) {
5869
6020
  return {
5870
6021
  title: "clear cache",
5871
6022
  setup: async () => {
5872
- await (0, import_util13.removeDirAndLogToConsole)(import_common8.cc.cacheDir);
6023
+ await (0, import_util14.removeDirAndLogToConsole)(import_common9.cc.cacheDir);
5873
6024
  for (const plugin of config2.plugins)
5874
6025
  await plugin.instance?.clearCache?.();
5875
6026
  }
@@ -5968,12 +6119,12 @@ function createListFilesTask() {
5968
6119
  await createRootSuite(testRun, errors, false);
5969
6120
  await collectProjectsAndTestFiles(testRun, false);
5970
6121
  for (const [project, files] of testRun.projectFiles) {
5971
- const projectSuite = new import_common8.test.Suite(project.project.name, "project");
6122
+ const projectSuite = new import_common9.test.Suite(project.project.name, "project");
5972
6123
  projectSuite._fullProject = project;
5973
6124
  testRun.rootSuite._addSuite(projectSuite);
5974
6125
  const suites = files.map((file) => {
5975
6126
  const title = import_path15.default.relative(testRun.config.config.rootDir, file);
5976
- const suite = new import_common8.test.Suite(title, "file");
6127
+ const suite = new import_common9.test.Suite(title, "file");
5977
6128
  suite.location = { file, line: 0, column: 0 };
5978
6129
  projectSuite._addSuite(suite);
5979
6130
  return suite;
@@ -5988,7 +6139,7 @@ function createLoadTask(mode, options) {
5988
6139
  title: "load tests",
5989
6140
  setup: async (testRun, errors, softErrors) => {
5990
6141
  if (testRun.options.locations?.length) {
5991
- const { testFilter, fileFilter } = import_common8.suiteUtils.createFiltersFromArguments(testRun.options.locations);
6142
+ const { testFilter, fileFilter } = import_common9.suiteUtils.createFiltersFromArguments(testRun.options.locations);
5992
6143
  testRun.loadFileFilters.push(fileFilter);
5993
6144
  testRun.preOnlyTestFilters.push(testFilter);
5994
6145
  }
@@ -6002,14 +6153,14 @@ function createLoadTask(mode, options) {
6002
6153
  testRun.preOnlyTestFilters.push((test) => !testFilter(test));
6003
6154
  }
6004
6155
  if (testRun.options.grep || testRun.options.grepInvert) {
6005
- const grepMatcher = testRun.options.grep ? (0, import_util13.createTitleMatcher)((0, import_util13.forceRegExp)(testRun.options.grep)) : () => true;
6006
- const grepInvertMatcher = testRun.options.grepInvert ? (0, import_util13.createTitleMatcher)((0, import_util13.forceRegExp)(testRun.options.grepInvert)) : () => false;
6156
+ const grepMatcher = testRun.options.grep ? (0, import_util14.createTitleMatcher)((0, import_util14.forceRegExp)(testRun.options.grep)) : () => true;
6157
+ const grepInvertMatcher = testRun.options.grepInvert ? (0, import_util14.createTitleMatcher)((0, import_util14.forceRegExp)(testRun.options.grepInvert)) : () => false;
6007
6158
  testRun.preOnlyTestFilters.push((test) => {
6008
6159
  const grepTitle = test._grepTitleWithTags();
6009
6160
  return !grepInvertMatcher(grepTitle) && grepMatcher(grepTitle);
6010
6161
  });
6011
6162
  }
6012
- if (testRun.options.lastFailedTestIds?.length) {
6163
+ if (testRun.options.lastFailedTestIds) {
6013
6164
  const failedTestIds = new Set(testRun.options.lastFailedTestIds);
6014
6165
  testRun.postShardTestFilters.push((test) => failedTestIds.has(test.id));
6015
6166
  }
@@ -6057,6 +6208,7 @@ function createPhasesTask() {
6057
6208
  const projectToSuite = new Map(testRun.rootSuite.suites.map((suite) => [suite._fullProject, suite]));
6058
6209
  const allProjects = [...projectToSuite.keys()];
6059
6210
  const teardownToSetups = buildTeardownToSetupsMap(allProjects);
6211
+ const ignoreMaxFailuresProjectIds = new Set(testRun.config.config.maxFailures > 0 ? [...teardownToSetups.keys()].map((project) => project.id) : []);
6060
6212
  const teardownToSetupsDependents = /* @__PURE__ */ new Map();
6061
6213
  for (const [teardown, setups] of teardownToSetups) {
6062
6214
  const closure = buildDependentProjects(setups, allProjects);
@@ -6075,11 +6227,14 @@ function createPhasesTask() {
6075
6227
  }
6076
6228
  for (const project of phaseProjects)
6077
6229
  processed.add(project);
6078
- if (phaseProjects.length) {
6230
+ for (const ignoreMaxFailures of [false, true]) {
6231
+ const projects = phaseProjects.filter((project) => ignoreMaxFailuresProjectIds.has(project.id) === ignoreMaxFailures);
6232
+ if (!projects.length)
6233
+ continue;
6079
6234
  let testGroupsInPhase = 0;
6080
- const phase = { dispatcher: new Dispatcher(testRun), projects: [] };
6235
+ const phase = { dispatcher: new Dispatcher(testRun, { ignoreMaxFailures }), projects: [] };
6081
6236
  testRun.phases.push(phase);
6082
- for (const project of phaseProjects) {
6237
+ for (const project of projects) {
6083
6238
  const projectSuite = projectToSuite.get(project);
6084
6239
  const testGroups = createTestGroups(projectSuite, testRun.config.config.workers);
6085
6240
  phase.projects.push({ project, projectSuite, testGroups });
@@ -6154,12 +6309,12 @@ var LastRunReporter = class {
6154
6309
  }
6155
6310
  async filterLastFailed() {
6156
6311
  if (!this._lastRunFile)
6157
- return [];
6312
+ return void 0;
6158
6313
  try {
6159
6314
  const lastRunInfo = JSON.parse(await import_fs12.default.promises.readFile(this._lastRunFile, "utf8"));
6160
6315
  return lastRunInfo.failedTests;
6161
6316
  } catch {
6162
- return [];
6317
+ return void 0;
6163
6318
  }
6164
6319
  }
6165
6320
  version() {
@@ -6205,7 +6360,7 @@ var TestRunner = class extends import_events2.default {
6205
6360
  this._configCLIOverrides = configCLIOverrides;
6206
6361
  this._watcher = new FSWatcher((events) => {
6207
6362
  const collector = /* @__PURE__ */ new Set();
6208
- events.forEach((f) => import_common9.cc.collectAffectedTestFiles(f.file, collector));
6363
+ events.forEach((f) => import_common10.cc.collectAffectedTestFiles(f.file, collector));
6209
6364
  this.emit(TestRunnerEvent.TestFilesChanged, [...collector]);
6210
6365
  });
6211
6366
  }
@@ -6415,7 +6570,7 @@ var TestRunner = class extends import_events2.default {
6415
6570
  this._watchedTestDependencies = /* @__PURE__ */ new Set();
6416
6571
  for (const fileName of fileNames) {
6417
6572
  this._watchedTestDependencies.add(fileName);
6418
- import_common9.cc.dependenciesForTestFile(fileName).forEach((file) => this._watchedTestDependencies.add(file));
6573
+ import_common10.cc.dependenciesForTestFile(fileName).forEach((file) => this._watchedTestDependencies.add(file));
6419
6574
  }
6420
6575
  await this._updateWatcher(true);
6421
6576
  }
@@ -6431,7 +6586,7 @@ var TestRunner = class extends import_events2.default {
6431
6586
  ]);
6432
6587
  if (status !== "passed")
6433
6588
  return { errors: errorReporter.errors(), testFiles: [] };
6434
- return { testFiles: import_common9.cc.affectedTestFiles(files) };
6589
+ return { testFiles: import_common10.cc.affectedTestFiles(files) };
6435
6590
  }
6436
6591
  async stopTests() {
6437
6592
  this._testRun?.stop?.resolve();
@@ -6445,7 +6600,7 @@ var TestRunner = class extends import_events2.default {
6445
6600
  }
6446
6601
  async _loadConfig(overrides) {
6447
6602
  try {
6448
- const config2 = await import_common9.configLoader.loadConfig(this.configLocation, overrides);
6603
+ const config2 = await import_common10.configLoader.loadConfig(this.configLocation, overrides);
6449
6604
  if (!this._plugins) {
6450
6605
  webServerPluginsForConfig(config2).forEach((p) => config2.plugins.push({ factory: p }));
6451
6606
  addGitCommitInfoPlugin(config2);
@@ -6456,7 +6611,7 @@ var TestRunner = class extends import_events2.default {
6456
6611
  this._lastLoadedConfig = config2;
6457
6612
  return { config: config2 };
6458
6613
  } catch (e) {
6459
- return { config: null, error: (0, import_util14.serializeError)(e) };
6614
+ return { config: null, error: (0, import_util15.serializeError)(e) };
6460
6615
  }
6461
6616
  }
6462
6617
  lastLoadedConfig() {
@@ -6497,7 +6652,7 @@ async function runAllTestsWithConfig(config2, options) {
6497
6652
  const lastRun = new LastRunReporter(filteredProjects, options.listMode, options.lastFailedFile);
6498
6653
  if (options.lastFailed) {
6499
6654
  const lastFailedTestIds = await lastRun.filterLastFailed();
6500
- if (lastFailedTestIds.length)
6655
+ if (lastFailedTestIds)
6501
6656
  options = { ...options, lastFailedTestIds };
6502
6657
  }
6503
6658
  const reporter = new InternalReporter([...reporters, lastRun]);
@@ -6524,9 +6679,9 @@ __export(testServer_exports, {
6524
6679
  runTestServer: () => runTestServer,
6525
6680
  runUIMode: () => runUIMode
6526
6681
  });
6527
- var import_util15 = __toESM(require("util"));
6682
+ var import_util16 = __toESM(require("util"));
6528
6683
  var import_coreBundle3 = require("playwright-core/lib/coreBundle");
6529
- var import_common10 = require("../common");
6684
+ var import_common11 = require("../common");
6530
6685
 
6531
6686
  // packages/playwright/src/runner/uiModeReporter.ts
6532
6687
  var UIModeReporter = class extends TeleReporterEmitter {
@@ -6684,7 +6839,7 @@ var TestServerDispatcher = class {
6684
6839
  if (interceptStdio) {
6685
6840
  if (debug6.log === originalDebugLog) {
6686
6841
  debug6.log = (...args) => {
6687
- const string = import_util15.default.format(...args) + "\n";
6842
+ const string = import_util16.default.format(...args) + "\n";
6688
6843
  return originalStderrWrite.apply(process.stderr, [string]);
6689
6844
  };
6690
6845
  }
@@ -6708,7 +6863,7 @@ var TestServerDispatcher = class {
6708
6863
  }
6709
6864
  };
6710
6865
  async function runUIMode(configFile, configCLIOverrides, options) {
6711
- const configLocation = import_common10.configLoader.resolveConfigLocation(configFile);
6866
+ const configLocation = import_common11.configLoader.resolveConfigLocation(configFile);
6712
6867
  return await innerRunTestServer(configLocation, configCLIOverrides, options, async (server, cancelPromise) => {
6713
6868
  await import_coreBundle3.server.installRootRedirect(server, void 0, { ...options, webApp: "uiMode.html" });
6714
6869
  if (options.host !== void 0 || options.port !== void 0) {
@@ -6727,7 +6882,7 @@ async function runUIMode(configFile, configCLIOverrides, options) {
6727
6882
  });
6728
6883
  }
6729
6884
  async function installedChromiumChannelForUI(configLocation, configCLIOverrides) {
6730
- const config2 = await import_common10.configLoader.loadConfig(configLocation, configCLIOverrides).catch((e) => null);
6885
+ const config2 = await import_common11.configLoader.loadConfig(configLocation, configCLIOverrides).catch((e) => null);
6731
6886
  if (!config2)
6732
6887
  return void 0;
6733
6888
  if (config2.projects.some((p) => (!p.project.use.browserName || p.project.use.browserName === "chromium") && !p.project.use.channel))
@@ -6739,7 +6894,7 @@ async function installedChromiumChannelForUI(configLocation, configCLIOverrides)
6739
6894
  return void 0;
6740
6895
  }
6741
6896
  async function runTestServer(configFile, configCLIOverrides, options) {
6742
- const configLocation = import_common10.configLoader.resolveConfigLocation(configFile);
6897
+ const configLocation = import_common11.configLoader.resolveConfigLocation(configFile);
6743
6898
  return await innerRunTestServer(configLocation, configCLIOverrides, options, async (server) => {
6744
6899
  console.log("Listening on " + server.urlPrefix("precise").replace("http:", "ws:") + "/" + server.wsGuid());
6745
6900
  });
@@ -6783,7 +6938,7 @@ var import_events3 = require("events");
6783
6938
  var import_coreBundle4 = require("playwright-core/lib/coreBundle");
6784
6939
 
6785
6940
  // packages/playwright/src/isomorphic/testTree.ts
6786
- var statusEx = Symbol("statusEx");
6941
+ var statusEx = /* @__PURE__ */ Symbol("statusEx");
6787
6942
 
6788
6943
  // packages/playwright/src/isomorphic/teleSuiteUpdater.ts
6789
6944
  var TeleSuiteUpdater = class {
@@ -7526,7 +7681,7 @@ var JsonStringInternalizer = class {
7526
7681
  };
7527
7682
 
7528
7683
  // packages/playwright/src/reporters/merge.ts
7529
- var import_util16 = require("../util");
7684
+ var import_util17 = require("../util");
7530
7685
  var { isPathInside } = require("playwright-core/lib/coreBundle").utils;
7531
7686
  var { ZipFile } = require("playwright-core/lib/coreBundle").utils;
7532
7687
  async function createMergedReport(config2, dir, reporterDescriptions, rootDirOverride) {
@@ -7591,6 +7746,7 @@ async function createMergedReport(config2, dir, reporterDescriptions, rootDirOve
7591
7746
  });
7592
7747
  }
7593
7748
  await dispatchEvents(eventData.epilogue);
7749
+ return multiplexer.hasReporterErrors() ? "failed" : "passed";
7594
7750
  }
7595
7751
  var commonEventNames = ["onBlobReportMetadata", "onConfigure", "onProject", "onBegin", "onEnd"];
7596
7752
  var commonEvents = new Set(commonEventNames);
@@ -7621,7 +7777,7 @@ async function extractAndParseReports(dir, shardFiles, internalizer, printStatus
7621
7777
  const reportNames = new UniqueFileNameGenerator();
7622
7778
  for (const file of shardFiles) {
7623
7779
  const absolutePath = import_path19.default.join(dir, file);
7624
- printStatus(`extracting: ${(0, import_util16.relativeFilePath)(absolutePath)}`);
7780
+ printStatus(`extracting: ${(0, import_util17.relativeFilePath)(absolutePath)}`);
7625
7781
  const zipFile = new ZipFile(absolutePath);
7626
7782
  const entryNames = await zipFile.entries();
7627
7783
  for (const entryName of entryNames.sort()) {