@smoothdeploy/playwright 1.61.0 → 1.62.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/agents/copilot-setup-steps.yml +2 -2
- package/lib/cli/reportActions.js +2 -2
- package/lib/common/index.js +74 -51
- package/lib/common/index.js.txt +10 -11
- package/lib/errorContext.js +2 -3
- package/lib/index.js +30 -8
- package/lib/matchers/expect.js +4814 -4380
- package/lib/matchers/expect.js.LICENSE +87 -140
- package/lib/matchers/expect.js.txt +30 -35
- package/lib/program.js +19 -0
- package/lib/runner/index.js +309 -153
- package/lib/runner/index.js.txt +13 -12
- package/lib/transform/babelBundle.js +12899 -11654
- package/lib/transform/babelBundle.js.LICENSE +379 -354
- package/lib/transform/babelBundle.js.txt +39 -39
- package/lib/transform/esmLoader.js +3126 -1115
- package/lib/transform/esmLoader.js.LICENSE +81 -61
- package/lib/transform/esmLoader.js.txt +21 -18
- package/lib/util.js +2 -29
- package/lib/worker/workerProcessEntry.js +14 -32
- package/lib/worker/workerProcessEntry.js.txt +7 -8
- package/package.json +3 -6
- package/types/test.d.ts +391 -4
- package/types/testReporter.d.ts +79 -4
package/lib/runner/index.js
CHANGED
|
@@ -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
|
|
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").
|
|
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
|
-
|
|
1028
|
-
|
|
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(path21) {
|
|
|
1373
1398
|
return `"${path21}"`;
|
|
1374
1399
|
return path21;
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
1596
|
+
this._wrap(() => reporter.onBegin?.(suite));
|
|
1563
1597
|
}
|
|
1564
1598
|
onTestBegin(test, result) {
|
|
1565
1599
|
for (const reporter of this._reporters)
|
|
1566
|
-
|
|
1600
|
+
this._wrap(() => reporter.onTestBegin?.(test, result));
|
|
1567
1601
|
}
|
|
1568
1602
|
onStdOut(chunk, test, result) {
|
|
1569
1603
|
for (const reporter of this._reporters)
|
|
1570
|
-
|
|
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
|
-
|
|
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
|
|
1612
|
+
await this._wrapAsync(() => reporter.onTestPaused?.(test, result));
|
|
1579
1613
|
}
|
|
1580
1614
|
onTestEnd(test, result) {
|
|
1581
1615
|
for (const reporter of this._reporters)
|
|
1582
|
-
|
|
1616
|
+
this._wrap(() => reporter.onTestEnd?.(test, result));
|
|
1583
1617
|
}
|
|
1584
1618
|
onReportConfigure(params) {
|
|
1585
1619
|
for (const reporter of this._reporters)
|
|
1586
|
-
|
|
1620
|
+
this._wrap(() => reporter.onReportConfigure?.(params));
|
|
1587
1621
|
}
|
|
1588
1622
|
onReportEnd(params) {
|
|
1589
1623
|
for (const reporter of this._reporters)
|
|
1590
|
-
|
|
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
|
|
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
|
|
1636
|
+
await this._wrapAsync(() => reporter.onExit?.());
|
|
1603
1637
|
}
|
|
1604
1638
|
onError(error, workerInfo) {
|
|
1605
1639
|
for (const reporter of this._reporters)
|
|
1606
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1653
|
+
this._wrap(() => prints = r.printsToStdio ? r.printsToStdio() : true, false);
|
|
1620
1654
|
return prints;
|
|
1621
1655
|
});
|
|
1622
1656
|
}
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
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
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
2058
|
-
var
|
|
2059
|
-
var minimatch = require("playwright-core/lib/utilsBundle")
|
|
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,
|
|
2062
|
-
var readDirAsync = (0,
|
|
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,
|
|
2168
|
-
const testIgnore = (0,
|
|
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
|
|
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
|
|
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
|
|
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
|
|
2537
|
+
const filteredRoot = new import_common4.test.Suite("", "root");
|
|
2433
2538
|
for (const filteredProjectSuite of filteredProjectSuites.values())
|
|
2434
2539
|
filteredRoot._addSuite(filteredProjectSuite);
|
|
2435
|
-
|
|
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
|
-
|
|
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
|
-
|
|
2589
|
+
import_common4.suiteUtils.filterTestsRemoveEmptySuites(rootSuite, (test) => testsInThisShard.has(test));
|
|
2468
2590
|
}
|
|
2469
2591
|
if (testRun.postShardTestFilters.length)
|
|
2470
|
-
|
|
2592
|
+
import_common4.suiteUtils.filterTestsRemoveEmptySuites(rootSuite, (test) => testRun.postShardTestFilters.every((filter) => filter(test)));
|
|
2471
2593
|
const topLevelProjects = [];
|
|
2472
2594
|
{
|
|
2473
|
-
const
|
|
2474
|
-
for (const [project,
|
|
2475
|
-
if (
|
|
2476
|
-
rootSuite.
|
|
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
|
|
2608
|
+
const projectSuite = new import_common4.test.Suite(project.project.name, "project");
|
|
2486
2609
|
for (const fileSuite of fileSuites)
|
|
2487
|
-
projectSuite._addSuite(
|
|
2488
|
-
const grepMatcher = (0,
|
|
2489
|
-
const grepInvertMatcher = project.project.grepInvert ? (0,
|
|
2490
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
|
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,
|
|
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,
|
|
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,
|
|
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
|
|
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,
|
|
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
|
|
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,
|
|
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,
|
|
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,
|
|
3753
|
+
lastAttachment.body += (0, import_util8.stripAnsiEscapes)(a.body);
|
|
3625
3754
|
return null;
|
|
3626
3755
|
}
|
|
3627
|
-
a.body = (0,
|
|
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,
|
|
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
|
|
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:
|
|
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 =
|
|
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
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
4491
|
+
text = (0, import_util9.stripAnsiEscapes)(text);
|
|
4363
4492
|
if (isCharacterData) {
|
|
4364
4493
|
text = "<![CDATA[" + text.replace(/]]>/g, "]]>") + "]]>";
|
|
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
|
|
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,
|
|
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
|
|
@@ -5154,7 +5283,7 @@ function computeCommandHash(config2, runOptions) {
|
|
|
5154
5283
|
// packages/playwright/src/runner/tasks.ts
|
|
5155
5284
|
var import_fs11 = __toESM(require("fs"));
|
|
5156
5285
|
var import_path15 = __toESM(require("path"));
|
|
5157
|
-
var
|
|
5286
|
+
var import_util13 = require("util");
|
|
5158
5287
|
|
|
5159
5288
|
// packages/playwright/src/runner/rebase.ts
|
|
5160
5289
|
var import_fs9 = __toESM(require("fs"));
|
|
@@ -5308,7 +5437,7 @@ function applyPatchWithConflictMarkers(oldText, newText) {
|
|
|
5308
5437
|
// packages/playwright/src/runner/workerHost.ts
|
|
5309
5438
|
var import_fs10 = __toESM(require("fs"));
|
|
5310
5439
|
var import_path13 = __toESM(require("path"));
|
|
5311
|
-
var
|
|
5440
|
+
var import_common6 = require("../common");
|
|
5312
5441
|
|
|
5313
5442
|
// packages/playwright/src/isomorphic/folders.ts
|
|
5314
5443
|
function artifactsFolderName(workerIndex) {
|
|
@@ -5344,8 +5473,8 @@ var WorkerHost = class extends ProcessHost {
|
|
|
5344
5473
|
async start() {
|
|
5345
5474
|
await import_fs10.default.promises.mkdir(this._params.artifactsDir, { recursive: true });
|
|
5346
5475
|
return await this.startRunner(this._params, {
|
|
5347
|
-
onStdOut: (chunk) => this.emit("stdOut",
|
|
5348
|
-
onStdErr: (chunk) => this.emit("stdErr",
|
|
5476
|
+
onStdOut: (chunk) => this.emit("stdOut", import_common6.ipc.stdioChunkToParams(chunk)),
|
|
5477
|
+
onStdErr: (chunk) => this.emit("stdErr", import_common6.ipc.stdioChunkToParams(chunk))
|
|
5349
5478
|
});
|
|
5350
5479
|
}
|
|
5351
5480
|
async onExit() {
|
|
@@ -5377,16 +5506,17 @@ var WorkerHost = class extends ProcessHost {
|
|
|
5377
5506
|
};
|
|
5378
5507
|
|
|
5379
5508
|
// packages/playwright/src/runner/dispatcher.ts
|
|
5380
|
-
var
|
|
5381
|
-
var
|
|
5509
|
+
var import_common7 = require("../common");
|
|
5510
|
+
var import_util11 = require("../util");
|
|
5382
5511
|
var colors4 = require("playwright-core/lib/utilsBundle").colors;
|
|
5383
5512
|
var { ManualPromise: ManualPromise3 } = require("playwright-core/lib/coreBundle").iso;
|
|
5384
5513
|
var { eventsHelper } = require("playwright-core/lib/coreBundle").utils;
|
|
5385
5514
|
var Dispatcher = class {
|
|
5386
|
-
constructor(testRun) {
|
|
5515
|
+
constructor(testRun, options = {}) {
|
|
5387
5516
|
// Worker slot is claimed when it has jobDispatcher assigned.
|
|
5388
5517
|
this._workerSlots = [];
|
|
5389
5518
|
this._queue = [];
|
|
5519
|
+
this._isolatedJobs = /* @__PURE__ */ new Set();
|
|
5390
5520
|
this._workerLimitPerProjectId = /* @__PURE__ */ new Map();
|
|
5391
5521
|
this._queuedOrRunningHashCount = /* @__PURE__ */ new Map();
|
|
5392
5522
|
this._finished = new ManualPromise3();
|
|
@@ -5394,6 +5524,7 @@ var Dispatcher = class {
|
|
|
5394
5524
|
this._extraEnvByProjectId = /* @__PURE__ */ new Map();
|
|
5395
5525
|
this._producedEnvByProjectId = /* @__PURE__ */ new Map();
|
|
5396
5526
|
this._testRun = testRun;
|
|
5527
|
+
this._ignoreMaxFailures = !!options.ignoreMaxFailures;
|
|
5397
5528
|
for (const project of testRun.config.projects) {
|
|
5398
5529
|
if (project.workers)
|
|
5399
5530
|
this._workerLimitPerProjectId.set(project.id, project.workers);
|
|
@@ -5402,6 +5533,8 @@ var Dispatcher = class {
|
|
|
5402
5533
|
_findFirstJobToRun() {
|
|
5403
5534
|
for (let index = 0; index < this._queue.length; index++) {
|
|
5404
5535
|
const job = this._queue[index];
|
|
5536
|
+
if (this._isolatedJobs.has(job) && this._workerSlots.some((w) => !!w.jobDispatcher))
|
|
5537
|
+
continue;
|
|
5405
5538
|
const projectIdWorkerLimit = this._workerLimitPerProjectId.get(job.projectId);
|
|
5406
5539
|
if (!projectIdWorkerLimit)
|
|
5407
5540
|
return index;
|
|
@@ -5425,7 +5558,7 @@ var Dispatcher = class {
|
|
|
5425
5558
|
return;
|
|
5426
5559
|
}
|
|
5427
5560
|
this._queue.splice(jobIndex, 1);
|
|
5428
|
-
const jobDispatcher = new JobDispatcher(job, this._testRun, () => this.stop().catch(() => {
|
|
5561
|
+
const jobDispatcher = new JobDispatcher(job, this._testRun, this._ignoreMaxFailures ? void 0 : () => this.stop().catch(() => {
|
|
5429
5562
|
}));
|
|
5430
5563
|
this._workerSlots[workerIndex].jobDispatcher = jobDispatcher;
|
|
5431
5564
|
void this._runJobInWorker(workerIndex, jobDispatcher).then(() => {
|
|
@@ -5447,7 +5580,7 @@ var Dispatcher = class {
|
|
|
5447
5580
|
}
|
|
5448
5581
|
let startError;
|
|
5449
5582
|
if (!worker) {
|
|
5450
|
-
worker = this._createWorker(job, index,
|
|
5583
|
+
worker = this._createWorker(job, index, import_common7.ipc.serializeConfig(this._testRun.config, true));
|
|
5451
5584
|
this._workerSlots[index].worker = worker;
|
|
5452
5585
|
worker.on("exit", () => this._workerSlots[index].worker = void 0);
|
|
5453
5586
|
startError = await worker.start();
|
|
@@ -5467,9 +5600,16 @@ var Dispatcher = class {
|
|
|
5467
5600
|
);
|
|
5468
5601
|
else if (this._isWorkerRedundant(worker))
|
|
5469
5602
|
void worker.stop();
|
|
5470
|
-
if (!this._isStopped
|
|
5471
|
-
|
|
5472
|
-
|
|
5603
|
+
if (!this._isStopped) {
|
|
5604
|
+
if (result.remainingJob) {
|
|
5605
|
+
this._queue.unshift(result.remainingJob);
|
|
5606
|
+
this._updateCounterForWorkerHash(result.remainingJob.workerHash, 1);
|
|
5607
|
+
}
|
|
5608
|
+
if (result.isolatedRetriesJob) {
|
|
5609
|
+
this._isolatedJobs.add(result.isolatedRetriesJob);
|
|
5610
|
+
this._queue.push(result.isolatedRetriesJob);
|
|
5611
|
+
this._updateCounterForWorkerHash(result.isolatedRetriesJob.workerHash, 1);
|
|
5612
|
+
}
|
|
5473
5613
|
}
|
|
5474
5614
|
}
|
|
5475
5615
|
_checkFinished() {
|
|
@@ -5499,7 +5639,7 @@ var Dispatcher = class {
|
|
|
5499
5639
|
this._updateCounterForWorkerHash(group.workerHash, 1);
|
|
5500
5640
|
this._isStopped = false;
|
|
5501
5641
|
this._workerSlots = [];
|
|
5502
|
-
if (this._testRun.hasReachedMaxFailures())
|
|
5642
|
+
if (!this._ignoreMaxFailures && this._testRun.hasReachedMaxFailures())
|
|
5503
5643
|
void this.stop();
|
|
5504
5644
|
for (let i = 0; i < this._testRun.config.config.workers; i++)
|
|
5505
5645
|
this._workerSlots.push({});
|
|
@@ -5572,7 +5712,7 @@ var Dispatcher = class {
|
|
|
5572
5712
|
}
|
|
5573
5713
|
};
|
|
5574
5714
|
var JobDispatcher = class {
|
|
5575
|
-
constructor(job, testRun,
|
|
5715
|
+
constructor(job, testRun, onMaxFailuresReached) {
|
|
5576
5716
|
this.jobResult = new ManualPromise3();
|
|
5577
5717
|
this._listeners = [];
|
|
5578
5718
|
this._failedTests = /* @__PURE__ */ new Set();
|
|
@@ -5583,9 +5723,12 @@ var JobDispatcher = class {
|
|
|
5583
5723
|
this._workerIndex = 0;
|
|
5584
5724
|
this.job = job;
|
|
5585
5725
|
this._testRun = testRun;
|
|
5586
|
-
this.
|
|
5726
|
+
this._onMaxFailuresReached = onMaxFailuresReached;
|
|
5587
5727
|
this._remainingByTestId = new Map(this.job.tests.map((e) => [e.id, e]));
|
|
5588
5728
|
}
|
|
5729
|
+
_isStoppedByMaxFailures() {
|
|
5730
|
+
return !!this._onMaxFailuresReached && this._testRun.hasReachedMaxFailures();
|
|
5731
|
+
}
|
|
5589
5732
|
_onTestBegin(params) {
|
|
5590
5733
|
const test = this._remainingByTestId.get(params.testId);
|
|
5591
5734
|
if (!test) {
|
|
@@ -5600,7 +5743,7 @@ var JobDispatcher = class {
|
|
|
5600
5743
|
this._currentlyRunning = { test, result };
|
|
5601
5744
|
}
|
|
5602
5745
|
_onTestEnd(params) {
|
|
5603
|
-
if (this.
|
|
5746
|
+
if (this._isStoppedByMaxFailures()) {
|
|
5604
5747
|
params.status = "interrupted";
|
|
5605
5748
|
params.errors = [];
|
|
5606
5749
|
}
|
|
@@ -5720,7 +5863,7 @@ var JobDispatcher = class {
|
|
|
5720
5863
|
for (const test of this._remainingByTestId.values()) {
|
|
5721
5864
|
if (!testIds.has(test.id))
|
|
5722
5865
|
continue;
|
|
5723
|
-
if (!this.
|
|
5866
|
+
if (!this._isStoppedByMaxFailures()) {
|
|
5724
5867
|
this._failTestWithErrors(test, errors);
|
|
5725
5868
|
errors = [];
|
|
5726
5869
|
}
|
|
@@ -5779,12 +5922,18 @@ var JobDispatcher = class {
|
|
|
5779
5922
|
serialSuite.allTests().forEach((test) => retryCandidates.add(test));
|
|
5780
5923
|
}
|
|
5781
5924
|
const remaining = [...this._remainingByTestId.values()];
|
|
5925
|
+
const isolatedRetries = [];
|
|
5782
5926
|
for (const test of retryCandidates) {
|
|
5783
|
-
if (test.results.length < test.retries + 1)
|
|
5784
|
-
|
|
5927
|
+
if (test.results.length < test.retries + 1) {
|
|
5928
|
+
if (this._testRun.config.retryStrategy === "immediate")
|
|
5929
|
+
remaining.push(test);
|
|
5930
|
+
else
|
|
5931
|
+
isolatedRetries.push(test);
|
|
5932
|
+
}
|
|
5785
5933
|
}
|
|
5786
|
-
const
|
|
5787
|
-
|
|
5934
|
+
const remainingJob = remaining.length ? { ...this.job, tests: remaining } : void 0;
|
|
5935
|
+
const isolatedRetriesJob = isolatedRetries.length ? { ...this.job, tests: isolatedRetries } : void 0;
|
|
5936
|
+
this._finished({ didFail: true, remainingJob, isolatedRetriesJob });
|
|
5788
5937
|
}
|
|
5789
5938
|
onExit(data) {
|
|
5790
5939
|
const unexpectedExitError = data.unexpectedly ? {
|
|
@@ -5802,7 +5951,7 @@ var JobDispatcher = class {
|
|
|
5802
5951
|
const runPayload = {
|
|
5803
5952
|
file: this.job.requireFile,
|
|
5804
5953
|
entries: this.job.tests.map((test) => {
|
|
5805
|
-
return { testId: test.id, retry: test.results.length };
|
|
5954
|
+
return { testId: test.id, retry: test.results.length, planAnnotations: test._planAnnotations };
|
|
5806
5955
|
})
|
|
5807
5956
|
};
|
|
5808
5957
|
worker.runTestGroup(runPayload);
|
|
@@ -5831,7 +5980,7 @@ var JobDispatcher = class {
|
|
|
5831
5980
|
addLocationAndSnippetToError(this._testRun.config.config, response.error);
|
|
5832
5981
|
return response;
|
|
5833
5982
|
} catch (e) {
|
|
5834
|
-
const error = (0,
|
|
5983
|
+
const error = (0, import_util11.serializeError)(e);
|
|
5835
5984
|
addLocationAndSnippetToError(this._testRun.config.config, error);
|
|
5836
5985
|
return { response: void 0, error };
|
|
5837
5986
|
}
|
|
@@ -5846,7 +5995,7 @@ var JobDispatcher = class {
|
|
|
5846
5995
|
}
|
|
5847
5996
|
skipWholeJob() {
|
|
5848
5997
|
const allTestsSkipped = this.job.tests.every((test) => test.expectedStatus === "skipped");
|
|
5849
|
-
if (allTestsSkipped && !this.
|
|
5998
|
+
if (allTestsSkipped && !this._isStoppedByMaxFailures()) {
|
|
5850
5999
|
for (const test of this.job.tests) {
|
|
5851
6000
|
const result = test._appendTestResult();
|
|
5852
6001
|
this._testRun.reporter.onTestBegin?.(test, result);
|
|
@@ -5863,11 +6012,11 @@ var JobDispatcher = class {
|
|
|
5863
6012
|
}
|
|
5864
6013
|
_reportTestEnd(test, result) {
|
|
5865
6014
|
this._testRun.reporter.onTestEnd?.(test, result);
|
|
5866
|
-
const hadMaxFailures = this.
|
|
6015
|
+
const hadMaxFailures = this._isStoppedByMaxFailures();
|
|
5867
6016
|
if (test.outcome() === "unexpected" && test.results.length > test.retries)
|
|
5868
6017
|
++this._testRun.failedTestCount;
|
|
5869
|
-
if (!hadMaxFailures && this.
|
|
5870
|
-
this.
|
|
6018
|
+
if (!hadMaxFailures && this._isStoppedByMaxFailures()) {
|
|
6019
|
+
this._onMaxFailuresReached?.();
|
|
5871
6020
|
this._testRun.reporter.onError?.({ message: colors4.red(`Testing stopped early after ${this._testRun.config.config.maxFailures} maximum allowed failures.`) });
|
|
5872
6021
|
}
|
|
5873
6022
|
}
|
|
@@ -5950,7 +6099,7 @@ var FixedNodeSIGINTHandler = class {
|
|
|
5950
6099
|
};
|
|
5951
6100
|
|
|
5952
6101
|
// packages/playwright/src/runner/taskRunner.ts
|
|
5953
|
-
var
|
|
6102
|
+
var import_util12 = require("../util");
|
|
5954
6103
|
var colors5 = require("playwright-core/lib/utilsBundle").colors;
|
|
5955
6104
|
var debug4 = require("playwright-core/lib/utilsBundle").debug;
|
|
5956
6105
|
var { ManualPromise: ManualPromise4 } = require("playwright-core/lib/coreBundle").iso;
|
|
@@ -5991,7 +6140,7 @@ var TaskRunner = class _TaskRunner {
|
|
|
5991
6140
|
await task.setup?.(context, errors, softErrors);
|
|
5992
6141
|
} catch (e) {
|
|
5993
6142
|
debug4("pw:test:task")(`error in "${task.title}": `, e);
|
|
5994
|
-
errors.push((0,
|
|
6143
|
+
errors.push((0, import_util12.serializeError)(e));
|
|
5995
6144
|
} finally {
|
|
5996
6145
|
for (const error of [...softErrors, ...errors])
|
|
5997
6146
|
this._reporter.onError?.(error);
|
|
@@ -6054,7 +6203,7 @@ var TimeoutWatcher = class {
|
|
|
6054
6203
|
// packages/playwright/src/runner/vcs.ts
|
|
6055
6204
|
var import_child_process2 = __toESM(require("child_process"));
|
|
6056
6205
|
var import_path14 = __toESM(require("path"));
|
|
6057
|
-
var
|
|
6206
|
+
var import_common8 = require("../common");
|
|
6058
6207
|
async function detectChangedTestFiles(baseCommit, configDir) {
|
|
6059
6208
|
function gitFileList(args) {
|
|
6060
6209
|
try {
|
|
@@ -6086,17 +6235,17 @@ async function detectChangedTestFiles(baseCommit, configDir) {
|
|
|
6086
6235
|
const untrackedFiles = gitFileList(["ls-files", "--others", "--exclude-standard"]).map((file) => import_path14.default.join(configDir, file));
|
|
6087
6236
|
const [gitRoot] = gitFileList(["rev-parse", "--show-toplevel"]);
|
|
6088
6237
|
const trackedFilesWithChanges = gitFileList(["diff", baseCommit, "--name-only"]).map((file) => import_path14.default.join(gitRoot, file));
|
|
6089
|
-
return new Set(
|
|
6238
|
+
return new Set(import_common8.cc.affectedTestFiles([...untrackedFiles, ...trackedFilesWithChanges]));
|
|
6090
6239
|
}
|
|
6091
6240
|
|
|
6092
6241
|
// packages/playwright/src/runner/tasks.ts
|
|
6093
|
-
var
|
|
6094
|
-
var
|
|
6242
|
+
var import_common9 = require("../common");
|
|
6243
|
+
var import_util14 = require("../util");
|
|
6095
6244
|
var debug5 = require("playwright-core/lib/utilsBundle").debug;
|
|
6096
6245
|
var { ManualPromise: ManualPromise5 } = require("playwright-core/lib/coreBundle").iso;
|
|
6097
6246
|
var { monotonicTime: monotonicTime6 } = require("playwright-core/lib/coreBundle").iso;
|
|
6098
6247
|
var { removeFolders: removeFolders4 } = require("playwright-core/lib/coreBundle").utils;
|
|
6099
|
-
var readDirAsync2 = (0,
|
|
6248
|
+
var readDirAsync2 = (0, import_util13.promisify)(import_fs11.default.readdir);
|
|
6100
6249
|
var TestRun = class {
|
|
6101
6250
|
constructor(config2, reporter, options) {
|
|
6102
6251
|
this.rootSuite = void 0;
|
|
@@ -6124,7 +6273,7 @@ var TestRun = class {
|
|
|
6124
6273
|
result() {
|
|
6125
6274
|
const hasFailedTests = this.rootSuite?.allTests().some((test) => !test.ok());
|
|
6126
6275
|
const hasFlakyTests = this.rootSuite?.allTests().some((test) => test.outcome() === "flaky");
|
|
6127
|
-
return this.hasWorkerErrors || this.hasReachedMaxFailures() || hasFailedTests || this.config.config.failOnFlakyTests && hasFlakyTests ? "failed" : "passed";
|
|
6276
|
+
return this.hasWorkerErrors || this.reporter.hasReporterErrors() || this.hasReachedMaxFailures() || hasFailedTests || this.config.config.failOnFlakyTests && hasFlakyTests ? "failed" : "passed";
|
|
6128
6277
|
}
|
|
6129
6278
|
};
|
|
6130
6279
|
async function runTasks(testRun, tasks, globalTimeout, cancelPromise) {
|
|
@@ -6151,6 +6300,8 @@ async function finishTaskRun(testRun, status) {
|
|
|
6151
6300
|
if (modifiedResult && modifiedResult.status)
|
|
6152
6301
|
status = modifiedResult.status;
|
|
6153
6302
|
await testRun.reporter.onExit();
|
|
6303
|
+
if (status === "passed" && testRun.reporter.hasReporterErrors())
|
|
6304
|
+
status = "failed";
|
|
6154
6305
|
return status;
|
|
6155
6306
|
}
|
|
6156
6307
|
function createGlobalSetupTasks(config2) {
|
|
@@ -6173,7 +6324,7 @@ function createClearCacheTask(config2) {
|
|
|
6173
6324
|
return {
|
|
6174
6325
|
title: "clear cache",
|
|
6175
6326
|
setup: async () => {
|
|
6176
|
-
await (0,
|
|
6327
|
+
await (0, import_util14.removeDirAndLogToConsole)(import_common9.cc.cacheDir);
|
|
6177
6328
|
for (const plugin of config2.plugins)
|
|
6178
6329
|
await plugin.instance?.clearCache?.();
|
|
6179
6330
|
}
|
|
@@ -6272,12 +6423,12 @@ function createListFilesTask() {
|
|
|
6272
6423
|
await createRootSuite(testRun, errors, false);
|
|
6273
6424
|
await collectProjectsAndTestFiles(testRun, false);
|
|
6274
6425
|
for (const [project, files] of testRun.projectFiles) {
|
|
6275
|
-
const projectSuite = new
|
|
6426
|
+
const projectSuite = new import_common9.test.Suite(project.project.name, "project");
|
|
6276
6427
|
projectSuite._fullProject = project;
|
|
6277
6428
|
testRun.rootSuite._addSuite(projectSuite);
|
|
6278
6429
|
const suites = files.map((file) => {
|
|
6279
6430
|
const title = import_path15.default.relative(testRun.config.config.rootDir, file);
|
|
6280
|
-
const suite = new
|
|
6431
|
+
const suite = new import_common9.test.Suite(title, "file");
|
|
6281
6432
|
suite.location = { file, line: 0, column: 0 };
|
|
6282
6433
|
projectSuite._addSuite(suite);
|
|
6283
6434
|
return suite;
|
|
@@ -6292,7 +6443,7 @@ function createLoadTask(mode, options) {
|
|
|
6292
6443
|
title: "load tests",
|
|
6293
6444
|
setup: async (testRun, errors, softErrors) => {
|
|
6294
6445
|
if (testRun.options.locations?.length) {
|
|
6295
|
-
const { testFilter, fileFilter } =
|
|
6446
|
+
const { testFilter, fileFilter } = import_common9.suiteUtils.createFiltersFromArguments(testRun.options.locations);
|
|
6296
6447
|
testRun.loadFileFilters.push(fileFilter);
|
|
6297
6448
|
testRun.preOnlyTestFilters.push(testFilter);
|
|
6298
6449
|
}
|
|
@@ -6306,14 +6457,14 @@ function createLoadTask(mode, options) {
|
|
|
6306
6457
|
testRun.preOnlyTestFilters.push((test) => !testFilter(test));
|
|
6307
6458
|
}
|
|
6308
6459
|
if (testRun.options.grep || testRun.options.grepInvert) {
|
|
6309
|
-
const grepMatcher = testRun.options.grep ? (0,
|
|
6310
|
-
const grepInvertMatcher = testRun.options.grepInvert ? (0,
|
|
6460
|
+
const grepMatcher = testRun.options.grep ? (0, import_util14.createTitleMatcher)((0, import_util14.forceRegExp)(testRun.options.grep)) : () => true;
|
|
6461
|
+
const grepInvertMatcher = testRun.options.grepInvert ? (0, import_util14.createTitleMatcher)((0, import_util14.forceRegExp)(testRun.options.grepInvert)) : () => false;
|
|
6311
6462
|
testRun.preOnlyTestFilters.push((test) => {
|
|
6312
6463
|
const grepTitle = test._grepTitleWithTags();
|
|
6313
6464
|
return !grepInvertMatcher(grepTitle) && grepMatcher(grepTitle);
|
|
6314
6465
|
});
|
|
6315
6466
|
}
|
|
6316
|
-
if (testRun.options.lastFailedTestIds
|
|
6467
|
+
if (testRun.options.lastFailedTestIds) {
|
|
6317
6468
|
const failedTestIds = new Set(testRun.options.lastFailedTestIds);
|
|
6318
6469
|
testRun.postShardTestFilters.push((test) => failedTestIds.has(test.id));
|
|
6319
6470
|
}
|
|
@@ -6361,6 +6512,7 @@ function createPhasesTask() {
|
|
|
6361
6512
|
const projectToSuite = new Map(testRun.rootSuite.suites.map((suite) => [suite._fullProject, suite]));
|
|
6362
6513
|
const allProjects = [...projectToSuite.keys()];
|
|
6363
6514
|
const teardownToSetups = buildTeardownToSetupsMap(allProjects);
|
|
6515
|
+
const ignoreMaxFailuresProjectIds = new Set(testRun.config.config.maxFailures > 0 ? [...teardownToSetups.keys()].map((project) => project.id) : []);
|
|
6364
6516
|
const teardownToSetupsDependents = /* @__PURE__ */ new Map();
|
|
6365
6517
|
for (const [teardown, setups] of teardownToSetups) {
|
|
6366
6518
|
const closure = buildDependentProjects(setups, allProjects);
|
|
@@ -6379,11 +6531,14 @@ function createPhasesTask() {
|
|
|
6379
6531
|
}
|
|
6380
6532
|
for (const project of phaseProjects)
|
|
6381
6533
|
processed.add(project);
|
|
6382
|
-
|
|
6534
|
+
for (const ignoreMaxFailures of [false, true]) {
|
|
6535
|
+
const projects = phaseProjects.filter((project) => ignoreMaxFailuresProjectIds.has(project.id) === ignoreMaxFailures);
|
|
6536
|
+
if (!projects.length)
|
|
6537
|
+
continue;
|
|
6383
6538
|
let testGroupsInPhase = 0;
|
|
6384
|
-
const phase = { dispatcher: new Dispatcher(testRun), projects: [] };
|
|
6539
|
+
const phase = { dispatcher: new Dispatcher(testRun, { ignoreMaxFailures }), projects: [] };
|
|
6385
6540
|
testRun.phases.push(phase);
|
|
6386
|
-
for (const project of
|
|
6541
|
+
for (const project of projects) {
|
|
6387
6542
|
const projectSuite = projectToSuite.get(project);
|
|
6388
6543
|
const testGroups = createTestGroups(projectSuite, testRun.config.config.workers);
|
|
6389
6544
|
phase.projects.push({ project, projectSuite, testGroups });
|
|
@@ -6458,12 +6613,12 @@ var LastRunReporter = class {
|
|
|
6458
6613
|
}
|
|
6459
6614
|
async filterLastFailed() {
|
|
6460
6615
|
if (!this._lastRunFile)
|
|
6461
|
-
return
|
|
6616
|
+
return void 0;
|
|
6462
6617
|
try {
|
|
6463
6618
|
const lastRunInfo = JSON.parse(await import_fs12.default.promises.readFile(this._lastRunFile, "utf8"));
|
|
6464
6619
|
return lastRunInfo.failedTests;
|
|
6465
6620
|
} catch {
|
|
6466
|
-
return
|
|
6621
|
+
return void 0;
|
|
6467
6622
|
}
|
|
6468
6623
|
}
|
|
6469
6624
|
version() {
|
|
@@ -6509,7 +6664,7 @@ var TestRunner = class extends import_events2.default {
|
|
|
6509
6664
|
this._configCLIOverrides = configCLIOverrides;
|
|
6510
6665
|
this._watcher = new FSWatcher((events) => {
|
|
6511
6666
|
const collector = /* @__PURE__ */ new Set();
|
|
6512
|
-
events.forEach((f) =>
|
|
6667
|
+
events.forEach((f) => import_common10.cc.collectAffectedTestFiles(f.file, collector));
|
|
6513
6668
|
this.emit(TestRunnerEvent.TestFilesChanged, [...collector]);
|
|
6514
6669
|
});
|
|
6515
6670
|
}
|
|
@@ -6719,7 +6874,7 @@ var TestRunner = class extends import_events2.default {
|
|
|
6719
6874
|
this._watchedTestDependencies = /* @__PURE__ */ new Set();
|
|
6720
6875
|
for (const fileName of fileNames) {
|
|
6721
6876
|
this._watchedTestDependencies.add(fileName);
|
|
6722
|
-
|
|
6877
|
+
import_common10.cc.dependenciesForTestFile(fileName).forEach((file) => this._watchedTestDependencies.add(file));
|
|
6723
6878
|
}
|
|
6724
6879
|
await this._updateWatcher(true);
|
|
6725
6880
|
}
|
|
@@ -6735,7 +6890,7 @@ var TestRunner = class extends import_events2.default {
|
|
|
6735
6890
|
]);
|
|
6736
6891
|
if (status !== "passed")
|
|
6737
6892
|
return { errors: errorReporter.errors(), testFiles: [] };
|
|
6738
|
-
return { testFiles:
|
|
6893
|
+
return { testFiles: import_common10.cc.affectedTestFiles(files) };
|
|
6739
6894
|
}
|
|
6740
6895
|
async stopTests() {
|
|
6741
6896
|
this._testRun?.stop?.resolve();
|
|
@@ -6749,7 +6904,7 @@ var TestRunner = class extends import_events2.default {
|
|
|
6749
6904
|
}
|
|
6750
6905
|
async _loadConfig(overrides) {
|
|
6751
6906
|
try {
|
|
6752
|
-
const config2 = await
|
|
6907
|
+
const config2 = await import_common10.configLoader.loadConfig(this.configLocation, overrides);
|
|
6753
6908
|
if (!this._plugins) {
|
|
6754
6909
|
webServerPluginsForConfig(config2).forEach((p) => config2.plugins.push({ factory: p }));
|
|
6755
6910
|
addGitCommitInfoPlugin(config2);
|
|
@@ -6760,7 +6915,7 @@ var TestRunner = class extends import_events2.default {
|
|
|
6760
6915
|
this._lastLoadedConfig = config2;
|
|
6761
6916
|
return { config: config2 };
|
|
6762
6917
|
} catch (e) {
|
|
6763
|
-
return { config: null, error: (0,
|
|
6918
|
+
return { config: null, error: (0, import_util15.serializeError)(e) };
|
|
6764
6919
|
}
|
|
6765
6920
|
}
|
|
6766
6921
|
lastLoadedConfig() {
|
|
@@ -6801,7 +6956,7 @@ async function runAllTestsWithConfig(config2, options) {
|
|
|
6801
6956
|
const lastRun = new LastRunReporter(filteredProjects, options.listMode, options.lastFailedFile);
|
|
6802
6957
|
if (options.lastFailed) {
|
|
6803
6958
|
const lastFailedTestIds = await lastRun.filterLastFailed();
|
|
6804
|
-
if (lastFailedTestIds
|
|
6959
|
+
if (lastFailedTestIds)
|
|
6805
6960
|
options = { ...options, lastFailedTestIds };
|
|
6806
6961
|
}
|
|
6807
6962
|
const reporter = new InternalReporter([...reporters, lastRun]);
|
|
@@ -6828,9 +6983,9 @@ __export(testServer_exports, {
|
|
|
6828
6983
|
runTestServer: () => runTestServer,
|
|
6829
6984
|
runUIMode: () => runUIMode
|
|
6830
6985
|
});
|
|
6831
|
-
var
|
|
6986
|
+
var import_util16 = __toESM(require("util"));
|
|
6832
6987
|
var import_coreBundle3 = require("playwright-core/lib/coreBundle");
|
|
6833
|
-
var
|
|
6988
|
+
var import_common11 = require("../common");
|
|
6834
6989
|
|
|
6835
6990
|
// packages/playwright/src/runner/uiModeReporter.ts
|
|
6836
6991
|
var UIModeReporter = class extends TeleReporterEmitter {
|
|
@@ -6988,7 +7143,7 @@ var TestServerDispatcher = class {
|
|
|
6988
7143
|
if (interceptStdio) {
|
|
6989
7144
|
if (debug6.log === originalDebugLog) {
|
|
6990
7145
|
debug6.log = (...args) => {
|
|
6991
|
-
const string =
|
|
7146
|
+
const string = import_util16.default.format(...args) + "\n";
|
|
6992
7147
|
return originalStderrWrite.apply(process.stderr, [string]);
|
|
6993
7148
|
};
|
|
6994
7149
|
}
|
|
@@ -7012,7 +7167,7 @@ var TestServerDispatcher = class {
|
|
|
7012
7167
|
}
|
|
7013
7168
|
};
|
|
7014
7169
|
async function runUIMode(configFile, configCLIOverrides, options) {
|
|
7015
|
-
const configLocation =
|
|
7170
|
+
const configLocation = import_common11.configLoader.resolveConfigLocation(configFile);
|
|
7016
7171
|
return await innerRunTestServer(configLocation, configCLIOverrides, options, async (server, cancelPromise) => {
|
|
7017
7172
|
await import_coreBundle3.server.installRootRedirect(server, void 0, { ...options, webApp: "uiMode.html" });
|
|
7018
7173
|
if (options.host !== void 0 || options.port !== void 0) {
|
|
@@ -7031,7 +7186,7 @@ async function runUIMode(configFile, configCLIOverrides, options) {
|
|
|
7031
7186
|
});
|
|
7032
7187
|
}
|
|
7033
7188
|
async function installedChromiumChannelForUI(configLocation, configCLIOverrides) {
|
|
7034
|
-
const config2 = await
|
|
7189
|
+
const config2 = await import_common11.configLoader.loadConfig(configLocation, configCLIOverrides).catch((e) => null);
|
|
7035
7190
|
if (!config2)
|
|
7036
7191
|
return void 0;
|
|
7037
7192
|
if (config2.projects.some((p) => (!p.project.use.browserName || p.project.use.browserName === "chromium") && !p.project.use.channel))
|
|
@@ -7043,7 +7198,7 @@ async function installedChromiumChannelForUI(configLocation, configCLIOverrides)
|
|
|
7043
7198
|
return void 0;
|
|
7044
7199
|
}
|
|
7045
7200
|
async function runTestServer(configFile, configCLIOverrides, options) {
|
|
7046
|
-
const configLocation =
|
|
7201
|
+
const configLocation = import_common11.configLoader.resolveConfigLocation(configFile);
|
|
7047
7202
|
return await innerRunTestServer(configLocation, configCLIOverrides, options, async (server) => {
|
|
7048
7203
|
console.log("Listening on " + server.urlPrefix("precise").replace("http:", "ws:") + "/" + server.wsGuid());
|
|
7049
7204
|
});
|
|
@@ -7087,7 +7242,7 @@ var import_events3 = require("events");
|
|
|
7087
7242
|
var import_coreBundle4 = require("playwright-core/lib/coreBundle");
|
|
7088
7243
|
|
|
7089
7244
|
// packages/playwright/src/isomorphic/testTree.ts
|
|
7090
|
-
var statusEx = Symbol("statusEx");
|
|
7245
|
+
var statusEx = /* @__PURE__ */ Symbol("statusEx");
|
|
7091
7246
|
|
|
7092
7247
|
// packages/playwright/src/isomorphic/teleSuiteUpdater.ts
|
|
7093
7248
|
var TeleSuiteUpdater = class {
|
|
@@ -7830,7 +7985,7 @@ var JsonStringInternalizer = class {
|
|
|
7830
7985
|
};
|
|
7831
7986
|
|
|
7832
7987
|
// packages/playwright/src/reporters/merge.ts
|
|
7833
|
-
var
|
|
7988
|
+
var import_util17 = require("../util");
|
|
7834
7989
|
var { isPathInside } = require("playwright-core/lib/coreBundle").utils;
|
|
7835
7990
|
var { ZipFile } = require("playwright-core/lib/coreBundle").utils;
|
|
7836
7991
|
async function createMergedReport(config2, dir, reporterDescriptions, rootDirOverride) {
|
|
@@ -7895,6 +8050,7 @@ async function createMergedReport(config2, dir, reporterDescriptions, rootDirOve
|
|
|
7895
8050
|
});
|
|
7896
8051
|
}
|
|
7897
8052
|
await dispatchEvents(eventData.epilogue);
|
|
8053
|
+
return multiplexer.hasReporterErrors() ? "failed" : "passed";
|
|
7898
8054
|
}
|
|
7899
8055
|
var commonEventNames = ["onBlobReportMetadata", "onConfigure", "onProject", "onBegin", "onEnd"];
|
|
7900
8056
|
var commonEvents = new Set(commonEventNames);
|
|
@@ -7925,7 +8081,7 @@ async function extractAndParseReports(dir, shardFiles, internalizer, printStatus
|
|
|
7925
8081
|
const reportNames = new UniqueFileNameGenerator();
|
|
7926
8082
|
for (const file of shardFiles) {
|
|
7927
8083
|
const absolutePath = import_path19.default.join(dir, file);
|
|
7928
|
-
printStatus(`extracting: ${(0,
|
|
8084
|
+
printStatus(`extracting: ${(0, import_util17.relativeFilePath)(absolutePath)}`);
|
|
7929
8085
|
const zipFile = new ZipFile(absolutePath);
|
|
7930
8086
|
const entryNames = await zipFile.entries();
|
|
7931
8087
|
for (const entryName of entryNames.sort()) {
|