patchwright 1.64.1 → 1.65.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/README.md +116 -145
- package/helpers.mjs +387 -0
- package/lib/cli/testActions.js +0 -1
- package/lib/common/index.js +142 -65
- package/lib/common/index.js.txt +7 -7
- package/lib/matchers/expect.js +56 -30
- package/lib/matchers/expect.js.LICENSE +3 -3
- package/lib/matchers/expect.js.txt +4 -4
- package/lib/mcp/test/testContext.js +2 -8
- package/lib/runner/index.js +500 -401
- package/lib/runner/index.js.txt +24 -23
- package/lib/transform/babelBundle.js +81 -57
- package/lib/transform/babelBundle.js.txt +2 -2
- package/lib/transform/esmLoader.js +361 -163
- package/lib/transform/esmLoader.js.LICENSE +3 -3
- package/lib/transform/esmLoader.js.txt +9 -8
- package/lib/worker/workerProcessEntry.js +6 -14
- package/lib/worker/workerProcessEntry.js.txt +2 -2
- package/package.json +6 -5
- package/types/test.d.ts +365 -41
- package/types/testReporter.d.ts +22 -2
package/lib/runner/index.js
CHANGED
|
@@ -57,53 +57,135 @@ var import_coreBundle3 = require("patchwright-core/lib/coreBundle");
|
|
|
57
57
|
var import_common10 = require("../common");
|
|
58
58
|
|
|
59
59
|
// packages/playwright/src/runner/fsWatcher.ts
|
|
60
|
-
var
|
|
60
|
+
var import_fs = __toESM(require("fs"));
|
|
61
|
+
var import_path = __toESM(require("path"));
|
|
62
|
+
var kNativeRecursiveWatch = process.platform === "darwin" || process.platform === "win32";
|
|
61
63
|
var FSWatcher = class {
|
|
62
64
|
constructor(onChange) {
|
|
63
|
-
this.
|
|
64
|
-
this.
|
|
65
|
-
this.
|
|
65
|
+
this._params = { paths: [], ignoredFolders: [] };
|
|
66
|
+
this._watchedFiles = /* @__PURE__ */ new Set();
|
|
67
|
+
this._watchers = /* @__PURE__ */ new Map();
|
|
68
|
+
this._collector = /* @__PURE__ */ new Set();
|
|
66
69
|
this._onChange = onChange;
|
|
67
70
|
}
|
|
68
|
-
async update(
|
|
69
|
-
if (JSON.stringify(
|
|
71
|
+
async update(params, reportPending) {
|
|
72
|
+
if (JSON.stringify(this._params) === JSON.stringify(params))
|
|
70
73
|
return;
|
|
71
74
|
if (reportPending)
|
|
72
75
|
this._reportEventsIfAny();
|
|
73
|
-
this.
|
|
74
|
-
this.
|
|
75
|
-
|
|
76
|
-
this._fsWatcher = void 0;
|
|
77
|
-
this._collector.length = 0;
|
|
76
|
+
this._params = params;
|
|
77
|
+
this._closeAll();
|
|
78
|
+
this._collector.clear();
|
|
78
79
|
clearTimeout(this._throttleTimer);
|
|
79
80
|
this._throttleTimer = void 0;
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
const
|
|
83
|
-
const
|
|
84
|
-
if (
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
this.
|
|
94
|
-
this._throttleTimer = setTimeout(() => this._reportEventsIfAny(), 250);
|
|
95
|
-
});
|
|
96
|
-
await new Promise((resolve, reject) => this._fsWatcher.once("ready", () => resolve()).once("error", reject));
|
|
81
|
+
const paths = params.paths.map((p) => p.length > 1 && p.endsWith(import_path.default.sep) ? p.slice(0, -1) : p);
|
|
82
|
+
const dirs = new Set(paths.filter((p) => isDirectory(p)));
|
|
83
|
+
const isCovered = (p) => [...dirs].some((dir) => isInside(dir, p));
|
|
84
|
+
for (const dir of dirs) {
|
|
85
|
+
if (isCovered(dir))
|
|
86
|
+
continue;
|
|
87
|
+
if (kNativeRecursiveWatch)
|
|
88
|
+
this._watch(dir, true, (file) => this._onDirEvent(file));
|
|
89
|
+
else
|
|
90
|
+
this._watchTree(dir);
|
|
91
|
+
}
|
|
92
|
+
this._watchedFiles = new Set(paths.filter((p) => !dirs.has(p) && !isCovered(p)));
|
|
93
|
+
for (const dir of new Set([...this._watchedFiles].map((file) => import_path.default.dirname(file))))
|
|
94
|
+
this._watch(dir, false, (file) => this._onFileEvent(file));
|
|
97
95
|
}
|
|
98
96
|
async close() {
|
|
99
|
-
|
|
97
|
+
this._closeAll();
|
|
98
|
+
clearTimeout(this._throttleTimer);
|
|
99
|
+
this._throttleTimer = void 0;
|
|
100
|
+
}
|
|
101
|
+
_watch(dir, recursive, onEvent) {
|
|
102
|
+
if (this._watchers.has(dir))
|
|
103
|
+
return;
|
|
104
|
+
try {
|
|
105
|
+
const watcher = import_fs.default.watch(dir, { persistent: true, recursive }, (eventType, filename) => {
|
|
106
|
+
onEvent(filename ? import_path.default.join(dir, filename) : dir);
|
|
107
|
+
});
|
|
108
|
+
watcher.on("error", () => this._close(dir));
|
|
109
|
+
this._watchers.set(dir, watcher);
|
|
110
|
+
} catch {
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
_watchTree(dir) {
|
|
114
|
+
if (this._isIgnored(dir) || this._watchers.has(dir))
|
|
115
|
+
return;
|
|
116
|
+
this._watch(dir, false, (file) => this._onTreeEvent(file));
|
|
117
|
+
if (!this._watchers.has(dir))
|
|
118
|
+
return;
|
|
119
|
+
let entries = [];
|
|
120
|
+
try {
|
|
121
|
+
entries = import_fs.default.readdirSync(dir, { withFileTypes: true });
|
|
122
|
+
} catch {
|
|
123
|
+
}
|
|
124
|
+
for (const entry of entries) {
|
|
125
|
+
if (entry.isDirectory())
|
|
126
|
+
this._watchTree(import_path.default.join(dir, entry.name));
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
_onDirEvent(file) {
|
|
130
|
+
if (!this._isIgnored(file))
|
|
131
|
+
this._collect(file);
|
|
132
|
+
}
|
|
133
|
+
_onTreeEvent(file) {
|
|
134
|
+
if (this._isIgnored(file))
|
|
135
|
+
return;
|
|
136
|
+
this._collect(file);
|
|
137
|
+
if (this._watchers.has(file)) {
|
|
138
|
+
if (!isDirectory(file))
|
|
139
|
+
this._closeTree(file);
|
|
140
|
+
} else if (isDirectory(file)) {
|
|
141
|
+
this._watchTree(file);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
_onFileEvent(file) {
|
|
145
|
+
if (this._watchedFiles.has(file))
|
|
146
|
+
this._collect(file);
|
|
147
|
+
}
|
|
148
|
+
_isIgnored(file) {
|
|
149
|
+
if (file.split(import_path.default.sep).includes("node_modules"))
|
|
150
|
+
return true;
|
|
151
|
+
return this._params.ignoredFolders.some((folder) => file === folder || isInside(folder, file));
|
|
152
|
+
}
|
|
153
|
+
_collect(file) {
|
|
154
|
+
this._collector.add(file);
|
|
155
|
+
clearTimeout(this._throttleTimer);
|
|
156
|
+
this._throttleTimer = setTimeout(() => this._reportEventsIfAny(), 250);
|
|
100
157
|
}
|
|
101
158
|
_reportEventsIfAny() {
|
|
102
|
-
if (this._collector.
|
|
103
|
-
this._onChange(this._collector
|
|
104
|
-
this._collector.
|
|
159
|
+
if (this._collector.size)
|
|
160
|
+
this._onChange([...this._collector]);
|
|
161
|
+
this._collector.clear();
|
|
162
|
+
}
|
|
163
|
+
_close(dir) {
|
|
164
|
+
this._watchers.get(dir)?.close();
|
|
165
|
+
this._watchers.delete(dir);
|
|
166
|
+
}
|
|
167
|
+
_closeTree(dir) {
|
|
168
|
+
for (const watched of [...this._watchers.keys()]) {
|
|
169
|
+
if (watched === dir || isInside(dir, watched))
|
|
170
|
+
this._close(watched);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
_closeAll() {
|
|
174
|
+
for (const watcher of this._watchers.values())
|
|
175
|
+
watcher.close();
|
|
176
|
+
this._watchers.clear();
|
|
105
177
|
}
|
|
106
178
|
};
|
|
179
|
+
function isInside(dir, file) {
|
|
180
|
+
return file.startsWith(dir + import_path.default.sep);
|
|
181
|
+
}
|
|
182
|
+
function isDirectory(file) {
|
|
183
|
+
try {
|
|
184
|
+
return import_fs.default.lstatSync(file).isDirectory();
|
|
185
|
+
} catch {
|
|
186
|
+
return false;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
107
189
|
|
|
108
190
|
// packages/playwright/src/isomorphic/teleReceiver.ts
|
|
109
191
|
var TeleReporterReceiver = class {
|
|
@@ -136,10 +218,6 @@ var TeleReporterReceiver = class {
|
|
|
136
218
|
this._onTestBegin(params.testId, params.result);
|
|
137
219
|
return;
|
|
138
220
|
}
|
|
139
|
-
if (method === "onTestPaused") {
|
|
140
|
-
this._onTestPaused(params.testId, params.resultId, params.errors);
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
221
|
if (method === "onTestEnd") {
|
|
144
222
|
this._onTestEnd(params.test, params.result);
|
|
145
223
|
return;
|
|
@@ -206,13 +284,6 @@ var TeleReporterReceiver = class {
|
|
|
206
284
|
testResult.setStartTimeNumber(payload.startTime);
|
|
207
285
|
this._reporter.onTestBegin?.(test, testResult);
|
|
208
286
|
}
|
|
209
|
-
_onTestPaused(testId, resultId, errors) {
|
|
210
|
-
const test = this._tests.get(testId);
|
|
211
|
-
const result = test.results.find((r) => r._id === resultId);
|
|
212
|
-
result.errors.push(...errors);
|
|
213
|
-
result.error = result.errors[0];
|
|
214
|
-
void this._reporter.onTestPaused?.(test, result);
|
|
215
|
-
}
|
|
216
287
|
_onTestEnd(testEndPayload, payload) {
|
|
217
288
|
const test = this._tests.get(testEndPayload.testId);
|
|
218
289
|
test.timeout = testEndPayload.timeout;
|
|
@@ -642,7 +713,7 @@ function asFullConfig(config2) {
|
|
|
642
713
|
}
|
|
643
714
|
|
|
644
715
|
// packages/playwright/src/plugins/gitCommitInfoPlugin.ts
|
|
645
|
-
var
|
|
716
|
+
var fs2 = __toESM(require("fs"));
|
|
646
717
|
var { spawnAsync } = require("patchwright-core/lib/coreBundle").utils;
|
|
647
718
|
var GIT_OPERATIONS_TIMEOUT_MS = 3e3;
|
|
648
719
|
var addGitCommitInfoPlugin = (fullConfig) => {
|
|
@@ -687,7 +758,7 @@ async function ciInfo() {
|
|
|
687
758
|
if (process.env.GITHUB_ACTIONS) {
|
|
688
759
|
let pr;
|
|
689
760
|
try {
|
|
690
|
-
const json = JSON.parse(await
|
|
761
|
+
const json = JSON.parse(await fs2.promises.readFile(process.env.GITHUB_EVENT_PATH, "utf8"));
|
|
691
762
|
pr = { title: json.pull_request.title, number: json.pull_request.number, baseHash: json.pull_request.base.sha };
|
|
692
763
|
} catch {
|
|
693
764
|
}
|
|
@@ -812,7 +883,7 @@ ${result.stderr}`);
|
|
|
812
883
|
|
|
813
884
|
// packages/playwright/src/plugins/webServerPlugin.ts
|
|
814
885
|
var import_net = __toESM(require("net"));
|
|
815
|
-
var
|
|
886
|
+
var import_path2 = __toESM(require("path"));
|
|
816
887
|
var import_util = require("util");
|
|
817
888
|
var colors = require("patchwright-core/lib/utilsBundle").colors;
|
|
818
889
|
var debug2 = require("patchwright-core/lib/utilsBundle").debug;
|
|
@@ -838,7 +909,7 @@ var WebServerPlugin = class {
|
|
|
838
909
|
this._reporter = reporter;
|
|
839
910
|
if (this._options.url)
|
|
840
911
|
this._isAvailableCallback = getIsAvailableFunction(this._options.url, this._checkPortOnly, !!this._options.ignoreHTTPSErrors, this._reporter.onStdErr?.bind(this._reporter));
|
|
841
|
-
this._options.cwd = this._options.cwd ?
|
|
912
|
+
this._options.cwd = this._options.cwd ? import_path2.default.resolve(configDir, this._options.cwd) : configDir;
|
|
842
913
|
try {
|
|
843
914
|
await this._startProcess();
|
|
844
915
|
await this._waitForProcess();
|
|
@@ -1028,29 +1099,32 @@ function prefixOutputLines(output, prefixName = "WebServer") {
|
|
|
1028
1099
|
var base_exports = {};
|
|
1029
1100
|
__export(base_exports, {
|
|
1030
1101
|
TerminalReporter: () => TerminalReporter,
|
|
1102
|
+
createTestFilter: () => createTestFilter,
|
|
1103
|
+
filterTests: () => filterTests,
|
|
1031
1104
|
formatError: () => formatError,
|
|
1032
1105
|
formatFailure: () => formatFailure,
|
|
1033
1106
|
formatResultFailure: () => formatResultFailure,
|
|
1034
1107
|
formatRetry: () => formatRetry,
|
|
1035
1108
|
internalScreen: () => internalScreen,
|
|
1109
|
+
isFailure: () => isFailure,
|
|
1036
1110
|
kOutputSymbol: () => kOutputSymbol,
|
|
1037
|
-
markErrorsAsReported: () => markErrorsAsReported,
|
|
1038
1111
|
nonTerminalScreen: () => nonTerminalScreen,
|
|
1039
1112
|
prepareErrorStack: () => prepareErrorStack,
|
|
1040
1113
|
relativeFilePath: () => relativeFilePath,
|
|
1041
1114
|
resolveOutputFile: () => resolveOutputFile,
|
|
1042
1115
|
separator: () => separator,
|
|
1043
1116
|
stepSuffix: () => stepSuffix,
|
|
1044
|
-
terminalScreen: () => terminalScreen
|
|
1117
|
+
terminalScreen: () => terminalScreen,
|
|
1118
|
+
visitTests: () => visitTests
|
|
1045
1119
|
});
|
|
1046
|
-
var
|
|
1120
|
+
var import_path3 = __toESM(require("path"));
|
|
1047
1121
|
var import_stream = require("stream");
|
|
1048
1122
|
var import_util2 = require("../util");
|
|
1049
1123
|
var realColors = require("patchwright-core/lib/utilsBundle").colors;
|
|
1050
1124
|
var { noColors } = require("patchwright-core/lib/coreBundle").iso;
|
|
1051
1125
|
var { msToString } = require("patchwright-core/lib/coreBundle").iso;
|
|
1052
1126
|
var { parseErrorStack } = require("patchwright-core/lib/coreBundle").utils;
|
|
1053
|
-
var { getPackageManagerExecCommand } = require("patchwright-core/lib/coreBundle").utils;
|
|
1127
|
+
var { getAsBooleanFromENV, getPackageManagerExecCommand } = require("patchwright-core/lib/coreBundle").utils;
|
|
1054
1128
|
var { fitToWidth } = require("patchwright-core/lib/coreBundle").utils;
|
|
1055
1129
|
var kOutputSymbol = /* @__PURE__ */ Symbol("output");
|
|
1056
1130
|
var DEFAULT_TTY_WIDTH = 100;
|
|
@@ -1315,6 +1389,25 @@ var TerminalReporter = class {
|
|
|
1315
1389
|
this.screen.stdout?.write(line ? line + "\n" : "\n");
|
|
1316
1390
|
}
|
|
1317
1391
|
};
|
|
1392
|
+
function isFailure(test) {
|
|
1393
|
+
const outcome = test.outcome();
|
|
1394
|
+
return outcome === "unexpected" || outcome === "flaky" || test.results.some((result) => result.status === "interrupted");
|
|
1395
|
+
}
|
|
1396
|
+
function createTestFilter(options, reporterName) {
|
|
1397
|
+
const onlyFailures = options._mode !== "list" && getAsBooleanFromENV(`PLAYWRIGHT_${reporterName}_ONLY_FAILURES`, !!options.onlyFailures);
|
|
1398
|
+
return onlyFailures ? isFailure : void 0;
|
|
1399
|
+
}
|
|
1400
|
+
function* visitTests(suite, filter) {
|
|
1401
|
+
for (const entry of suite.entries()) {
|
|
1402
|
+
if (entry.type !== "test")
|
|
1403
|
+
yield* visitTests(entry, filter);
|
|
1404
|
+
else if (!filter || filter(entry))
|
|
1405
|
+
yield entry;
|
|
1406
|
+
}
|
|
1407
|
+
}
|
|
1408
|
+
function filterTests(entries, filter) {
|
|
1409
|
+
return filter ? entries.filter((entry) => entry.type === "test" ? filter(entry) : !visitTests(entry, filter).next().done) : entries;
|
|
1410
|
+
}
|
|
1318
1411
|
function formatResultErrors(screen, test, result) {
|
|
1319
1412
|
const lines = [];
|
|
1320
1413
|
if (test.outcome() === "unexpected") {
|
|
@@ -1409,14 +1502,10 @@ function formatRetry(screen, result) {
|
|
|
1409
1502
|
}
|
|
1410
1503
|
return retryLines;
|
|
1411
1504
|
}
|
|
1412
|
-
function quotePathIfNeeded(
|
|
1413
|
-
if (/\s/.test(
|
|
1414
|
-
return `"${
|
|
1415
|
-
return
|
|
1416
|
-
}
|
|
1417
|
-
var kReportedSymbol = /* @__PURE__ */ Symbol("reported");
|
|
1418
|
-
function markErrorsAsReported(result) {
|
|
1419
|
-
result[kReportedSymbol] = result.errors.length;
|
|
1505
|
+
function quotePathIfNeeded(path22) {
|
|
1506
|
+
if (/\s/.test(path22))
|
|
1507
|
+
return `"${path22}"`;
|
|
1508
|
+
return path22;
|
|
1420
1509
|
}
|
|
1421
1510
|
function formatResultFailure(screen, test, result, initialIndent) {
|
|
1422
1511
|
const errorDetails = [];
|
|
@@ -1430,8 +1519,7 @@ function formatResultFailure(screen, test, result, initialIndent) {
|
|
|
1430
1519
|
message: indent(screen.colors.red(`Test was interrupted.`), initialIndent)
|
|
1431
1520
|
});
|
|
1432
1521
|
}
|
|
1433
|
-
const
|
|
1434
|
-
for (const error of result.errors.slice(reportedIndex)) {
|
|
1522
|
+
for (const error of result.errors) {
|
|
1435
1523
|
const formattedError = formatError(screen, error);
|
|
1436
1524
|
errorDetails.push({
|
|
1437
1525
|
message: indent(formattedError.message, initialIndent),
|
|
@@ -1442,8 +1530,8 @@ function formatResultFailure(screen, test, result, initialIndent) {
|
|
|
1442
1530
|
}
|
|
1443
1531
|
function relativeFilePath(screen, config2, file) {
|
|
1444
1532
|
if (screen.resolveFiles === "cwd")
|
|
1445
|
-
return
|
|
1446
|
-
return
|
|
1533
|
+
return import_path3.default.relative(process.cwd(), file);
|
|
1534
|
+
return import_path3.default.relative(config2.rootDir, file);
|
|
1447
1535
|
}
|
|
1448
1536
|
function relativeTestPath(screen, config2, test) {
|
|
1449
1537
|
return relativeFilePath(screen, config2, test.location.file);
|
|
@@ -1530,19 +1618,19 @@ function prepareErrorStack(stack) {
|
|
|
1530
1618
|
function resolveFromEnv(name) {
|
|
1531
1619
|
const value = process.env[name];
|
|
1532
1620
|
if (value)
|
|
1533
|
-
return
|
|
1621
|
+
return import_path3.default.resolve(process.cwd(), value);
|
|
1534
1622
|
return void 0;
|
|
1535
1623
|
}
|
|
1536
1624
|
function resolveOutputFile(reporterName, options) {
|
|
1537
1625
|
const name = reporterName.toUpperCase();
|
|
1538
1626
|
let outputFile = resolveFromEnv(`PLAYWRIGHT_${name}_OUTPUT_FILE`);
|
|
1539
1627
|
if (!outputFile && options.outputFile)
|
|
1540
|
-
outputFile =
|
|
1628
|
+
outputFile = import_path3.default.resolve(options.configDir, options.outputFile);
|
|
1541
1629
|
if (outputFile)
|
|
1542
1630
|
return { outputFile };
|
|
1543
1631
|
let outputDir = resolveFromEnv(`PLAYWRIGHT_${name}_OUTPUT_DIR`);
|
|
1544
1632
|
if (!outputDir && options.outputDir)
|
|
1545
|
-
outputDir =
|
|
1633
|
+
outputDir = import_path3.default.resolve(options.configDir, options.outputDir);
|
|
1546
1634
|
if (!outputDir && options.default)
|
|
1547
1635
|
outputDir = (0, import_util2.resolveReporterOutputPath)(options.default.outputDir, options.configDir, void 0);
|
|
1548
1636
|
if (!outputDir)
|
|
@@ -1550,7 +1638,7 @@ function resolveOutputFile(reporterName, options) {
|
|
|
1550
1638
|
const reportName = process.env[`PLAYWRIGHT_${name}_OUTPUT_NAME`] ?? options.fileName ?? options.default?.fileName;
|
|
1551
1639
|
if (!reportName)
|
|
1552
1640
|
return void 0;
|
|
1553
|
-
outputFile =
|
|
1641
|
+
outputFile = import_path3.default.resolve(outputDir, reportName);
|
|
1554
1642
|
return { outputFile, outputDir };
|
|
1555
1643
|
}
|
|
1556
1644
|
function groupAttachments(attachments) {
|
|
@@ -1586,7 +1674,7 @@ function groupAttachments(attachments) {
|
|
|
1586
1674
|
}
|
|
1587
1675
|
|
|
1588
1676
|
// packages/playwright/src/reporters/internalReporter.ts
|
|
1589
|
-
var
|
|
1677
|
+
var import_fs2 = __toESM(require("fs"));
|
|
1590
1678
|
|
|
1591
1679
|
// packages/playwright/src/reporters/multiplexer.ts
|
|
1592
1680
|
var import_util3 = require("../util");
|
|
@@ -1625,10 +1713,6 @@ var Multiplexer = class {
|
|
|
1625
1713
|
for (const reporter of this._reporters)
|
|
1626
1714
|
this._wrap(() => reporter.onStdErr?.(chunk, test, result));
|
|
1627
1715
|
}
|
|
1628
|
-
async onTestPaused(test, result) {
|
|
1629
|
-
for (const reporter of this._reporters)
|
|
1630
|
-
await this._wrapAsync(() => reporter.onTestPaused?.(test, result));
|
|
1631
|
-
}
|
|
1632
1716
|
onTestEnd(test, result) {
|
|
1633
1717
|
for (const reporter of this._reporters)
|
|
1634
1718
|
this._wrap(() => reporter.onTestEnd?.(test, result));
|
|
@@ -1693,7 +1777,6 @@ var Multiplexer = class {
|
|
|
1693
1777
|
|
|
1694
1778
|
// packages/playwright/src/reporters/internalReporter.ts
|
|
1695
1779
|
var import_common = require("../common");
|
|
1696
|
-
var babel = __toESM(require("../transform/babelBundle"));
|
|
1697
1780
|
|
|
1698
1781
|
// packages/playwright/src/reporters/reporterV2.ts
|
|
1699
1782
|
function wrapReporterAsV2(reporter) {
|
|
@@ -1776,6 +1859,7 @@ var ReporterV2Wrapper = class {
|
|
|
1776
1859
|
};
|
|
1777
1860
|
|
|
1778
1861
|
// packages/playwright/src/reporters/internalReporter.ts
|
|
1862
|
+
var { codeFrame } = require("patchwright-core/lib/coreBundle").iso;
|
|
1779
1863
|
var { monotonicTime: monotonicTime2 } = require("patchwright-core/lib/coreBundle").iso;
|
|
1780
1864
|
var InternalReporter = class {
|
|
1781
1865
|
constructor(reporters) {
|
|
@@ -1810,10 +1894,6 @@ var InternalReporter = class {
|
|
|
1810
1894
|
onStdErr(chunk, test, result) {
|
|
1811
1895
|
this._reporter.onStdErr?.(chunk, test, result);
|
|
1812
1896
|
}
|
|
1813
|
-
async onTestPaused(test, result) {
|
|
1814
|
-
this._addSnippetToTestErrors(test, result);
|
|
1815
|
-
return await this._reporter.onTestPaused?.(test, result);
|
|
1816
|
-
}
|
|
1817
1897
|
onTestEnd(test, result) {
|
|
1818
1898
|
this._addSnippetToTestErrors(test, result);
|
|
1819
1899
|
this._reporter.onTestEnd?.(test, result);
|
|
@@ -1864,13 +1944,13 @@ function addLocationAndSnippetToError(config2, error, file) {
|
|
|
1864
1944
|
return;
|
|
1865
1945
|
try {
|
|
1866
1946
|
const tokens = [];
|
|
1867
|
-
const source =
|
|
1868
|
-
const
|
|
1869
|
-
if (!file ||
|
|
1947
|
+
const source = import_fs2.default.readFileSync(location.file, "utf8");
|
|
1948
|
+
const frame = codeFrame(source, location, { colors: internalScreen.colors });
|
|
1949
|
+
if (!file || import_fs2.default.realpathSync(file) !== location.file) {
|
|
1870
1950
|
tokens.push(internalScreen.colors.gray(` at `) + `${relativeFilePath(internalScreen, config2, location.file)}:${location.line}`);
|
|
1871
1951
|
tokens.push("");
|
|
1872
1952
|
}
|
|
1873
|
-
tokens.push(
|
|
1953
|
+
tokens.push(frame);
|
|
1874
1954
|
error.snippet = tokens.join("\n");
|
|
1875
1955
|
} catch (e) {
|
|
1876
1956
|
}
|
|
@@ -1885,11 +1965,11 @@ __export(reporters_exports, {
|
|
|
1885
1965
|
createErrorCollectingReporter: () => createErrorCollectingReporter,
|
|
1886
1966
|
createReporters: () => createReporters
|
|
1887
1967
|
});
|
|
1888
|
-
var
|
|
1968
|
+
var import_fs11 = __toESM(require("fs"));
|
|
1889
1969
|
|
|
1890
1970
|
// packages/playwright/src/runner/loadUtils.ts
|
|
1891
|
-
var
|
|
1892
|
-
var
|
|
1971
|
+
var import_path5 = __toESM(require("path"));
|
|
1972
|
+
var import_fs4 = __toESM(require("fs"));
|
|
1893
1973
|
|
|
1894
1974
|
// packages/playwright/src/runner/processHost.ts
|
|
1895
1975
|
var import_child_process = __toESM(require("child_process"));
|
|
@@ -2120,14 +2200,14 @@ __export(projectUtils_exports, {
|
|
|
2120
2200
|
filterProjects: () => filterProjects,
|
|
2121
2201
|
findTopLevelProjects: () => findTopLevelProjects
|
|
2122
2202
|
});
|
|
2123
|
-
var
|
|
2124
|
-
var
|
|
2203
|
+
var import_fs3 = __toESM(require("fs"));
|
|
2204
|
+
var import_path4 = __toESM(require("path"));
|
|
2125
2205
|
var import_util4 = require("util");
|
|
2126
2206
|
var import_util5 = require("../util");
|
|
2127
2207
|
var { minimatch } = require("patchwright-core/lib/utilsBundle");
|
|
2128
2208
|
var { escapeRegExp } = require("patchwright-core/lib/coreBundle").iso;
|
|
2129
|
-
var readFileAsync = (0, import_util4.promisify)(
|
|
2130
|
-
var readDirAsync = (0, import_util4.promisify)(
|
|
2209
|
+
var readFileAsync = (0, import_util4.promisify)(import_fs3.default.readFile);
|
|
2210
|
+
var readDirAsync = (0, import_util4.promisify)(import_fs3.default.readdir);
|
|
2131
2211
|
function wildcardPatternToRegExp(pattern) {
|
|
2132
2212
|
return new RegExp("^" + pattern.split("*").map(escapeRegExp).join(".*") + "$", "ig");
|
|
2133
2213
|
}
|
|
@@ -2230,7 +2310,7 @@ function buildDependentProjects(forProjects, projects) {
|
|
|
2230
2310
|
}
|
|
2231
2311
|
async function collectFilesForProject(project, fsCache = /* @__PURE__ */ new Map()) {
|
|
2232
2312
|
const extensions = /* @__PURE__ */ new Set([".js", ".ts", ".mjs", ".mts", ".cjs", ".cts", ".jsx", ".tsx", ".mjsx", ".mtsx", ".cjsx", ".ctsx"]);
|
|
2233
|
-
const testFileExtension = (file) => extensions.has(
|
|
2313
|
+
const testFileExtension = (file) => extensions.has(import_path4.default.extname(file));
|
|
2234
2314
|
const allFiles = await cachedCollectFiles(project.project.testDir, project.respectGitIgnore, fsCache);
|
|
2235
2315
|
const testMatch = (0, import_util5.createFileMatcher)(project.project.testMatch);
|
|
2236
2316
|
const testIgnore = (0, import_util5.createFileMatcher)(project.project.testIgnore);
|
|
@@ -2254,22 +2334,22 @@ async function cachedCollectFiles(testDir, respectGitIgnore, fsCache) {
|
|
|
2254
2334
|
return result;
|
|
2255
2335
|
}
|
|
2256
2336
|
async function collectFiles(testDir, respectGitIgnore) {
|
|
2257
|
-
if (!
|
|
2337
|
+
if (!import_fs3.default.existsSync(testDir))
|
|
2258
2338
|
return [];
|
|
2259
|
-
if (!
|
|
2339
|
+
if (!import_fs3.default.statSync(testDir).isDirectory())
|
|
2260
2340
|
return [];
|
|
2261
|
-
const checkIgnores = (entryPath, rules,
|
|
2341
|
+
const checkIgnores = (entryPath, rules, isDirectory2, parentStatus) => {
|
|
2262
2342
|
let status = parentStatus;
|
|
2263
2343
|
for (const rule of rules) {
|
|
2264
2344
|
const ruleIncludes = rule.negate;
|
|
2265
2345
|
if (status === "included" === ruleIncludes)
|
|
2266
2346
|
continue;
|
|
2267
|
-
const relative =
|
|
2347
|
+
const relative = import_path4.default.relative(rule.dir, entryPath);
|
|
2268
2348
|
if (rule.match("/" + relative) || rule.match(relative)) {
|
|
2269
2349
|
status = ruleIncludes ? "included" : "ignored";
|
|
2270
|
-
} else if (
|
|
2350
|
+
} else if (isDirectory2 && (rule.match("/" + relative + "/") || rule.match(relative + "/"))) {
|
|
2271
2351
|
status = ruleIncludes ? "included" : "ignored";
|
|
2272
|
-
} else if (
|
|
2352
|
+
} else if (isDirectory2 && ruleIncludes && (rule.match("/" + relative, true) || rule.match(relative, true))) {
|
|
2273
2353
|
status = "ignored-but-recurse";
|
|
2274
2354
|
}
|
|
2275
2355
|
}
|
|
@@ -2282,7 +2362,7 @@ async function collectFiles(testDir, respectGitIgnore) {
|
|
|
2282
2362
|
if (respectGitIgnore) {
|
|
2283
2363
|
const gitignore = entries.find((e) => e.isFile() && e.name === ".gitignore");
|
|
2284
2364
|
if (gitignore) {
|
|
2285
|
-
const content = await readFileAsync(
|
|
2365
|
+
const content = await readFileAsync(import_path4.default.join(dir, gitignore.name), "utf8");
|
|
2286
2366
|
const newRules = content.split(/\r?\n/).map((s) => {
|
|
2287
2367
|
s = s.trim();
|
|
2288
2368
|
if (!s)
|
|
@@ -2303,7 +2383,7 @@ async function collectFiles(testDir, respectGitIgnore) {
|
|
|
2303
2383
|
continue;
|
|
2304
2384
|
if (entry.isDirectory() && entry.name === "node_modules")
|
|
2305
2385
|
continue;
|
|
2306
|
-
const entryPath =
|
|
2386
|
+
const entryPath = import_path4.default.join(dir, entry.name);
|
|
2307
2387
|
const entryStatus = checkIgnores(entryPath, rules, entry.isDirectory(), status);
|
|
2308
2388
|
if (entry.isDirectory() && entryStatus !== "ignored")
|
|
2309
2389
|
await visit(entryPath, rules, entryStatus);
|
|
@@ -2333,6 +2413,15 @@ var ReporterTestRunImpl = class {
|
|
|
2333
2413
|
shouldSkipSharding() {
|
|
2334
2414
|
return this._skipSharding;
|
|
2335
2415
|
}
|
|
2416
|
+
mode(suite) {
|
|
2417
|
+
if (!this._active)
|
|
2418
|
+
throw new Error(`TestRun.mode() can only be called from Reporter.preprocess().`);
|
|
2419
|
+
for (let current = suite; current; current = current.parent) {
|
|
2420
|
+
if (current._parallelMode !== "none")
|
|
2421
|
+
return current._parallelMode;
|
|
2422
|
+
}
|
|
2423
|
+
return "default";
|
|
2424
|
+
}
|
|
2336
2425
|
skipSharding() {
|
|
2337
2426
|
if (!this._active)
|
|
2338
2427
|
throw new Error(`TestRun.skipSharding() can only be called from Reporter.preprocess().`);
|
|
@@ -2543,8 +2632,8 @@ async function loadFileSuites(testRun, mode, errors) {
|
|
|
2543
2632
|
for (const file of allTestFiles) {
|
|
2544
2633
|
for (const dependency of import_common4.cc.dependenciesForTestFile(file)) {
|
|
2545
2634
|
if (allTestFiles.has(dependency)) {
|
|
2546
|
-
const importer =
|
|
2547
|
-
const importee =
|
|
2635
|
+
const importer = import_path5.default.relative(config2.config.rootDir, file);
|
|
2636
|
+
const importee = import_path5.default.relative(config2.config.rootDir, dependency);
|
|
2548
2637
|
errors.push({
|
|
2549
2638
|
message: `Error: test file "${importer}" should not import test file "${importee}"`,
|
|
2550
2639
|
location: { file, line: 1, column: 1 }
|
|
@@ -2587,10 +2676,11 @@ async function createRootSuite(testRun, errors, shouldFilterOnly) {
|
|
|
2587
2676
|
rootSuite._addSuite(buildProjectSuite(project, filteredProjectSuites.get(project)));
|
|
2588
2677
|
}
|
|
2589
2678
|
}
|
|
2679
|
+
testRun.testCountBeforeSharding = rootSuite.allTests().length;
|
|
2590
2680
|
if (config2.config.forbidOnly) {
|
|
2591
2681
|
const onlyTestsAndSuites = rootSuite._getOnlyItems();
|
|
2592
2682
|
if (onlyTestsAndSuites.length > 0) {
|
|
2593
|
-
const configFilePath = config2.config.configFile ?
|
|
2683
|
+
const configFilePath = config2.config.configFile ? import_path5.default.relative(config2.config.rootDir, config2.config.configFile) : void 0;
|
|
2594
2684
|
errors.push(...createForbidOnlyErrors(onlyTestsAndSuites, config2.configCLIOverrides.forbidOnly, configFilePath));
|
|
2595
2685
|
}
|
|
2596
2686
|
}
|
|
@@ -2711,7 +2801,7 @@ function createDuplicateTitlesErrors(config2, fileSuite) {
|
|
|
2711
2801
|
function buildItemLocation(rootDir, testOrSuite) {
|
|
2712
2802
|
if (!testOrSuite.location)
|
|
2713
2803
|
return "";
|
|
2714
|
-
return `${
|
|
2804
|
+
return `${import_path5.default.relative(rootDir, testOrSuite.location.file)}:${testOrSuite.location.line}`;
|
|
2715
2805
|
}
|
|
2716
2806
|
async function requireOrImportDefaultFunction(file, expectConstructor) {
|
|
2717
2807
|
let func = await import_common4.transform.requireOrImport(file);
|
|
@@ -2722,10 +2812,10 @@ async function requireOrImportDefaultFunction(file, expectConstructor) {
|
|
|
2722
2812
|
return func;
|
|
2723
2813
|
}
|
|
2724
2814
|
function loadGlobalHook(config2, file) {
|
|
2725
|
-
return requireOrImportDefaultFunction(
|
|
2815
|
+
return requireOrImportDefaultFunction(import_path5.default.resolve(config2.config.rootDir, file), false);
|
|
2726
2816
|
}
|
|
2727
2817
|
function loadReporter(config2, file) {
|
|
2728
|
-
return requireOrImportDefaultFunction(config2 ?
|
|
2818
|
+
return requireOrImportDefaultFunction(config2 ? import_path5.default.resolve(config2.config.rootDir, file) : file, true);
|
|
2729
2819
|
}
|
|
2730
2820
|
function sourceMapSources(file, cache) {
|
|
2731
2821
|
let sources = [file];
|
|
@@ -2737,7 +2827,7 @@ function sourceMapSources(file, cache) {
|
|
|
2737
2827
|
const sourceMap = sourceMapSupport.retrieveSourceMap(file);
|
|
2738
2828
|
const sourceMapData = typeof sourceMap?.map === "string" ? JSON.parse(sourceMap.map) : sourceMap?.map;
|
|
2739
2829
|
if (sourceMapData?.sources)
|
|
2740
|
-
sources = sourceMapData.sources.map((source) =>
|
|
2830
|
+
sources = sourceMapData.sources.map((source) => import_path5.default.resolve(import_path5.default.dirname(file), source));
|
|
2741
2831
|
} finally {
|
|
2742
2832
|
cache.set(file, sources);
|
|
2743
2833
|
return sources;
|
|
@@ -2745,7 +2835,7 @@ function sourceMapSources(file, cache) {
|
|
|
2745
2835
|
}
|
|
2746
2836
|
async function loadTestList(config2, filePath) {
|
|
2747
2837
|
try {
|
|
2748
|
-
const content = await
|
|
2838
|
+
const content = await import_fs4.default.promises.readFile(filePath, "utf-8");
|
|
2749
2839
|
const lines = content.split("\n").map((line) => line.trim()).filter((line) => line && !line.startsWith("#"));
|
|
2750
2840
|
const descriptions = lines.map((line) => {
|
|
2751
2841
|
const delimiter = line.includes("\u203A") ? "\u203A" : ">";
|
|
@@ -2763,13 +2853,13 @@ async function loadTestList(config2, filePath) {
|
|
|
2763
2853
|
const [projectName, , ...titles] = test.titlePath();
|
|
2764
2854
|
if (d.project !== void 0 && d.project !== projectName)
|
|
2765
2855
|
return false;
|
|
2766
|
-
const relativeFile = toPosixPath(
|
|
2856
|
+
const relativeFile = toPosixPath(import_path5.default.relative(config2.config.rootDir, test.location.file));
|
|
2767
2857
|
if (relativeFile !== d.file)
|
|
2768
2858
|
return false;
|
|
2769
2859
|
return d.titlePath.length <= titles.length && d.titlePath.every((_, index) => titles[index] === d.titlePath[index]);
|
|
2770
2860
|
});
|
|
2771
2861
|
const fileFilter = (file) => {
|
|
2772
|
-
const relativeFile = toPosixPath(
|
|
2862
|
+
const relativeFile = toPosixPath(import_path5.default.relative(config2.config.rootDir, file));
|
|
2773
2863
|
return descriptions.some((d) => d.file === relativeFile);
|
|
2774
2864
|
};
|
|
2775
2865
|
return { testFilter, fileFilter };
|
|
@@ -2779,18 +2869,17 @@ async function loadTestList(config2, filePath) {
|
|
|
2779
2869
|
}
|
|
2780
2870
|
|
|
2781
2871
|
// packages/playwright/src/reporters/blob.ts
|
|
2782
|
-
var
|
|
2783
|
-
var
|
|
2872
|
+
var import_fs5 = __toESM(require("fs"));
|
|
2873
|
+
var import_path7 = __toESM(require("path"));
|
|
2784
2874
|
var import_stream2 = require("stream");
|
|
2785
2875
|
var import_coreBundle = require("patchwright-core/lib/coreBundle");
|
|
2786
2876
|
|
|
2787
2877
|
// packages/playwright/src/reporters/teleEmitter.ts
|
|
2788
|
-
var
|
|
2878
|
+
var import_path6 = __toESM(require("path"));
|
|
2789
2879
|
var { createGuid } = require("patchwright-core/lib/coreBundle").utils;
|
|
2790
2880
|
var TeleReporterEmitter = class {
|
|
2791
2881
|
constructor(messageSink, options = {}) {
|
|
2792
2882
|
this._resultKnownAttachmentCounts = /* @__PURE__ */ new Map();
|
|
2793
|
-
this._resultKnownErrorCounts = /* @__PURE__ */ new Map();
|
|
2794
2883
|
// In case there is blob reporter and UI mode, make sure one doesn't override
|
|
2795
2884
|
// the id assigned by the other.
|
|
2796
2885
|
this._idSymbol = /* @__PURE__ */ Symbol("id");
|
|
@@ -2820,20 +2909,6 @@ var TeleReporterEmitter = class {
|
|
|
2820
2909
|
}
|
|
2821
2910
|
});
|
|
2822
2911
|
}
|
|
2823
|
-
async onTestPaused(test, result) {
|
|
2824
|
-
const resultId = result[this._idSymbol];
|
|
2825
|
-
this._resultKnownErrorCounts.set(resultId, result.errors.length);
|
|
2826
|
-
this._messageSink({
|
|
2827
|
-
method: "onTestPaused",
|
|
2828
|
-
params: {
|
|
2829
|
-
testId: test.id,
|
|
2830
|
-
resultId,
|
|
2831
|
-
errors: result.errors
|
|
2832
|
-
}
|
|
2833
|
-
});
|
|
2834
|
-
await new Promise(() => {
|
|
2835
|
-
});
|
|
2836
|
-
}
|
|
2837
2912
|
onTestEnd(test, result) {
|
|
2838
2913
|
const testEnd = {
|
|
2839
2914
|
testId: test.id,
|
|
@@ -2851,7 +2926,6 @@ var TeleReporterEmitter = class {
|
|
|
2851
2926
|
});
|
|
2852
2927
|
const resultId = result[this._idSymbol];
|
|
2853
2928
|
this._resultKnownAttachmentCounts.delete(resultId);
|
|
2854
|
-
this._resultKnownErrorCounts.delete(resultId);
|
|
2855
2929
|
}
|
|
2856
2930
|
onStepBegin(test, result, step) {
|
|
2857
2931
|
step[this._idSymbol] = createGuid();
|
|
@@ -3006,7 +3080,7 @@ var TeleReporterEmitter = class {
|
|
|
3006
3080
|
id,
|
|
3007
3081
|
duration: result.duration,
|
|
3008
3082
|
status: result.status,
|
|
3009
|
-
errors:
|
|
3083
|
+
errors: result.errors,
|
|
3010
3084
|
annotations: result.annotations?.length ? this._relativeAnnotationLocations(result.annotations) : void 0
|
|
3011
3085
|
};
|
|
3012
3086
|
}
|
|
@@ -3073,7 +3147,7 @@ var TeleReporterEmitter = class {
|
|
|
3073
3147
|
_relativePath(absolutePath) {
|
|
3074
3148
|
if (!absolutePath)
|
|
3075
3149
|
return absolutePath;
|
|
3076
|
-
return
|
|
3150
|
+
return import_path6.default.relative(this._rootDir, absolutePath);
|
|
3077
3151
|
}
|
|
3078
3152
|
};
|
|
3079
3153
|
|
|
@@ -3101,7 +3175,7 @@ var BlobReporter = class extends TeleReporterEmitter {
|
|
|
3101
3175
|
// TODO: remove after some time, recommend config.tag instead.
|
|
3102
3176
|
name: process.env.PWTEST_BOT_NAME,
|
|
3103
3177
|
shard: config2.shard ?? void 0,
|
|
3104
|
-
pathSeparator:
|
|
3178
|
+
pathSeparator: import_path7.default.sep
|
|
3105
3179
|
};
|
|
3106
3180
|
this._messages.push({
|
|
3107
3181
|
method: "onBlobReportMetadata",
|
|
@@ -3110,8 +3184,6 @@ var BlobReporter = class extends TeleReporterEmitter {
|
|
|
3110
3184
|
this._config = config2;
|
|
3111
3185
|
super.onConfigure(config2);
|
|
3112
3186
|
}
|
|
3113
|
-
async onTestPaused(test, result) {
|
|
3114
|
-
}
|
|
3115
3187
|
async onEnd(result) {
|
|
3116
3188
|
await super.onEnd(result);
|
|
3117
3189
|
const zipFileName = await this._prepareOutputFile();
|
|
@@ -3121,11 +3193,11 @@ var BlobReporter = class extends TeleReporterEmitter {
|
|
|
3121
3193
|
throw new Error(`Failed to write report ${zipFileName}: ` + e.message);
|
|
3122
3194
|
});
|
|
3123
3195
|
zipFile.on("error", (error) => zipFinishPromise.reject(error));
|
|
3124
|
-
zipFile.outputStream.pipe(
|
|
3196
|
+
zipFile.outputStream.pipe(import_fs5.default.createWriteStream(zipFileName)).on("close", () => {
|
|
3125
3197
|
zipFinishPromise.resolve(void 0);
|
|
3126
3198
|
}).on("error", (error) => zipFinishPromise.reject(error));
|
|
3127
3199
|
for (const { originalPath, zipEntryPath } of this._attachments) {
|
|
3128
|
-
if (!
|
|
3200
|
+
if (!import_fs5.default.statSync(originalPath, { throwIfNoEntry: false })?.isFile())
|
|
3129
3201
|
continue;
|
|
3130
3202
|
zipFile.addFile(originalPath, zipEntryPath);
|
|
3131
3203
|
}
|
|
@@ -3145,7 +3217,7 @@ var BlobReporter = class extends TeleReporterEmitter {
|
|
|
3145
3217
|
});
|
|
3146
3218
|
if (!process.env.PWTEST_BLOB_DO_NOT_REMOVE)
|
|
3147
3219
|
await removeFolders([outputDir]);
|
|
3148
|
-
await
|
|
3220
|
+
await import_fs5.default.promises.mkdir(import_path7.default.dirname(outputFile), { recursive: true });
|
|
3149
3221
|
return outputFile;
|
|
3150
3222
|
}
|
|
3151
3223
|
_defaultReportName(config2) {
|
|
@@ -3175,8 +3247,8 @@ var BlobReporter = class extends TeleReporterEmitter {
|
|
|
3175
3247
|
};
|
|
3176
3248
|
|
|
3177
3249
|
// packages/playwright/src/reporters/coverage.ts
|
|
3178
|
-
var
|
|
3179
|
-
var
|
|
3250
|
+
var import_fs6 = __toESM(require("fs"));
|
|
3251
|
+
var import_path8 = __toESM(require("path"));
|
|
3180
3252
|
var import_util7 = require("../util");
|
|
3181
3253
|
var { mergeIstanbulCoverage, sortedIstanbulCoverage } = require("patchwright-core/lib/coreBundle").iso;
|
|
3182
3254
|
var { ZipFile } = require("patchwright-core/lib/coreBundle").utils;
|
|
@@ -3233,10 +3305,10 @@ No code coverage was collected.`,
|
|
|
3233
3305
|
return;
|
|
3234
3306
|
}
|
|
3235
3307
|
const outputDir = (0, import_util7.resolveReporterOutputPath)("coverage", this._options.configDir, this._options.outputDir);
|
|
3236
|
-
await
|
|
3308
|
+
await import_fs6.default.promises.mkdir(outputDir, { recursive: true });
|
|
3237
3309
|
const mergedJson = sortedIstanbulCoverage(coverage);
|
|
3238
|
-
await
|
|
3239
|
-
await
|
|
3310
|
+
await import_fs6.default.promises.writeFile(import_path8.default.join(outputDir, "coverage-final.json"), JSON.stringify(mergedJson));
|
|
3311
|
+
await import_fs6.default.promises.writeFile(import_path8.default.join(outputDir, "lcov.info"), lcovReport(mergedJson));
|
|
3240
3312
|
const hasHtml = this._tryWriteHtmlReport(mergedJson, outputDir);
|
|
3241
3313
|
const summary = computeSummary(mergedJson);
|
|
3242
3314
|
const lines = [
|
|
@@ -3246,10 +3318,10 @@ No code coverage was collected.`,
|
|
|
3246
3318
|
` branches: ${formatMetric(summary.branches)}`,
|
|
3247
3319
|
` functions: ${formatMetric(summary.functions)}`,
|
|
3248
3320
|
` lines: ${formatMetric(summary.lines)}`,
|
|
3249
|
-
`Coverage report written to ${
|
|
3321
|
+
`Coverage report written to ${import_path8.default.relative(process.cwd(), outputDir)}`
|
|
3250
3322
|
];
|
|
3251
3323
|
if (!hasHtml)
|
|
3252
|
-
lines.push(`For an HTML report, install istanbul-lib-coverage, istanbul-lib-report and istanbul-reports, or run 'npx nyc report --temp-dir=${
|
|
3324
|
+
lines.push(`For an HTML report, install istanbul-lib-coverage, istanbul-lib-report and istanbul-reports, or run 'npx nyc report --temp-dir=${import_path8.default.relative(process.cwd(), outputDir)} --reporter=html'.`);
|
|
3253
3325
|
writeLine(lines.join("\n"));
|
|
3254
3326
|
}
|
|
3255
3327
|
// Istanbul report libraries are not shipped with Playwright, use the project's if any.
|
|
@@ -3350,10 +3422,10 @@ function writeLine(line) {
|
|
|
3350
3422
|
var coverage_default = CoverageReporter;
|
|
3351
3423
|
|
|
3352
3424
|
// packages/playwright/src/reporters/dot.ts
|
|
3353
|
-
var { getAsBooleanFromENV } = require("patchwright-core/lib/coreBundle").utils;
|
|
3425
|
+
var { getAsBooleanFromENV: getAsBooleanFromENV2 } = require("patchwright-core/lib/coreBundle").utils;
|
|
3354
3426
|
var DotReporter = class extends TerminalReporter {
|
|
3355
3427
|
constructor(options) {
|
|
3356
|
-
super({ ...options, omitTags:
|
|
3428
|
+
super({ ...options, omitTags: getAsBooleanFromENV2("PLAYWRIGHT_DOT_OMIT_TAGS", options?.omitTags) });
|
|
3357
3429
|
this._counter = 0;
|
|
3358
3430
|
}
|
|
3359
3431
|
onBegin(suite) {
|
|
@@ -3402,23 +3474,6 @@ var DotReporter = class extends TerminalReporter {
|
|
|
3402
3474
|
this.writeLine("\n" + this.formatError(error).message);
|
|
3403
3475
|
this._counter = 0;
|
|
3404
3476
|
}
|
|
3405
|
-
async onTestPaused(test, result) {
|
|
3406
|
-
if (!process.stdin.isTTY && !process.env.PW_TEST_DEBUG_REPORTERS)
|
|
3407
|
-
return;
|
|
3408
|
-
this.screen.stdout.write("\n");
|
|
3409
|
-
if (test.outcome() === "unexpected") {
|
|
3410
|
-
this.writeLine(this.screen.colors.red(this.formatTestHeader(test, { indent: " " })));
|
|
3411
|
-
this.writeLine(this.formatResultErrors(test, result));
|
|
3412
|
-
markErrorsAsReported(result);
|
|
3413
|
-
this.writeLine(this.screen.colors.yellow(" Paused on error. Press Ctrl+C to end.") + "\n");
|
|
3414
|
-
} else {
|
|
3415
|
-
this.writeLine(this.screen.colors.yellow(this.formatTestHeader(test, { indent: " " })));
|
|
3416
|
-
this.writeLine(this.screen.colors.yellow(" Paused at test end. Press Ctrl+C to end.") + "\n");
|
|
3417
|
-
}
|
|
3418
|
-
this._counter = 0;
|
|
3419
|
-
await new Promise(() => {
|
|
3420
|
-
});
|
|
3421
|
-
}
|
|
3422
3477
|
async onEnd(result) {
|
|
3423
3478
|
await super.onEnd(result);
|
|
3424
3479
|
this.screen.stdout.write("\n");
|
|
@@ -3438,20 +3493,85 @@ var EmptyReporter = class {
|
|
|
3438
3493
|
};
|
|
3439
3494
|
var empty_default = EmptyReporter;
|
|
3440
3495
|
|
|
3496
|
+
// packages/playwright/src/reporters/failures.ts
|
|
3497
|
+
var { msToString: msToString2 } = require("patchwright-core/lib/coreBundle").iso;
|
|
3498
|
+
var { getAsBooleanFromENV: getAsBooleanFromENV3 } = require("patchwright-core/lib/coreBundle").utils;
|
|
3499
|
+
var FailuresReporter = class extends TerminalReporter {
|
|
3500
|
+
constructor(options) {
|
|
3501
|
+
super({ ...options, omitTags: getAsBooleanFromENV3("PLAYWRIGHT_FAILURES_OMIT_TAGS", options?.omitTags), lastResult: true });
|
|
3502
|
+
this._failureIndex = /* @__PURE__ */ new Map();
|
|
3503
|
+
this._needNewLine = false;
|
|
3504
|
+
}
|
|
3505
|
+
onStdOut(chunk, test, result) {
|
|
3506
|
+
super.onStdOut(chunk, test, result);
|
|
3507
|
+
this._dumpToStdio(chunk, this.screen.stdout);
|
|
3508
|
+
}
|
|
3509
|
+
onStdErr(chunk, test, result) {
|
|
3510
|
+
super.onStdErr(chunk, test, result);
|
|
3511
|
+
this._dumpToStdio(chunk, this.screen.stderr);
|
|
3512
|
+
}
|
|
3513
|
+
_dumpToStdio(chunk, stream) {
|
|
3514
|
+
if (this.config.quiet)
|
|
3515
|
+
return;
|
|
3516
|
+
stream.write(chunk);
|
|
3517
|
+
if (chunk.length)
|
|
3518
|
+
this._needNewLine = !chunk.toString().endsWith("\n");
|
|
3519
|
+
}
|
|
3520
|
+
onTestEnd(test, result) {
|
|
3521
|
+
super.onTestEnd(test, result);
|
|
3522
|
+
if (result.status !== "skipped" && result.status !== test.expectedStatus) {
|
|
3523
|
+
this._printFailure(test);
|
|
3524
|
+
} else if (result.retry && result.status === "passed") {
|
|
3525
|
+
this._maybeWriteNewLine();
|
|
3526
|
+
this.writeLine(this.screen.colors.green(this.formatTestHeader(test, { indent: " ", index: this._failureIndex.get(test) })));
|
|
3527
|
+
this.writeLine(this.screen.colors.green(` Passed on retry #${result.retry} (${msToString2(result.duration)}).`));
|
|
3528
|
+
this.writeLine();
|
|
3529
|
+
}
|
|
3530
|
+
}
|
|
3531
|
+
_printFailure(test) {
|
|
3532
|
+
let index = this._failureIndex.get(test);
|
|
3533
|
+
if (index === void 0) {
|
|
3534
|
+
index = this._failureIndex.size + 1;
|
|
3535
|
+
this._failureIndex.set(test, index);
|
|
3536
|
+
}
|
|
3537
|
+
const message = this.formatFailure(test, index);
|
|
3538
|
+
if (message.trim()) {
|
|
3539
|
+
this._maybeWriteNewLine();
|
|
3540
|
+
this.writeLine(message);
|
|
3541
|
+
}
|
|
3542
|
+
}
|
|
3543
|
+
onError(error) {
|
|
3544
|
+
super.onError(error);
|
|
3545
|
+
this._maybeWriteNewLine();
|
|
3546
|
+
this.writeLine(this.formatError(error).message);
|
|
3547
|
+
}
|
|
3548
|
+
async onEnd(result) {
|
|
3549
|
+
await super.onEnd(result);
|
|
3550
|
+
this._maybeWriteNewLine();
|
|
3551
|
+
this.epilogue(false);
|
|
3552
|
+
}
|
|
3553
|
+
_maybeWriteNewLine() {
|
|
3554
|
+
if (this._needNewLine) {
|
|
3555
|
+
this.writeLine();
|
|
3556
|
+
this._needNewLine = false;
|
|
3557
|
+
}
|
|
3558
|
+
}
|
|
3559
|
+
};
|
|
3560
|
+
var failures_default = FailuresReporter;
|
|
3561
|
+
|
|
3441
3562
|
// packages/playwright/src/reporters/github.ts
|
|
3442
|
-
var
|
|
3563
|
+
var import_path9 = __toESM(require("path"));
|
|
3443
3564
|
var import_util8 = require("../util");
|
|
3444
3565
|
var { noColors: noColors2 } = require("patchwright-core/lib/coreBundle").iso;
|
|
3445
|
-
var { msToString:
|
|
3446
|
-
var { getAsBooleanFromENV:
|
|
3566
|
+
var { msToString: msToString3 } = require("patchwright-core/lib/coreBundle").iso;
|
|
3567
|
+
var { getAsBooleanFromENV: getAsBooleanFromENV4 } = require("patchwright-core/lib/coreBundle").utils;
|
|
3447
3568
|
var GitHubLogger = class {
|
|
3448
3569
|
newLine() {
|
|
3449
3570
|
process.stdout.write("\n");
|
|
3450
3571
|
}
|
|
3451
3572
|
_log(message, type = "notice", options = {}) {
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
process.stdout.write((0, import_util8.stripAnsiEscapes)(`::${type} ${configs}::${message}
|
|
3573
|
+
const configs = Object.entries(options).map(([key, option]) => `${key}=${escapeProperty(String(option))}`).join(",");
|
|
3574
|
+
process.stdout.write((0, import_util8.stripAnsiEscapes)(`::${type} ${configs}::${escapeData(message)}
|
|
3455
3575
|
`));
|
|
3456
3576
|
}
|
|
3457
3577
|
debug(message, options) {
|
|
@@ -3467,9 +3587,15 @@ var GitHubLogger = class {
|
|
|
3467
3587
|
this._log(message, "warning", options);
|
|
3468
3588
|
}
|
|
3469
3589
|
};
|
|
3590
|
+
function escapeData(s) {
|
|
3591
|
+
return s.replace(/%/g, "%25").replace(/\r/g, "%0D").replace(/\n/g, "%0A");
|
|
3592
|
+
}
|
|
3593
|
+
function escapeProperty(s) {
|
|
3594
|
+
return escapeData(s).replace(/:/g, "%3A").replace(/,/g, "%2C");
|
|
3595
|
+
}
|
|
3470
3596
|
var GitHubReporter = class extends TerminalReporter {
|
|
3471
3597
|
constructor(options = {}) {
|
|
3472
|
-
super({ ...options, omitTags:
|
|
3598
|
+
super({ ...options, omitTags: getAsBooleanFromENV4("PLAYWRIGHT_GITHUB_OMIT_TAGS", options.omitTags) });
|
|
3473
3599
|
this.githubLogger = new GitHubLogger();
|
|
3474
3600
|
this._failedTestCount = 0;
|
|
3475
3601
|
this.screen = { ...this.screen, colors: noColors2 };
|
|
@@ -3515,8 +3641,8 @@ var GitHubReporter = class extends TerminalReporter {
|
|
|
3515
3641
|
}
|
|
3516
3642
|
_printSlowTestAnnotations() {
|
|
3517
3643
|
this.getSlowTests().forEach(([file, duration]) => {
|
|
3518
|
-
const filePath = workspaceRelativePath(
|
|
3519
|
-
this.githubLogger.warning(`${filePath} took ${
|
|
3644
|
+
const filePath = workspaceRelativePath(import_path9.default.join(process.cwd(), file));
|
|
3645
|
+
this.githubLogger.warning(`${filePath} took ${msToString3(duration)}`, {
|
|
3520
3646
|
title: "Slow Test",
|
|
3521
3647
|
file: filePath
|
|
3522
3648
|
});
|
|
@@ -3546,7 +3672,7 @@ var GitHubReporter = class extends TerminalReporter {
|
|
|
3546
3672
|
}
|
|
3547
3673
|
};
|
|
3548
3674
|
function workspaceRelativePath(filePath) {
|
|
3549
|
-
return
|
|
3675
|
+
return import_path9.default.relative(process.env["GITHUB_WORKSPACE"] ?? "", filePath);
|
|
3550
3676
|
}
|
|
3551
3677
|
var github_default = GitHubReporter;
|
|
3552
3678
|
|
|
@@ -3556,16 +3682,16 @@ __export(html_exports, {
|
|
|
3556
3682
|
default: () => html_default,
|
|
3557
3683
|
showHTMLReport: () => showHTMLReport
|
|
3558
3684
|
});
|
|
3559
|
-
var
|
|
3685
|
+
var import_fs7 = __toESM(require("fs"));
|
|
3560
3686
|
var import_os = __toESM(require("os"));
|
|
3561
|
-
var
|
|
3687
|
+
var import_path10 = __toESM(require("path"));
|
|
3562
3688
|
var import_stream3 = require("stream");
|
|
3563
|
-
var babel2 = __toESM(require("../transform/babelBundle"));
|
|
3564
3689
|
var import_util9 = require("../util");
|
|
3565
3690
|
var colors2 = require("patchwright-core/lib/utilsBundle").colors;
|
|
3566
3691
|
var mime2 = require("patchwright-core/lib/utilsBundle").mime;
|
|
3567
3692
|
var open = require("patchwright-core/lib/utilsBundle").open;
|
|
3568
3693
|
var yazl2 = require("patchwright-core/lib/utilsBundle").yazl;
|
|
3694
|
+
var { codeFrame: codeFrame2 } = require("patchwright-core/lib/coreBundle").iso;
|
|
3569
3695
|
var { MultiMap } = require("patchwright-core/lib/coreBundle").iso;
|
|
3570
3696
|
var { calculateSha1: calculateSha13 } = require("patchwright-core/lib/coreBundle").utils;
|
|
3571
3697
|
var { copyFileAndMakeWritable, removeFolders: removeFolders2, sanitizeForFilePath: sanitizeForFilePath2, toPosixPath: toPosixPath2 } = require("patchwright-core/lib/coreBundle").utils;
|
|
@@ -3629,8 +3755,8 @@ var HtmlReporter = class {
|
|
|
3629
3755
|
};
|
|
3630
3756
|
}
|
|
3631
3757
|
_isSubdirectory(parentDir, dir) {
|
|
3632
|
-
const relativePath =
|
|
3633
|
-
return !!relativePath && !relativePath.startsWith("..") && !
|
|
3758
|
+
const relativePath = import_path10.default.relative(parentDir, dir);
|
|
3759
|
+
return !!relativePath && !relativePath.startsWith("..") && !import_path10.default.isAbsolute(relativePath);
|
|
3634
3760
|
}
|
|
3635
3761
|
onError(error) {
|
|
3636
3762
|
this._topLevelErrors.push(error);
|
|
@@ -3655,7 +3781,7 @@ var HtmlReporter = class {
|
|
|
3655
3781
|
noSnippets,
|
|
3656
3782
|
noCopyPrompt,
|
|
3657
3783
|
mergeFiles
|
|
3658
|
-
});
|
|
3784
|
+
}, createTestFilter(this._options, "HTML"));
|
|
3659
3785
|
this._buildResult = await builder.build(this.config.metadata, projectSuites, result, this._topLevelErrors, this._machines);
|
|
3660
3786
|
}
|
|
3661
3787
|
async onExit() {
|
|
@@ -3669,7 +3795,7 @@ var HtmlReporter = class {
|
|
|
3669
3795
|
const packageManagerCommand = getPackageManagerExecCommand2();
|
|
3670
3796
|
const invocationDir = process.env.INIT_CWD || process.cwd();
|
|
3671
3797
|
const isDefaultFolder = invocationDir === process.cwd() && this._outputFolder === standaloneDefaultFolder();
|
|
3672
|
-
const relativeReportPath = isDefaultFolder ? "" : " " + (
|
|
3798
|
+
const relativeReportPath = isDefaultFolder ? "" : " " + (import_path10.default.relative(invocationDir, this._outputFolder) || ".");
|
|
3673
3799
|
const hostArg = this._host ? ` --host ${this._host}` : "";
|
|
3674
3800
|
const portArg = this._port ? ` --port ${this._port}` : "";
|
|
3675
3801
|
writeLine2("");
|
|
@@ -3682,7 +3808,7 @@ var HtmlReporter = class {
|
|
|
3682
3808
|
};
|
|
3683
3809
|
function reportFolderFromEnv() {
|
|
3684
3810
|
const envValue = process.env.PLAYWRIGHT_HTML_OUTPUT_DIR || process.env.PLAYWRIGHT_HTML_REPORT;
|
|
3685
|
-
return envValue ?
|
|
3811
|
+
return envValue ? import_path10.default.resolve(envValue) : void 0;
|
|
3686
3812
|
}
|
|
3687
3813
|
function getHtmlReportOptionProcessEnv() {
|
|
3688
3814
|
const htmlOpenEnv = process.env.PLAYWRIGHT_HTML_OPEN || process.env.PW_TEST_HTML_REPORT_OPEN;
|
|
@@ -3706,7 +3832,7 @@ function standaloneDefaultFolder() {
|
|
|
3706
3832
|
return reportFolderFromEnv() ?? (0, import_util9.resolveReporterOutputPath)("playwright-report", process.cwd(), void 0);
|
|
3707
3833
|
}
|
|
3708
3834
|
async function resolveReportFolder(reportPath) {
|
|
3709
|
-
const stat = await
|
|
3835
|
+
const stat = await import_fs7.default.promises.stat(reportPath).catch(() => null);
|
|
3710
3836
|
if (!stat)
|
|
3711
3837
|
throw new Error(`No report found at "${reportPath}"`);
|
|
3712
3838
|
if (stat.isDirectory())
|
|
@@ -3716,10 +3842,10 @@ async function resolveReportFolder(reportPath) {
|
|
|
3716
3842
|
throw new Error(`No report found at "${reportPath}"`);
|
|
3717
3843
|
}
|
|
3718
3844
|
async function extractReportZip(zipPath) {
|
|
3719
|
-
const tempDir = await
|
|
3845
|
+
const tempDir = await import_fs7.default.promises.mkdtemp(import_path10.default.join(import_os.default.tmpdir(), "playwright-show-report-"));
|
|
3720
3846
|
const cleanup = () => {
|
|
3721
3847
|
try {
|
|
3722
|
-
|
|
3848
|
+
import_fs7.default.rmSync(tempDir, { recursive: true, force: true });
|
|
3723
3849
|
} catch {
|
|
3724
3850
|
}
|
|
3725
3851
|
};
|
|
@@ -3730,7 +3856,7 @@ async function extractReportZip(zipPath) {
|
|
|
3730
3856
|
cleanup();
|
|
3731
3857
|
throw new Error(`Failed to extract report from "${zipPath}": ${e.message}`);
|
|
3732
3858
|
}
|
|
3733
|
-
const hasIndex = await
|
|
3859
|
+
const hasIndex = await import_fs7.default.promises.access(import_path10.default.join(tempDir, "index.html")).then(() => true, () => false);
|
|
3734
3860
|
if (!hasIndex) {
|
|
3735
3861
|
cleanup();
|
|
3736
3862
|
throw new Error(`No "index.html" found at the top level of "${zipPath}"`);
|
|
@@ -3762,7 +3888,7 @@ async function showHTMLReport(reportFolder, host = "localhost", port, testId) {
|
|
|
3762
3888
|
});
|
|
3763
3889
|
}
|
|
3764
3890
|
var HtmlBuilder = class {
|
|
3765
|
-
constructor(yazl3, config2, outputDir, attachmentsBaseURL, doNotInlineAssets, options) {
|
|
3891
|
+
constructor(yazl3, config2, outputDir, attachmentsBaseURL, doNotInlineAssets, options, testFilter) {
|
|
3766
3892
|
this._stepsInFile = new MultiMap();
|
|
3767
3893
|
this._hasTraces = false;
|
|
3768
3894
|
this._dataZipFile = new yazl3.ZipFile();
|
|
@@ -3770,14 +3896,15 @@ var HtmlBuilder = class {
|
|
|
3770
3896
|
this._reportFolder = outputDir;
|
|
3771
3897
|
this._options = options;
|
|
3772
3898
|
this._doNotInlineAssets = doNotInlineAssets;
|
|
3773
|
-
|
|
3899
|
+
this._testFilter = testFilter;
|
|
3900
|
+
import_fs7.default.mkdirSync(this._reportFolder, { recursive: true });
|
|
3774
3901
|
this._attachmentsBaseURL = attachmentsBaseURL;
|
|
3775
3902
|
}
|
|
3776
3903
|
async build(metadata, projectSuites, result, topLevelErrors, machines) {
|
|
3777
3904
|
const data = /* @__PURE__ */ new Map();
|
|
3778
3905
|
for (const projectSuite of projectSuites) {
|
|
3779
3906
|
const projectName = projectSuite.project().name;
|
|
3780
|
-
for (const fileSuite of projectSuite.suites) {
|
|
3907
|
+
for (const fileSuite of filterTests(projectSuite.suites, this._testFilter)) {
|
|
3781
3908
|
const fileName = this._relativeLocation(fileSuite.location).file;
|
|
3782
3909
|
this._createEntryForSuite(data, projectName, fileSuite, fileName, true);
|
|
3783
3910
|
}
|
|
@@ -3838,54 +3965,54 @@ var HtmlBuilder = class {
|
|
|
3838
3965
|
}
|
|
3839
3966
|
const reportIndexFile = await this._writeStaticAssets();
|
|
3840
3967
|
if (this._hasTraces) {
|
|
3841
|
-
const traceViewerFolder =
|
|
3842
|
-
const traceViewerTargetFolder =
|
|
3843
|
-
const traceViewerAssetsTargetFolder =
|
|
3844
|
-
|
|
3845
|
-
for (const file of
|
|
3968
|
+
const traceViewerFolder = import_path10.default.join(require.resolve("patchwright-core"), "..", "lib", "vite", "traceViewer");
|
|
3969
|
+
const traceViewerTargetFolder = import_path10.default.join(this._reportFolder, "trace");
|
|
3970
|
+
const traceViewerAssetsTargetFolder = import_path10.default.join(traceViewerTargetFolder, "assets");
|
|
3971
|
+
import_fs7.default.mkdirSync(traceViewerAssetsTargetFolder, { recursive: true });
|
|
3972
|
+
for (const file of import_fs7.default.readdirSync(traceViewerFolder)) {
|
|
3846
3973
|
if (file.endsWith(".map") || file.includes("watch") || file.includes("assets"))
|
|
3847
3974
|
continue;
|
|
3848
|
-
await copyFileAndMakeWritable(
|
|
3975
|
+
await copyFileAndMakeWritable(import_path10.default.join(traceViewerFolder, file), import_path10.default.join(traceViewerTargetFolder, file));
|
|
3849
3976
|
}
|
|
3850
|
-
for (const file of
|
|
3977
|
+
for (const file of import_fs7.default.readdirSync(import_path10.default.join(traceViewerFolder, "assets"))) {
|
|
3851
3978
|
if (file.endsWith(".map") || file.includes("xtermModule"))
|
|
3852
3979
|
continue;
|
|
3853
|
-
await copyFileAndMakeWritable(
|
|
3980
|
+
await copyFileAndMakeWritable(import_path10.default.join(traceViewerFolder, "assets", file), import_path10.default.join(traceViewerAssetsTargetFolder, file));
|
|
3854
3981
|
}
|
|
3855
3982
|
}
|
|
3856
3983
|
await this._writeReportData(reportIndexFile);
|
|
3857
3984
|
return { ok, singleTestId };
|
|
3858
3985
|
}
|
|
3859
3986
|
async _writeStaticAssets() {
|
|
3860
|
-
const appFolder =
|
|
3861
|
-
const reportIndexFile =
|
|
3987
|
+
const appFolder = import_path10.default.join(require.resolve("patchwright-core"), "..", "lib", "vite", "htmlReport");
|
|
3988
|
+
const reportIndexFile = import_path10.default.join(this._reportFolder, "index.html");
|
|
3862
3989
|
if (this._doNotInlineAssets) {
|
|
3863
|
-
const html = await
|
|
3990
|
+
const html = await import_fs7.default.promises.readFile(import_path10.default.join(appFolder, "index.html"), "utf-8");
|
|
3864
3991
|
await Promise.all([
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3992
|
+
import_fs7.default.promises.writeFile(reportIndexFile, html),
|
|
3993
|
+
import_fs7.default.promises.copyFile(import_path10.default.join(appFolder, "report.js"), import_path10.default.join(this._reportFolder, "report.js")),
|
|
3994
|
+
import_fs7.default.promises.copyFile(import_path10.default.join(appFolder, "report.css"), import_path10.default.join(this._reportFolder, "report.css"))
|
|
3868
3995
|
]);
|
|
3869
3996
|
} else {
|
|
3870
|
-
let html = await
|
|
3997
|
+
let html = await import_fs7.default.promises.readFile(import_path10.default.join(appFolder, "index.html"), "utf-8");
|
|
3871
3998
|
const [js, css] = await Promise.all([
|
|
3872
|
-
|
|
3873
|
-
|
|
3999
|
+
import_fs7.default.promises.readFile(import_path10.default.join(appFolder, "report.js"), "utf-8"),
|
|
4000
|
+
import_fs7.default.promises.readFile(import_path10.default.join(appFolder, "report.css"), "utf-8")
|
|
3874
4001
|
]);
|
|
3875
4002
|
html = html.replace(/<script type="module"[^>]*><\/script>/, () => `<script type="module">${js}</script>`);
|
|
3876
4003
|
html = html.replace(/<link rel="stylesheet"[^>]*>/, () => `<style type='text/css'>${css}</style>`);
|
|
3877
|
-
await
|
|
4004
|
+
await import_fs7.default.promises.writeFile(reportIndexFile, html);
|
|
3878
4005
|
}
|
|
3879
4006
|
return reportIndexFile;
|
|
3880
4007
|
}
|
|
3881
4008
|
async _writeReportData(filePath) {
|
|
3882
|
-
|
|
4009
|
+
import_fs7.default.appendFileSync(filePath, '<template id="playwrightReportBase64">data:application/zip;base64,');
|
|
3883
4010
|
await new Promise((resolve, reject) => {
|
|
3884
4011
|
this._dataZipFile.end(void 0, () => {
|
|
3885
|
-
this._dataZipFile.outputStream.pipe(new Base64Encoder()).pipe(
|
|
4012
|
+
this._dataZipFile.outputStream.pipe(new Base64Encoder()).pipe(import_fs7.default.createWriteStream(filePath, { flags: "a" })).on("close", resolve).on("error", reject);
|
|
3886
4013
|
});
|
|
3887
4014
|
});
|
|
3888
|
-
|
|
4015
|
+
import_fs7.default.appendFileSync(filePath, "</template>");
|
|
3889
4016
|
}
|
|
3890
4017
|
_addDataFile(fileName, data) {
|
|
3891
4018
|
this._dataZipFile.addBuffer(Buffer.from(JSON.stringify(data)), fileName);
|
|
@@ -3908,19 +4035,19 @@ var HtmlBuilder = class {
|
|
|
3908
4035
|
testFileSummary.tests.push(test.testCaseSummary);
|
|
3909
4036
|
}
|
|
3910
4037
|
}
|
|
3911
|
-
_processSuite(suite, projectName,
|
|
3912
|
-
const newPath = [...
|
|
3913
|
-
suite.entries().forEach((e) => {
|
|
4038
|
+
_processSuite(suite, projectName, path22, deep, outTests) {
|
|
4039
|
+
const newPath = [...path22, suite.title];
|
|
4040
|
+
filterTests(suite.entries(), this._testFilter).forEach((e) => {
|
|
3914
4041
|
if (e.type === "test")
|
|
3915
4042
|
outTests.push(this._createTestEntry(e, projectName, newPath));
|
|
3916
4043
|
else if (deep)
|
|
3917
4044
|
this._processSuite(e, projectName, newPath, deep, outTests);
|
|
3918
4045
|
});
|
|
3919
4046
|
}
|
|
3920
|
-
_createTestEntry(test, projectName,
|
|
4047
|
+
_createTestEntry(test, projectName, path22) {
|
|
3921
4048
|
const duration = test.results.reduce((a, r) => a + r.duration, 0);
|
|
3922
4049
|
const location = this._relativeLocation(test.location);
|
|
3923
|
-
|
|
4050
|
+
path22 = path22.slice(1).filter((path23) => path23.length > 0);
|
|
3924
4051
|
const results = test.results.map((r) => this._createTestResult(test, r));
|
|
3925
4052
|
return {
|
|
3926
4053
|
testCase: {
|
|
@@ -3932,7 +4059,7 @@ var HtmlBuilder = class {
|
|
|
3932
4059
|
annotations: this._serializeAnnotations(test.annotations),
|
|
3933
4060
|
tags: [...new Set(test.tags)],
|
|
3934
4061
|
outcome: test.outcome(),
|
|
3935
|
-
path:
|
|
4062
|
+
path: path22,
|
|
3936
4063
|
results,
|
|
3937
4064
|
repeatEachIndex: test.repeatEachIndex || void 0,
|
|
3938
4065
|
// Do not include zero.
|
|
@@ -3947,7 +4074,7 @@ var HtmlBuilder = class {
|
|
|
3947
4074
|
annotations: this._serializeAnnotations(test.annotations),
|
|
3948
4075
|
tags: [...new Set(test.tags)],
|
|
3949
4076
|
outcome: test.outcome(),
|
|
3950
|
-
path:
|
|
4077
|
+
path: path22,
|
|
3951
4078
|
ok: test.outcome() === "expected" || test.outcome() === "flaky",
|
|
3952
4079
|
repeatEachIndex: test.repeatEachIndex || void 0,
|
|
3953
4080
|
// Do not include zero.
|
|
@@ -3966,7 +4093,7 @@ var HtmlBuilder = class {
|
|
|
3966
4093
|
return attachments.map((a) => {
|
|
3967
4094
|
if (a.name === "trace")
|
|
3968
4095
|
this._hasTraces = true;
|
|
3969
|
-
if ((a.name === "stdout" || a.name === "stderr") && a.contentType === "text/plain") {
|
|
4096
|
+
if ((a.name === "stdout" || a.name === "stderr") && a.contentType === "text/plain" && typeof a.body === "string") {
|
|
3970
4097
|
if (lastAttachment && lastAttachment.name === a.name && lastAttachment.contentType === a.contentType) {
|
|
3971
4098
|
lastAttachment.body += (0, import_util9.stripAnsiEscapes)(a.body);
|
|
3972
4099
|
return null;
|
|
@@ -3978,11 +4105,11 @@ var HtmlBuilder = class {
|
|
|
3978
4105
|
if (a.path) {
|
|
3979
4106
|
let fileName = a.path;
|
|
3980
4107
|
try {
|
|
3981
|
-
const buffer =
|
|
3982
|
-
const sha1 = calculateSha13(buffer) +
|
|
4108
|
+
const buffer = import_fs7.default.readFileSync(a.path);
|
|
4109
|
+
const sha1 = calculateSha13(buffer) + import_path10.default.extname(a.path);
|
|
3983
4110
|
fileName = this._attachmentsBaseURL + sha1;
|
|
3984
|
-
|
|
3985
|
-
|
|
4111
|
+
import_fs7.default.mkdirSync(import_path10.default.join(this._reportFolder, "data"), { recursive: true });
|
|
4112
|
+
import_fs7.default.writeFileSync(import_path10.default.join(this._reportFolder, "data", sha1), buffer);
|
|
3986
4113
|
} catch (e) {
|
|
3987
4114
|
}
|
|
3988
4115
|
return {
|
|
@@ -4005,10 +4132,10 @@ var HtmlBuilder = class {
|
|
|
4005
4132
|
} catch (e) {
|
|
4006
4133
|
}
|
|
4007
4134
|
}
|
|
4008
|
-
|
|
4009
|
-
const extension = sanitizeForFilePath2(
|
|
4135
|
+
import_fs7.default.mkdirSync(import_path10.default.join(this._reportFolder, "data"), { recursive: true });
|
|
4136
|
+
const extension = sanitizeForFilePath2(import_path10.default.extname(a.name).replace(/^\./, "")) || mime2.getExtension(a.contentType) || "dat";
|
|
4010
4137
|
const sha1 = calculateSha13(a.body) + "." + extension;
|
|
4011
|
-
|
|
4138
|
+
import_fs7.default.writeFileSync(import_path10.default.join(this._reportFolder, "data", sha1), a.body);
|
|
4012
4139
|
return {
|
|
4013
4140
|
name: a.name,
|
|
4014
4141
|
contentType: a.contentType,
|
|
@@ -4085,7 +4212,7 @@ var HtmlBuilder = class {
|
|
|
4085
4212
|
_relativeLocation(location) {
|
|
4086
4213
|
if (!location)
|
|
4087
4214
|
return void 0;
|
|
4088
|
-
const file = toPosixPath2(
|
|
4215
|
+
const file = toPosixPath2(import_path10.default.relative(this._config.rootDir, location.file));
|
|
4089
4216
|
return {
|
|
4090
4217
|
file,
|
|
4091
4218
|
line: location.line,
|
|
@@ -4165,12 +4292,12 @@ function createSnippets(stepsInFile) {
|
|
|
4165
4292
|
for (const file of stepsInFile.keys()) {
|
|
4166
4293
|
let source;
|
|
4167
4294
|
try {
|
|
4168
|
-
source =
|
|
4295
|
+
source = import_fs7.default.readFileSync(file, "utf-8") + "\n//";
|
|
4169
4296
|
} catch (e) {
|
|
4170
4297
|
continue;
|
|
4171
4298
|
}
|
|
4172
4299
|
const lines = source.split("\n").length;
|
|
4173
|
-
const highlighted =
|
|
4300
|
+
const highlighted = codeFrame2(source, { line: lines, column: 1 }, { colors: internalScreen.colors, linesAbove: lines, linesBelow: 0 });
|
|
4174
4301
|
const highlightedLines = highlighted.split("\n");
|
|
4175
4302
|
const lineWithArrow = highlightedLines[highlightedLines.length - 1];
|
|
4176
4303
|
for (const step of stepsInFile.get(file)) {
|
|
@@ -4187,20 +4314,17 @@ function createSnippets(stepsInFile) {
|
|
|
4187
4314
|
function createErrorCodeframe(message, location) {
|
|
4188
4315
|
let source;
|
|
4189
4316
|
try {
|
|
4190
|
-
source =
|
|
4317
|
+
source = import_fs7.default.readFileSync(location.file, "utf-8") + "\n//";
|
|
4191
4318
|
} catch (e) {
|
|
4192
4319
|
return;
|
|
4193
4320
|
}
|
|
4194
|
-
return
|
|
4321
|
+
return codeFrame2(
|
|
4195
4322
|
source,
|
|
4196
4323
|
{
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
column: location.column
|
|
4200
|
-
}
|
|
4324
|
+
line: location.line,
|
|
4325
|
+
column: location.column
|
|
4201
4326
|
},
|
|
4202
4327
|
{
|
|
4203
|
-
highlightCode: false,
|
|
4204
4328
|
linesAbove: 100,
|
|
4205
4329
|
linesBelow: 100,
|
|
4206
4330
|
message: (0, import_util9.stripAnsiEscapes)(message).split("\n")[0] || void 0
|
|
@@ -4213,8 +4337,8 @@ function writeLine2(line) {
|
|
|
4213
4337
|
var html_default = HtmlReporter;
|
|
4214
4338
|
|
|
4215
4339
|
// packages/playwright/src/reporters/json.ts
|
|
4216
|
-
var
|
|
4217
|
-
var
|
|
4340
|
+
var import_fs8 = __toESM(require("fs"));
|
|
4341
|
+
var import_path11 = __toESM(require("path"));
|
|
4218
4342
|
var import_common5 = require("../common");
|
|
4219
4343
|
var { MultiMap: MultiMap2 } = require("patchwright-core/lib/coreBundle").iso;
|
|
4220
4344
|
var { toPosixPath: toPosixPath3 } = require("patchwright-core/lib/coreBundle").utils;
|
|
@@ -4222,6 +4346,7 @@ var JSONReporter = class {
|
|
|
4222
4346
|
constructor(options) {
|
|
4223
4347
|
this._errors = [];
|
|
4224
4348
|
this._resolvedOutputFile = resolveOutputFile("JSON", options)?.outputFile;
|
|
4349
|
+
this._testFilter = createTestFilter(options, "JSON");
|
|
4225
4350
|
}
|
|
4226
4351
|
version() {
|
|
4227
4352
|
return "v2";
|
|
@@ -4272,7 +4397,7 @@ var JSONReporter = class {
|
|
|
4272
4397
|
flaky: 0
|
|
4273
4398
|
}
|
|
4274
4399
|
};
|
|
4275
|
-
for (const test of this.suite.
|
|
4400
|
+
for (const test of visitTests(this.suite, this._testFilter))
|
|
4276
4401
|
++report.stats[test.outcome()];
|
|
4277
4402
|
return report;
|
|
4278
4403
|
}
|
|
@@ -4307,7 +4432,7 @@ var JSONReporter = class {
|
|
|
4307
4432
|
if (!location)
|
|
4308
4433
|
return { file: "", line: 0, column: 0 };
|
|
4309
4434
|
return {
|
|
4310
|
-
file: toPosixPath3(
|
|
4435
|
+
file: toPosixPath3(import_path11.default.relative(this.config.rootDir, location.file)),
|
|
4311
4436
|
line: location.line,
|
|
4312
4437
|
column: location.column
|
|
4313
4438
|
};
|
|
@@ -4327,7 +4452,7 @@ var JSONReporter = class {
|
|
|
4327
4452
|
}
|
|
4328
4453
|
}
|
|
4329
4454
|
for (const spec of from.specs || []) {
|
|
4330
|
-
const toSpec = to.specs.find((s) => s.title === spec.title &&
|
|
4455
|
+
const toSpec = to.specs.find((s) => s.title === spec.title && this._locationMatches(s, spec));
|
|
4331
4456
|
if (toSpec)
|
|
4332
4457
|
toSpec.tests.push(...spec.tests);
|
|
4333
4458
|
else
|
|
@@ -4335,13 +4460,15 @@ var JSONReporter = class {
|
|
|
4335
4460
|
}
|
|
4336
4461
|
}
|
|
4337
4462
|
_serializeSuite(projectId, projectName, suite) {
|
|
4338
|
-
|
|
4463
|
+
const entries = filterTests(suite.entries(), this._testFilter);
|
|
4464
|
+
const suites = entries.filter((entry) => entry.type !== "test").map((suite2) => this._serializeSuite(projectId, projectName, suite2)).filter((s) => s);
|
|
4465
|
+
const tests = entries.filter((entry) => entry.type === "test");
|
|
4466
|
+
if (!tests.length && !suites.length)
|
|
4339
4467
|
return null;
|
|
4340
|
-
const suites = suite.suites.map((suite2) => this._serializeSuite(projectId, projectName, suite2)).filter((s) => s);
|
|
4341
4468
|
return {
|
|
4342
4469
|
title: suite.title,
|
|
4343
4470
|
...this._relativeLocation(suite.location),
|
|
4344
|
-
specs:
|
|
4471
|
+
specs: tests.map((test) => this._serializeTestSpec(projectId, projectName, test)),
|
|
4345
4472
|
suites: suites.length ? suites : void 0
|
|
4346
4473
|
};
|
|
4347
4474
|
}
|
|
@@ -4410,8 +4537,8 @@ var JSONReporter = class {
|
|
|
4410
4537
|
async function outputReport(report, resolvedOutputFile) {
|
|
4411
4538
|
const reportString = JSON.stringify(report, void 0, 2);
|
|
4412
4539
|
if (resolvedOutputFile) {
|
|
4413
|
-
await
|
|
4414
|
-
await
|
|
4540
|
+
await import_fs8.default.promises.mkdir(import_path11.default.dirname(resolvedOutputFile), { recursive: true });
|
|
4541
|
+
await import_fs8.default.promises.writeFile(resolvedOutputFile, reportString);
|
|
4415
4542
|
} else {
|
|
4416
4543
|
console.log(reportString);
|
|
4417
4544
|
}
|
|
@@ -4432,10 +4559,10 @@ function serializePatterns(patterns) {
|
|
|
4432
4559
|
var json_default = JSONReporter;
|
|
4433
4560
|
|
|
4434
4561
|
// packages/playwright/src/reporters/junit.ts
|
|
4435
|
-
var
|
|
4436
|
-
var
|
|
4562
|
+
var import_fs9 = __toESM(require("fs"));
|
|
4563
|
+
var import_path12 = __toESM(require("path"));
|
|
4437
4564
|
var import_util10 = require("../util");
|
|
4438
|
-
var { getAsBooleanFromENV:
|
|
4565
|
+
var { getAsBooleanFromENV: getAsBooleanFromENV5 } = require("patchwright-core/lib/coreBundle").utils;
|
|
4439
4566
|
var JUnitReporter = class {
|
|
4440
4567
|
constructor(options) {
|
|
4441
4568
|
this.totalTests = 0;
|
|
@@ -4446,10 +4573,11 @@ var JUnitReporter = class {
|
|
|
4446
4573
|
this.includeProjectInTestName = false;
|
|
4447
4574
|
this.includeRetries = false;
|
|
4448
4575
|
this.omitTags = false;
|
|
4449
|
-
this.
|
|
4450
|
-
this.
|
|
4451
|
-
this.
|
|
4452
|
-
this.
|
|
4576
|
+
this.testFilter = createTestFilter(options, "JUNIT");
|
|
4577
|
+
this.stripANSIControlSequences = getAsBooleanFromENV5("PLAYWRIGHT_JUNIT_STRIP_ANSI", !!options.stripANSIControlSequences);
|
|
4578
|
+
this.includeProjectInTestName = getAsBooleanFromENV5("PLAYWRIGHT_JUNIT_INCLUDE_PROJECT_IN_TEST_NAME", !!options.includeProjectInTestName);
|
|
4579
|
+
this.includeRetries = !!this.testFilter || getAsBooleanFromENV5("PLAYWRIGHT_JUNIT_INCLUDE_RETRIES", !!options.includeRetries);
|
|
4580
|
+
this.omitTags = getAsBooleanFromENV5("PLAYWRIGHT_JUNIT_OMIT_TAGS", !!options.omitTags);
|
|
4453
4581
|
this.configDir = options.configDir;
|
|
4454
4582
|
this.resolvedOutputFile = resolveOutputFile("JUNIT", options)?.outputFile;
|
|
4455
4583
|
}
|
|
@@ -4469,7 +4597,7 @@ var JUnitReporter = class {
|
|
|
4469
4597
|
async onEnd(result) {
|
|
4470
4598
|
const children = [];
|
|
4471
4599
|
for (const projectSuite of this.suite.suites) {
|
|
4472
|
-
for (const fileSuite of projectSuite.suites)
|
|
4600
|
+
for (const fileSuite of filterTests(projectSuite.suites, this.testFilter))
|
|
4473
4601
|
children.push(await this._buildTestSuite(projectSuite.title, fileSuite));
|
|
4474
4602
|
}
|
|
4475
4603
|
const tokens = [];
|
|
@@ -4490,8 +4618,8 @@ var JUnitReporter = class {
|
|
|
4490
4618
|
serializeXML(root, tokens, this.stripANSIControlSequences);
|
|
4491
4619
|
const reportString = tokens.join("\n");
|
|
4492
4620
|
if (this.resolvedOutputFile) {
|
|
4493
|
-
await
|
|
4494
|
-
await
|
|
4621
|
+
await import_fs9.default.promises.mkdir(import_path12.default.dirname(this.resolvedOutputFile), { recursive: true });
|
|
4622
|
+
await import_fs9.default.promises.writeFile(this.resolvedOutputFile, reportString);
|
|
4495
4623
|
} else {
|
|
4496
4624
|
console.log(reportString);
|
|
4497
4625
|
}
|
|
@@ -4504,7 +4632,7 @@ var JUnitReporter = class {
|
|
|
4504
4632
|
let duration = 0;
|
|
4505
4633
|
const children = [];
|
|
4506
4634
|
const testCaseNamePrefix = projectName && this.includeProjectInTestName ? `[${projectName}] ` : "";
|
|
4507
|
-
for (const test of suite.
|
|
4635
|
+
for (const test of visitTests(suite, this.testFilter)) {
|
|
4508
4636
|
++tests;
|
|
4509
4637
|
if (test.outcome() === "skipped")
|
|
4510
4638
|
++skipped;
|
|
@@ -4609,7 +4737,7 @@ var JUnitReporter = class {
|
|
|
4609
4737
|
entry.children.push({
|
|
4610
4738
|
name: "failure",
|
|
4611
4739
|
attributes: {
|
|
4612
|
-
message: `${
|
|
4740
|
+
message: `${import_path12.default.basename(test.location.file)}:${test.location.line}:${test.location.column} ${test.title}`,
|
|
4613
4741
|
type: "FAILURE"
|
|
4614
4742
|
},
|
|
4615
4743
|
text: (0, import_util10.stripAnsiEscapes)(formatFailure(nonTerminalScreen, this.config, test, void 0, { omitTags: this.omitTags }))
|
|
@@ -4627,16 +4755,16 @@ var JUnitReporter = class {
|
|
|
4627
4755
|
for (const attachment of result.attachments) {
|
|
4628
4756
|
if (!attachment.path)
|
|
4629
4757
|
continue;
|
|
4630
|
-
let attachmentPath =
|
|
4758
|
+
let attachmentPath = import_path12.default.relative(this.configDir, attachment.path);
|
|
4631
4759
|
try {
|
|
4632
4760
|
if (this.resolvedOutputFile)
|
|
4633
|
-
attachmentPath =
|
|
4761
|
+
attachmentPath = import_path12.default.relative(import_path12.default.dirname(this.resolvedOutputFile), attachment.path);
|
|
4634
4762
|
} catch {
|
|
4635
4763
|
systemOut.push(`
|
|
4636
4764
|
Warning: Unable to make attachment path ${attachment.path} relative to report output file ${this.resolvedOutputFile}`);
|
|
4637
4765
|
}
|
|
4638
4766
|
try {
|
|
4639
|
-
await
|
|
4767
|
+
await import_fs9.default.promises.access(attachment.path);
|
|
4640
4768
|
systemOut.push(`
|
|
4641
4769
|
[[ATTACHMENT|${attachmentPath}]]
|
|
4642
4770
|
`);
|
|
@@ -4723,10 +4851,10 @@ function escape(text, stripANSIControlSequences, isCharacterData) {
|
|
|
4723
4851
|
var junit_default = JUnitReporter;
|
|
4724
4852
|
|
|
4725
4853
|
// packages/playwright/src/reporters/line.ts
|
|
4726
|
-
var { getAsBooleanFromENV:
|
|
4854
|
+
var { getAsBooleanFromENV: getAsBooleanFromENV6 } = require("patchwright-core/lib/coreBundle").utils;
|
|
4727
4855
|
var LineReporter = class extends TerminalReporter {
|
|
4728
4856
|
constructor(options) {
|
|
4729
|
-
super({ ...options, omitTags:
|
|
4857
|
+
super({ ...options, omitTags: getAsBooleanFromENV6("PLAYWRIGHT_LINE_OMIT_TAGS", options?.omitTags) });
|
|
4730
4858
|
this._current = 0;
|
|
4731
4859
|
this._failures = 0;
|
|
4732
4860
|
this._didBegin = false;
|
|
@@ -4776,24 +4904,6 @@ var LineReporter = class extends TerminalReporter {
|
|
|
4776
4904
|
if (this.screen.isTTY && step.category === "test.step")
|
|
4777
4905
|
this._updateLine(test, result, step.parent);
|
|
4778
4906
|
}
|
|
4779
|
-
async onTestPaused(test, result) {
|
|
4780
|
-
if (!process.stdin.isTTY && !process.env.PW_TEST_DEBUG_REPORTERS)
|
|
4781
|
-
return;
|
|
4782
|
-
if (!process.env.PW_TEST_DEBUG_REPORTERS)
|
|
4783
|
-
this.screen.stdout.write(`\x1B[1A\x1B[2K`);
|
|
4784
|
-
if (test.outcome() === "unexpected") {
|
|
4785
|
-
this.writeLine(this.screen.colors.red(this.formatTestHeader(test, { indent: " ", index: ++this._failures })));
|
|
4786
|
-
this.writeLine(this.formatResultErrors(test, result));
|
|
4787
|
-
markErrorsAsReported(result);
|
|
4788
|
-
this.writeLine(this.screen.colors.yellow(` Paused on error. Press Ctrl+C to end.`) + "\n\n");
|
|
4789
|
-
} else {
|
|
4790
|
-
this.writeLine(this.screen.colors.yellow(this.formatTestHeader(test, { indent: " " })));
|
|
4791
|
-
this.writeLine(this.screen.colors.yellow(` Paused at test end. Press Ctrl+C to end.`) + "\n\n");
|
|
4792
|
-
}
|
|
4793
|
-
this._updateLine(test, result, void 0);
|
|
4794
|
-
await new Promise(() => {
|
|
4795
|
-
});
|
|
4796
|
-
}
|
|
4797
4907
|
onTestEnd(test, result) {
|
|
4798
4908
|
super.onTestEnd(test, result);
|
|
4799
4909
|
if (!this.willRetry(test) && (test.outcome() === "flaky" || test.outcome() === "unexpected" || result.status === "interrupted")) {
|
|
@@ -4834,15 +4944,15 @@ var line_default = LineReporter;
|
|
|
4834
4944
|
|
|
4835
4945
|
// packages/playwright/src/reporters/list.ts
|
|
4836
4946
|
var import_util11 = require("../util");
|
|
4837
|
-
var { msToString:
|
|
4838
|
-
var { getAsBooleanFromENV:
|
|
4947
|
+
var { msToString: msToString4 } = require("patchwright-core/lib/coreBundle").iso;
|
|
4948
|
+
var { getAsBooleanFromENV: getAsBooleanFromENV7 } = require("patchwright-core/lib/coreBundle").utils;
|
|
4839
4949
|
var DOES_NOT_SUPPORT_UTF8_IN_TERMINAL = process.platform === "win32" && process.env.TERM_PROGRAM !== "vscode" && !process.env.WT_SESSION;
|
|
4840
4950
|
var POSITIVE_STATUS_MARK = DOES_NOT_SUPPORT_UTF8_IN_TERMINAL ? "ok" : "\u2713";
|
|
4841
4951
|
var NEGATIVE_STATUS_MARK = DOES_NOT_SUPPORT_UTF8_IN_TERMINAL ? "x" : "\u2718";
|
|
4842
4952
|
var ListReporter = class extends TerminalReporter {
|
|
4843
4953
|
constructor(options) {
|
|
4844
|
-
const printFailuresInline =
|
|
4845
|
-
super({ ...options, omitTags:
|
|
4954
|
+
const printFailuresInline = getAsBooleanFromENV7("PLAYWRIGHT_LIST_PRINT_FAILURES_INLINE", options?.printFailuresInline);
|
|
4955
|
+
super({ ...options, omitTags: getAsBooleanFromENV7("PLAYWRIGHT_LIST_OMIT_TAGS", options?.omitTags), lastResult: printFailuresInline });
|
|
4846
4956
|
this._lastRow = 0;
|
|
4847
4957
|
this._lastColumn = 0;
|
|
4848
4958
|
this._testRows = /* @__PURE__ */ new Map();
|
|
@@ -4851,8 +4961,7 @@ var ListReporter = class extends TerminalReporter {
|
|
|
4851
4961
|
this._stepIndex = /* @__PURE__ */ new Map();
|
|
4852
4962
|
this._needNewLine = false;
|
|
4853
4963
|
this._failureIndex = /* @__PURE__ */ new Map();
|
|
4854
|
-
this.
|
|
4855
|
-
this._printSteps = getAsBooleanFromENV5("PLAYWRIGHT_LIST_PRINT_STEPS", options?.printSteps);
|
|
4964
|
+
this._printSteps = getAsBooleanFromENV7("PLAYWRIGHT_LIST_PRINT_STEPS", options?.printSteps);
|
|
4856
4965
|
this._printFailuresInline = printFailuresInline;
|
|
4857
4966
|
}
|
|
4858
4967
|
onBegin(suite) {
|
|
@@ -4924,7 +5033,7 @@ var ListReporter = class extends TerminalReporter {
|
|
|
4924
5033
|
text = this.screen.colors.red(title);
|
|
4925
5034
|
else
|
|
4926
5035
|
text = title;
|
|
4927
|
-
text += this.screen.colors.dim(` (${
|
|
5036
|
+
text += this.screen.colors.dim(` (${msToString4(step.duration)})`);
|
|
4928
5037
|
this._updateOrAppendLine(this._stepRows, step, text, prefix);
|
|
4929
5038
|
}
|
|
4930
5039
|
_maybeWriteNewLine() {
|
|
@@ -4959,29 +5068,11 @@ var ListReporter = class extends TerminalReporter {
|
|
|
4959
5068
|
this._updateLineCountAndNewLineFlagForOutput(text);
|
|
4960
5069
|
stream.write(chunk);
|
|
4961
5070
|
}
|
|
4962
|
-
async onTestPaused(test, result) {
|
|
4963
|
-
if (!process.stdin.isTTY && !process.env.PW_TEST_DEBUG_REPORTERS)
|
|
4964
|
-
return;
|
|
4965
|
-
this._paused.add(result);
|
|
4966
|
-
this._updateTestLine(test, result);
|
|
4967
|
-
this._maybeWriteNewLine();
|
|
4968
|
-
if (test.outcome() === "unexpected") {
|
|
4969
|
-
const errors = this.formatResultErrors(test, result);
|
|
4970
|
-
this.writeLine(errors);
|
|
4971
|
-
this._updateLineCountAndNewLineFlagForOutput(errors);
|
|
4972
|
-
markErrorsAsReported(result);
|
|
4973
|
-
}
|
|
4974
|
-
this._appendLine(this.screen.colors.yellow(`Paused ${test.outcome() === "unexpected" ? "on error" : "at test end"}. Press Ctrl+C to end.`), this._testPrefix("", ""));
|
|
4975
|
-
await new Promise(() => {
|
|
4976
|
-
});
|
|
4977
|
-
}
|
|
4978
5071
|
onTestEnd(test, result) {
|
|
4979
5072
|
super.onTestEnd(test, result);
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
const isFailure = result.status !== "skipped" && result.status !== test.expectedStatus;
|
|
4984
|
-
if (!wasPaused && this._printFailuresInline && isFailure)
|
|
5073
|
+
this._updateTestLine(test, result);
|
|
5074
|
+
const isFailure2 = result.status !== "skipped" && result.status !== test.expectedStatus;
|
|
5075
|
+
if (this._printFailuresInline && isFailure2)
|
|
4985
5076
|
this._printFailure(test);
|
|
4986
5077
|
}
|
|
4987
5078
|
_printFailure(test) {
|
|
@@ -5016,7 +5107,7 @@ var ListReporter = class extends TerminalReporter {
|
|
|
5016
5107
|
prefix = this._testPrefix(index, this.screen.colors.red(statusMark));
|
|
5017
5108
|
text = this.screen.colors.red(title);
|
|
5018
5109
|
}
|
|
5019
|
-
text += this._retrySuffix(result) + this.screen.colors.dim(` (${
|
|
5110
|
+
text += this._retrySuffix(result) + this.screen.colors.dim(` (${msToString4(result.duration)})`);
|
|
5020
5111
|
}
|
|
5021
5112
|
this._updateOrAppendLine(this._testRows, test, text, prefix);
|
|
5022
5113
|
}
|
|
@@ -5081,7 +5172,7 @@ var lastStepOrdinalSymbol = /* @__PURE__ */ Symbol("lastStepOrdinal");
|
|
|
5081
5172
|
var list_default = ListReporter;
|
|
5082
5173
|
|
|
5083
5174
|
// packages/playwright/src/reporters/listModeReporter.ts
|
|
5084
|
-
var
|
|
5175
|
+
var import_path13 = __toESM(require("path"));
|
|
5085
5176
|
var ListModeReporter = class {
|
|
5086
5177
|
constructor(options = {}) {
|
|
5087
5178
|
this._options = options;
|
|
@@ -5099,7 +5190,7 @@ var ListModeReporter = class {
|
|
|
5099
5190
|
const files = /* @__PURE__ */ new Set();
|
|
5100
5191
|
for (const test of tests) {
|
|
5101
5192
|
const [, projectName, , ...titles] = test.titlePath();
|
|
5102
|
-
const location = `${
|
|
5193
|
+
const location = `${import_path13.default.relative(this.config.rootDir, test.location.file)}:${test.location.line}:${test.location.column}`;
|
|
5103
5194
|
const testId = this._options.includeTestId ? `[id=${test.id}] ` : "";
|
|
5104
5195
|
const projectLabel = this._options.includeTestId ? `project=` : "";
|
|
5105
5196
|
const projectTitle = projectName ? `[${projectLabel}${projectName}] \u203A ` : "";
|
|
@@ -5119,8 +5210,8 @@ var listModeReporter_default = ListModeReporter;
|
|
|
5119
5210
|
|
|
5120
5211
|
// packages/playwright/src/reporters/perfetto.ts
|
|
5121
5212
|
var import_events2 = require("events");
|
|
5122
|
-
var
|
|
5123
|
-
var
|
|
5213
|
+
var import_fs10 = __toESM(require("fs"));
|
|
5214
|
+
var import_path14 = __toESM(require("path"));
|
|
5124
5215
|
var import_zlib = __toESM(require("zlib"));
|
|
5125
5216
|
var import_coreBundle2 = require("patchwright-core/lib/coreBundle");
|
|
5126
5217
|
var import_util12 = require("../util");
|
|
@@ -5294,7 +5385,7 @@ var PerfettoReporter = class {
|
|
|
5294
5385
|
return (0, import_util12.stripAnsiEscapes)(formatError(nonTerminalScreen, error).message);
|
|
5295
5386
|
}
|
|
5296
5387
|
_relativePath(file) {
|
|
5297
|
-
return toPosixPath4(
|
|
5388
|
+
return toPosixPath4(import_path14.default.relative(this._config.rootDir, file));
|
|
5298
5389
|
}
|
|
5299
5390
|
async _writeReport(result) {
|
|
5300
5391
|
let timeOrigin2 = result.startTime.getTime();
|
|
@@ -5320,7 +5411,7 @@ var PerfettoReporter = class {
|
|
|
5320
5411
|
"duration": result.duration,
|
|
5321
5412
|
"status": result.status
|
|
5322
5413
|
};
|
|
5323
|
-
await
|
|
5414
|
+
await import_fs10.default.promises.mkdir(import_path14.default.dirname(this._resolvedOutputFile), { recursive: true });
|
|
5324
5415
|
const writer = new ChunkWriter(this._resolvedOutputFile);
|
|
5325
5416
|
await writer.write('{"traceEvents":[');
|
|
5326
5417
|
let separator2 = "";
|
|
@@ -5336,7 +5427,7 @@ var PerfettoReporter = class {
|
|
|
5336
5427
|
};
|
|
5337
5428
|
var ChunkWriter = class {
|
|
5338
5429
|
constructor(file) {
|
|
5339
|
-
const fileStream =
|
|
5430
|
+
const fileStream = import_fs10.default.createWriteStream(file);
|
|
5340
5431
|
const gzip = file.endsWith(".gz") ? import_zlib.default.createGzip() : void 0;
|
|
5341
5432
|
gzip?.pipe(fileStream);
|
|
5342
5433
|
this._stream = gzip ?? fileStream;
|
|
@@ -5383,6 +5474,7 @@ async function createReporters(config2, mode, descriptions, runOptions) {
|
|
|
5383
5474
|
"blob": BlobReporter,
|
|
5384
5475
|
"perfetto": perfetto_default,
|
|
5385
5476
|
"dot": mode === "list" ? listModeReporter_default : dot_default,
|
|
5477
|
+
"failures": mode === "list" ? listModeReporter_default : failures_default,
|
|
5386
5478
|
"line": mode === "list" ? listModeReporter_default : line_default,
|
|
5387
5479
|
"list": mode === "list" ? listModeReporter_default : list_default,
|
|
5388
5480
|
"github": github_default,
|
|
@@ -5398,6 +5490,8 @@ async function createReporters(config2, mode, descriptions, runOptions) {
|
|
|
5398
5490
|
for (const r of descriptions) {
|
|
5399
5491
|
const [name, arg] = r;
|
|
5400
5492
|
const options = { ...reportOptions, ...arg };
|
|
5493
|
+
if (mode === "list")
|
|
5494
|
+
options.onlyFailures = false;
|
|
5401
5495
|
if (name in defaultReporters) {
|
|
5402
5496
|
reporters.push(new defaultReporters[name](options));
|
|
5403
5497
|
} else {
|
|
@@ -5457,27 +5551,30 @@ function computeCommandHash(config2, runOptions) {
|
|
|
5457
5551
|
if (config2.config.tags.length)
|
|
5458
5552
|
command.tags = config2.config.tags.join(" ");
|
|
5459
5553
|
if (runOptions?.testList)
|
|
5460
|
-
command.testList = calculateSha14(
|
|
5554
|
+
command.testList = calculateSha14(import_fs11.default.readFileSync(runOptions.testList));
|
|
5461
5555
|
if (runOptions?.testListInvert)
|
|
5462
|
-
command.testListInvert = calculateSha14(
|
|
5556
|
+
command.testListInvert = calculateSha14(import_fs11.default.readFileSync(runOptions.testListInvert));
|
|
5463
5557
|
if (Object.keys(command).length)
|
|
5464
5558
|
parts.push(calculateSha14(JSON.stringify(command)).substring(0, 7));
|
|
5465
5559
|
return parts.join("-");
|
|
5466
5560
|
}
|
|
5467
5561
|
|
|
5468
5562
|
// packages/playwright/src/runner/tasks.ts
|
|
5469
|
-
var
|
|
5470
|
-
var
|
|
5563
|
+
var import_fs14 = __toESM(require("fs"));
|
|
5564
|
+
var import_path18 = __toESM(require("path"));
|
|
5471
5565
|
var import_util15 = require("util");
|
|
5472
5566
|
|
|
5567
|
+
// packages/playwright/src/runner/dispatcher.ts
|
|
5568
|
+
var import_buffer = require("buffer");
|
|
5569
|
+
|
|
5473
5570
|
// packages/playwright/src/runner/rebase.ts
|
|
5474
|
-
var
|
|
5475
|
-
var
|
|
5476
|
-
var
|
|
5571
|
+
var import_fs12 = __toESM(require("fs"));
|
|
5572
|
+
var import_path15 = __toESM(require("path"));
|
|
5573
|
+
var babel = __toESM(require("../transform/babelBundle"));
|
|
5477
5574
|
var colors3 = require("patchwright-core/lib/utilsBundle").colors;
|
|
5478
5575
|
var diff = require("patchwright-core/lib/utilsBundle").diff;
|
|
5479
5576
|
var { MultiMap: MultiMap3 } = require("patchwright-core/lib/coreBundle").iso;
|
|
5480
|
-
var t =
|
|
5577
|
+
var t = babel.types;
|
|
5481
5578
|
var suggestedRebaselines = new MultiMap3();
|
|
5482
5579
|
function addSuggestedRebaseline(location, suggestedRebaseline) {
|
|
5483
5580
|
suggestedRebaselines.set(location.file, { location, code: suggestedRebaseline });
|
|
@@ -5496,16 +5593,16 @@ async function applySuggestedRebaselines(config2, reporter, filteredProjects) {
|
|
|
5496
5593
|
const patches = [];
|
|
5497
5594
|
const files = [];
|
|
5498
5595
|
const gitCache = /* @__PURE__ */ new Map();
|
|
5499
|
-
const patchFile =
|
|
5596
|
+
const patchFile = import_path15.default.join(project.project.outputDir, "rebaselines.patch");
|
|
5500
5597
|
for (const fileName of [...suggestedRebaselines.keys()].sort()) {
|
|
5501
|
-
const source = await
|
|
5598
|
+
const source = await import_fs12.default.promises.readFile(fileName, "utf8");
|
|
5502
5599
|
const lines = source.split("\n");
|
|
5503
5600
|
const replacements = suggestedRebaselines.get(fileName);
|
|
5504
|
-
const fileNode =
|
|
5601
|
+
const fileNode = babel.babelParse(source, fileName, true);
|
|
5505
5602
|
const ranges = [];
|
|
5506
|
-
|
|
5507
|
-
CallExpression: (
|
|
5508
|
-
const node =
|
|
5603
|
+
babel.traverse(fileNode, {
|
|
5604
|
+
CallExpression: (path22) => {
|
|
5605
|
+
const node = path22.node;
|
|
5509
5606
|
if (node.arguments.length < 1)
|
|
5510
5607
|
return;
|
|
5511
5608
|
if (!t.isMemberExpression(node.callee))
|
|
@@ -5532,15 +5629,15 @@ async function applySuggestedRebaselines(config2, reporter, filteredProjects) {
|
|
|
5532
5629
|
let result = source;
|
|
5533
5630
|
for (const range of ranges)
|
|
5534
5631
|
result = result.substring(0, range.start) + range.newText + result.substring(range.end);
|
|
5535
|
-
const relativeName =
|
|
5632
|
+
const relativeName = import_path15.default.relative(process.cwd(), fileName);
|
|
5536
5633
|
files.push(relativeName);
|
|
5537
5634
|
if (config2.config.updateSourceMethod === "overwrite") {
|
|
5538
|
-
await
|
|
5635
|
+
await import_fs12.default.promises.writeFile(fileName, result);
|
|
5539
5636
|
} else if (config2.config.updateSourceMethod === "3way") {
|
|
5540
|
-
await
|
|
5637
|
+
await import_fs12.default.promises.writeFile(fileName, applyPatchWithConflictMarkers(source, result));
|
|
5541
5638
|
} else {
|
|
5542
|
-
const gitFolder = findGitRoot(
|
|
5543
|
-
const relativeToGit =
|
|
5639
|
+
const gitFolder = findGitRoot(import_path15.default.dirname(fileName), gitCache);
|
|
5640
|
+
const relativeToGit = import_path15.default.relative(gitFolder || process.cwd(), fileName);
|
|
5544
5641
|
patches.push(createPatch(relativeToGit, source, result));
|
|
5545
5642
|
}
|
|
5546
5643
|
}
|
|
@@ -5551,10 +5648,10 @@ New baselines created for:
|
|
|
5551
5648
|
${fileList}
|
|
5552
5649
|
`);
|
|
5553
5650
|
if (config2.config.updateSourceMethod === "patch") {
|
|
5554
|
-
await
|
|
5555
|
-
await
|
|
5651
|
+
await import_fs12.default.promises.mkdir(import_path15.default.dirname(patchFile), { recursive: true });
|
|
5652
|
+
await import_fs12.default.promises.writeFile(patchFile, patches.join("\n"));
|
|
5556
5653
|
reporter.onStdErr(`
|
|
5557
|
-
` + colors3.cyan("git apply " +
|
|
5654
|
+
` + colors3.cyan("git apply " + import_path15.default.relative(process.cwd(), patchFile)) + "\n");
|
|
5558
5655
|
}
|
|
5559
5656
|
}
|
|
5560
5657
|
function createPatch(fileName, before, after) {
|
|
@@ -5571,12 +5668,12 @@ function findGitRoot(dir, cache) {
|
|
|
5571
5668
|
const result = cache.get(dir);
|
|
5572
5669
|
if (result !== void 0)
|
|
5573
5670
|
return result;
|
|
5574
|
-
const gitPath =
|
|
5575
|
-
if (
|
|
5671
|
+
const gitPath = import_path15.default.join(dir, ".git");
|
|
5672
|
+
if (import_fs12.default.existsSync(gitPath) && import_fs12.default.lstatSync(gitPath).isDirectory()) {
|
|
5576
5673
|
cache.set(dir, dir);
|
|
5577
5674
|
return dir;
|
|
5578
5675
|
}
|
|
5579
|
-
const parentDir =
|
|
5676
|
+
const parentDir = import_path15.default.dirname(dir);
|
|
5580
5677
|
if (dir === parentDir) {
|
|
5581
5678
|
cache.set(dir, null);
|
|
5582
5679
|
return null;
|
|
@@ -5620,8 +5717,8 @@ function applyPatchWithConflictMarkers(oldText, newText) {
|
|
|
5620
5717
|
}
|
|
5621
5718
|
|
|
5622
5719
|
// packages/playwright/src/runner/workerHost.ts
|
|
5623
|
-
var
|
|
5624
|
-
var
|
|
5720
|
+
var import_fs13 = __toESM(require("fs"));
|
|
5721
|
+
var import_path16 = __toESM(require("path"));
|
|
5625
5722
|
var import_common6 = require("../common");
|
|
5626
5723
|
|
|
5627
5724
|
// packages/playwright/src/isomorphic/folders.ts
|
|
@@ -5650,13 +5747,13 @@ var WorkerHost = class extends ProcessHost {
|
|
|
5650
5747
|
repeatEachIndex: testGroup.repeatEachIndex,
|
|
5651
5748
|
projectId: testGroup.projectId,
|
|
5652
5749
|
config: options.config,
|
|
5653
|
-
artifactsDir:
|
|
5750
|
+
artifactsDir: import_path16.default.join(options.outputDir, artifactsFolderName(workerIndex)),
|
|
5654
5751
|
pauseOnError: options.pauseOnError,
|
|
5655
5752
|
pauseAtEnd: options.pauseAtEnd
|
|
5656
5753
|
};
|
|
5657
5754
|
}
|
|
5658
5755
|
async start() {
|
|
5659
|
-
await
|
|
5756
|
+
await import_fs13.default.promises.mkdir(this._params.artifactsDir, { recursive: true });
|
|
5660
5757
|
return await this.startRunner(this._params, {
|
|
5661
5758
|
onStdOut: (chunk) => this.emit("stdOut", import_common6.ipc.stdioChunkToParams(chunk)),
|
|
5662
5759
|
onStdErr: (chunk) => this.emit("stdErr", import_common6.ipc.stdioChunkToParams(chunk))
|
|
@@ -5676,9 +5773,6 @@ var WorkerHost = class extends ProcessHost {
|
|
|
5676
5773
|
async sendCustomMessage(payload) {
|
|
5677
5774
|
return await this.sendMessage({ method: "customMessage", params: payload });
|
|
5678
5775
|
}
|
|
5679
|
-
sendResume(payload) {
|
|
5680
|
-
this.sendMessageNoReply({ method: "resume", params: payload });
|
|
5681
|
-
}
|
|
5682
5776
|
hash() {
|
|
5683
5777
|
return this._hash;
|
|
5684
5778
|
}
|
|
@@ -5696,12 +5790,12 @@ var import_util13 = require("../util");
|
|
|
5696
5790
|
var colors4 = require("patchwright-core/lib/utilsBundle").colors;
|
|
5697
5791
|
var { ManualPromise: ManualPromise3 } = require("patchwright-core/lib/coreBundle").iso;
|
|
5698
5792
|
var { eventsHelper } = require("patchwright-core/lib/coreBundle").utils;
|
|
5793
|
+
var exclusiveLock = "-exclusive-";
|
|
5699
5794
|
var Dispatcher = class {
|
|
5700
5795
|
constructor(testRun, options = {}) {
|
|
5701
5796
|
// Worker slot is claimed when it has jobDispatcher assigned.
|
|
5702
5797
|
this._workerSlots = [];
|
|
5703
5798
|
this._queue = [];
|
|
5704
|
-
this._isolatedJobs = /* @__PURE__ */ new Set();
|
|
5705
5799
|
this._workerLimitPerProjectId = /* @__PURE__ */ new Map();
|
|
5706
5800
|
this._queuedOrRunningHashCount = /* @__PURE__ */ new Map();
|
|
5707
5801
|
this._finished = new ManualPromise3();
|
|
@@ -5725,9 +5819,12 @@ var Dispatcher = class {
|
|
|
5725
5819
|
}
|
|
5726
5820
|
_findFirstJobToRun() {
|
|
5727
5821
|
const heldLocks = this._heldLocks();
|
|
5822
|
+
if (heldLocks.has(exclusiveLock))
|
|
5823
|
+
return -1;
|
|
5824
|
+
const hasRunningJobs = this._workerSlots.some((w) => !!w.jobDispatcher);
|
|
5728
5825
|
for (let index = 0; index < this._queue.length; index++) {
|
|
5729
5826
|
const job = this._queue[index];
|
|
5730
|
-
if (
|
|
5827
|
+
if (hasRunningJobs && job.locks.includes(exclusiveLock))
|
|
5731
5828
|
continue;
|
|
5732
5829
|
if (job.locks.some((lock) => heldLocks.has(lock)))
|
|
5733
5830
|
continue;
|
|
@@ -5807,7 +5904,6 @@ var Dispatcher = class {
|
|
|
5807
5904
|
this._updateCounterForWorkerHash(result.remainingJob.workerHash, 1);
|
|
5808
5905
|
}
|
|
5809
5906
|
if (result.isolatedRetriesJob) {
|
|
5810
|
-
this._isolatedJobs.add(result.isolatedRetriesJob);
|
|
5811
5907
|
this._queue.push(result.isolatedRetriesJob);
|
|
5812
5908
|
this._updateCounterForWorkerHash(result.isolatedRetriesJob.workerHash, 1);
|
|
5813
5909
|
}
|
|
@@ -5962,8 +6058,8 @@ var JobDispatcher = class {
|
|
|
5962
6058
|
test.annotations = [...params.annotations];
|
|
5963
6059
|
test.expectedStatus = params.expectedStatus;
|
|
5964
6060
|
test.timeout = params.timeout;
|
|
5965
|
-
const
|
|
5966
|
-
if (
|
|
6061
|
+
const isFailure2 = result.status !== "skipped" && result.status !== test.expectedStatus;
|
|
6062
|
+
if (isFailure2)
|
|
5967
6063
|
this._failedTests.add(test);
|
|
5968
6064
|
if (params.hasNonRetriableError)
|
|
5969
6065
|
this._addNonretriableTestAndSerialModeParents(test);
|
|
@@ -6133,7 +6229,7 @@ var JobDispatcher = class {
|
|
|
6133
6229
|
}
|
|
6134
6230
|
}
|
|
6135
6231
|
const remainingJob = remaining.length ? { ...this.job, tests: remaining } : void 0;
|
|
6136
|
-
const isolatedRetriesJob = isolatedRetries.length ? { ...this.job, tests: isolatedRetries } : void 0;
|
|
6232
|
+
const isolatedRetriesJob = isolatedRetries.length ? { ...this.job, tests: isolatedRetries, locks: [.../* @__PURE__ */ new Set([...this.job.locks, exclusiveLock])] } : void 0;
|
|
6137
6233
|
this._finished({ didFail: true, remainingJob, isolatedRetriesJob });
|
|
6138
6234
|
}
|
|
6139
6235
|
onExit(data) {
|
|
@@ -6171,7 +6267,7 @@ var JobDispatcher = class {
|
|
|
6171
6267
|
const data = this._dataByTestId.get(params.testId);
|
|
6172
6268
|
if (!data)
|
|
6173
6269
|
return;
|
|
6174
|
-
const {
|
|
6270
|
+
const { test } = data;
|
|
6175
6271
|
const sendMessage = async (message) => {
|
|
6176
6272
|
try {
|
|
6177
6273
|
if (this.jobResult.isDone())
|
|
@@ -6186,13 +6282,9 @@ var JobDispatcher = class {
|
|
|
6186
6282
|
return { response: void 0, error };
|
|
6187
6283
|
}
|
|
6188
6284
|
};
|
|
6189
|
-
|
|
6190
|
-
|
|
6191
|
-
|
|
6192
|
-
void this._testRun.reporter.onTestPaused?.(test, result).then(() => {
|
|
6193
|
-
worker.sendResume({});
|
|
6194
|
-
});
|
|
6195
|
-
this._testRun.onTestPaused({ ...params, sendMessage });
|
|
6285
|
+
for (const error of params.errors)
|
|
6286
|
+
addLocationAndSnippetToError(this._testRun.config.config, error, test.location.file);
|
|
6287
|
+
this._testRun.onTestPaused({ errors: params.errors, sendMessage });
|
|
6196
6288
|
}
|
|
6197
6289
|
skipWholeJob() {
|
|
6198
6290
|
const allTestsSkipped = this.job.tests.every((test) => test.expectedStatus === "skipped");
|
|
@@ -6225,7 +6317,8 @@ var JobDispatcher = class {
|
|
|
6225
6317
|
function chunkFromParams(params) {
|
|
6226
6318
|
if (typeof params.text === "string")
|
|
6227
6319
|
return params.text;
|
|
6228
|
-
|
|
6320
|
+
const buffer = Buffer.from(params.buffer, "base64");
|
|
6321
|
+
return (0, import_buffer.isUtf8)(buffer) ? buffer.toString("utf8") : buffer;
|
|
6229
6322
|
}
|
|
6230
6323
|
|
|
6231
6324
|
// packages/playwright/src/runner/sigIntWatcher.ts
|
|
@@ -6403,16 +6496,16 @@ var TimeoutWatcher = class {
|
|
|
6403
6496
|
|
|
6404
6497
|
// packages/playwright/src/runner/vcs.ts
|
|
6405
6498
|
var import_child_process2 = __toESM(require("child_process"));
|
|
6406
|
-
var
|
|
6499
|
+
var import_path17 = __toESM(require("path"));
|
|
6407
6500
|
var import_common8 = require("../common");
|
|
6408
6501
|
async function detectChangedTestFiles(baseCommit, configDir) {
|
|
6409
|
-
function gitFileList(args) {
|
|
6502
|
+
function gitFileList(args, separator2 = "\n") {
|
|
6410
6503
|
try {
|
|
6411
6504
|
return import_child_process2.default.execFileSync(
|
|
6412
6505
|
"git",
|
|
6413
6506
|
args,
|
|
6414
6507
|
{ encoding: "utf-8", stdio: "pipe", cwd: configDir }
|
|
6415
|
-
).split(
|
|
6508
|
+
).split(separator2).filter(Boolean);
|
|
6416
6509
|
} catch (_error) {
|
|
6417
6510
|
const error = _error;
|
|
6418
6511
|
const unknownRevision = error.output.some((line) => line?.includes("unknown revision"));
|
|
@@ -6433,9 +6526,9 @@ async function detectChangedTestFiles(baseCommit, configDir) {
|
|
|
6433
6526
|
].join("\n"));
|
|
6434
6527
|
}
|
|
6435
6528
|
}
|
|
6436
|
-
const untrackedFiles = gitFileList(["ls-files", "--others", "--exclude-standard"]).map((file) =>
|
|
6529
|
+
const untrackedFiles = gitFileList(["ls-files", "--others", "--exclude-standard", "-z"], "\0").map((file) => import_path17.default.join(configDir, file));
|
|
6437
6530
|
const [gitRoot] = gitFileList(["rev-parse", "--show-toplevel"]);
|
|
6438
|
-
const trackedFilesWithChanges = gitFileList(["diff", baseCommit, "--name-only"]).map((file) =>
|
|
6531
|
+
const trackedFilesWithChanges = gitFileList(["diff", baseCommit, "--name-only", "-z"], "\0").map((file) => import_path17.default.join(gitRoot, file));
|
|
6439
6532
|
return new Set(import_common8.cc.affectedTestFiles([...untrackedFiles, ...trackedFilesWithChanges]));
|
|
6440
6533
|
}
|
|
6441
6534
|
|
|
@@ -6446,7 +6539,7 @@ var debug5 = require("patchwright-core/lib/utilsBundle").debug;
|
|
|
6446
6539
|
var { ManualPromise: ManualPromise5 } = require("patchwright-core/lib/coreBundle").iso;
|
|
6447
6540
|
var { monotonicTime: monotonicTime5 } = require("patchwright-core/lib/coreBundle").iso;
|
|
6448
6541
|
var { removeFolders: removeFolders4 } = require("patchwright-core/lib/coreBundle").utils;
|
|
6449
|
-
var readDirAsync2 = (0, import_util15.promisify)(
|
|
6542
|
+
var readDirAsync2 = (0, import_util15.promisify)(import_fs14.default.readdir);
|
|
6450
6543
|
var TestRun = class {
|
|
6451
6544
|
constructor(config2, reporter, options) {
|
|
6452
6545
|
this.rootSuite = void 0;
|
|
@@ -6456,6 +6549,7 @@ var TestRun = class {
|
|
|
6456
6549
|
this.topLevelProjects = [];
|
|
6457
6550
|
this.hasWorkerErrors = false;
|
|
6458
6551
|
this.failedTestCount = 0;
|
|
6552
|
+
this.testCountBeforeSharding = 0;
|
|
6459
6553
|
this.loadFileFilters = [];
|
|
6460
6554
|
this.preOnlyTestFilters = [];
|
|
6461
6555
|
this.postShardTestFilters = [];
|
|
@@ -6596,7 +6690,7 @@ function createRemoveOutputDirsTask() {
|
|
|
6596
6690
|
return;
|
|
6597
6691
|
if (error.code === "EBUSY") {
|
|
6598
6692
|
const entries = await readDirAsync2(outputDir).catch((e) => []);
|
|
6599
|
-
await Promise.all(entries.map((entry) => removeFolders4([
|
|
6693
|
+
await Promise.all(entries.map((entry) => removeFolders4([import_path18.default.join(outputDir, entry)])));
|
|
6600
6694
|
} else {
|
|
6601
6695
|
throw error;
|
|
6602
6696
|
}
|
|
@@ -6615,7 +6709,7 @@ function createListFilesTask() {
|
|
|
6615
6709
|
projectSuite._fullProject = project;
|
|
6616
6710
|
testRun.rootSuite._addSuite(projectSuite);
|
|
6617
6711
|
const suites = files.map((file) => {
|
|
6618
|
-
const title =
|
|
6712
|
+
const title = import_path18.default.relative(testRun.config.config.rootDir, file);
|
|
6619
6713
|
const suite = new import_common9.test.Suite(title, "file");
|
|
6620
6714
|
suite.location = { file, line: 0, column: 0 };
|
|
6621
6715
|
projectSuite._addSuite(suite);
|
|
@@ -6663,7 +6757,8 @@ function createLoadTask(mode, options) {
|
|
|
6663
6757
|
testRun.preOnlyTestFilters.push((test) => changedFiles.has(test.location.file));
|
|
6664
6758
|
}
|
|
6665
6759
|
await createRootSuite(testRun, options.failOnLoadErrors ? errors : softErrors, !!options.filterOnly);
|
|
6666
|
-
|
|
6760
|
+
const testCount = testRun.config.config.shard ? testRun.testCountBeforeSharding : testRun.rootSuite?.allTests().length;
|
|
6761
|
+
if (options.failOnLoadErrors && !testCount && !testRun.options.passWithNoTests && !testRun.options.onlyChanged && !testRun.options.testList && !testRun.options.testListInvert) {
|
|
6667
6762
|
if (testRun.options.locations?.length) {
|
|
6668
6763
|
throw new Error([
|
|
6669
6764
|
`No tests found.`,
|
|
@@ -6785,8 +6880,8 @@ function createRunTestsTask() {
|
|
|
6785
6880
|
}
|
|
6786
6881
|
|
|
6787
6882
|
// packages/playwright/src/runner/lastRun.ts
|
|
6788
|
-
var
|
|
6789
|
-
var
|
|
6883
|
+
var import_fs15 = __toESM(require("fs"));
|
|
6884
|
+
var import_path19 = __toESM(require("path"));
|
|
6790
6885
|
function didNotRun(test) {
|
|
6791
6886
|
if (test.outcome() !== "skipped")
|
|
6792
6887
|
return false;
|
|
@@ -6799,18 +6894,18 @@ var LastRunReporter = class {
|
|
|
6799
6894
|
this._listMode = !!listMode;
|
|
6800
6895
|
const override = lastFailedFileOverride ?? process.env.PLAYWRIGHT_LAST_RUN_OUTPUT_FILE;
|
|
6801
6896
|
if (override) {
|
|
6802
|
-
this._lastRunFile =
|
|
6897
|
+
this._lastRunFile = import_path19.default.resolve(process.cwd(), override);
|
|
6803
6898
|
} else {
|
|
6804
6899
|
const [project] = filteredProjects;
|
|
6805
6900
|
if (project)
|
|
6806
|
-
this._lastRunFile =
|
|
6901
|
+
this._lastRunFile = import_path19.default.join(project.project.outputDir, ".last-run.json");
|
|
6807
6902
|
}
|
|
6808
6903
|
}
|
|
6809
6904
|
async filterLastFailed() {
|
|
6810
6905
|
if (!this._lastRunFile)
|
|
6811
6906
|
return void 0;
|
|
6812
6907
|
try {
|
|
6813
|
-
const lastRunInfo = JSON.parse(await
|
|
6908
|
+
const lastRunInfo = JSON.parse(await import_fs15.default.promises.readFile(this._lastRunFile, "utf8"));
|
|
6814
6909
|
return lastRunInfo.failedTests;
|
|
6815
6910
|
} catch {
|
|
6816
6911
|
return void 0;
|
|
@@ -6832,8 +6927,8 @@ var LastRunReporter = class {
|
|
|
6832
6927
|
status: result.status,
|
|
6833
6928
|
failedTests: this._suite?.allTests().filter((t2) => !t2.ok() || didNotRun(t2)).map((t2) => t2.id) || []
|
|
6834
6929
|
};
|
|
6835
|
-
await
|
|
6836
|
-
await
|
|
6930
|
+
await import_fs15.default.promises.mkdir(import_path19.default.dirname(this._lastRunFile), { recursive: true });
|
|
6931
|
+
await import_fs15.default.promises.writeFile(this._lastRunFile, JSON.stringify(lastRunInfo, void 0, 2));
|
|
6837
6932
|
}
|
|
6838
6933
|
};
|
|
6839
6934
|
|
|
@@ -6856,9 +6951,9 @@ var TestRunner = class extends import_events3.default {
|
|
|
6856
6951
|
this._startingEnv = {};
|
|
6857
6952
|
this.configLocation = configLocation;
|
|
6858
6953
|
this._configCLIOverrides = configCLIOverrides;
|
|
6859
|
-
this._watcher = new FSWatcher((
|
|
6954
|
+
this._watcher = new FSWatcher((files) => {
|
|
6860
6955
|
const collector = /* @__PURE__ */ new Set();
|
|
6861
|
-
|
|
6956
|
+
files.forEach((file) => import_common10.cc.collectAffectedTestFiles(file, collector));
|
|
6862
6957
|
this.emit(TestRunnerEvent.TestFilesChanged, [...collector]);
|
|
6863
6958
|
});
|
|
6864
6959
|
}
|
|
@@ -6989,7 +7084,10 @@ var TestRunner = class extends import_events3.default {
|
|
|
6989
7084
|
await this._updateWatcher(false);
|
|
6990
7085
|
}
|
|
6991
7086
|
async _updateWatcher(reportPending) {
|
|
6992
|
-
await this._watcher.update(
|
|
7087
|
+
await this._watcher.update({
|
|
7088
|
+
paths: [...this._watchedProjectDirs, ...this._watchedTestDependencies],
|
|
7089
|
+
ignoredFolders: [...this._ignoredProjectOutputs]
|
|
7090
|
+
}, reportPending);
|
|
6993
7091
|
}
|
|
6994
7092
|
async runTests(userReporter, params) {
|
|
6995
7093
|
let result = { status: "passed" };
|
|
@@ -7146,7 +7244,7 @@ async function runAllTestsWithConfig(config2, options) {
|
|
|
7146
7244
|
createLoadTask("in-process", { filterOnly: true, failOnLoadErrors: true }),
|
|
7147
7245
|
...createRunTestsTasks(config2)
|
|
7148
7246
|
];
|
|
7149
|
-
const testRun = new TestRun(config2, reporter,
|
|
7247
|
+
const testRun = new TestRun(config2, reporter, options);
|
|
7150
7248
|
const status = await runTasks(testRun, tasks, config2.config.globalTimeout);
|
|
7151
7249
|
await new Promise((resolve) => process.stdout.write("", () => resolve()));
|
|
7152
7250
|
await new Promise((resolve) => process.stderr.write("", () => resolve()));
|
|
@@ -7346,12 +7444,13 @@ var TestServerDispatcher = class {
|
|
|
7346
7444
|
async function runUIMode(configFile, configCLIOverrides, options) {
|
|
7347
7445
|
const configLocation = import_common11.configLoader.resolveConfigLocation(configFile);
|
|
7348
7446
|
return await innerRunTestServer(configLocation, configCLIOverrides, options, async (server, cancelPromise) => {
|
|
7349
|
-
|
|
7447
|
+
const uiModePath = import_coreBundle4.server.traceViewerPath(void 0, { ...options, webApp: "uiMode.html" });
|
|
7350
7448
|
if (options.host !== void 0 || options.port !== void 0) {
|
|
7351
|
-
|
|
7449
|
+
server.installRootRedirect(uiModePath);
|
|
7450
|
+
await import_coreBundle4.server.openTraceInBrowser(server.rootUrl("human-readable"));
|
|
7352
7451
|
} else {
|
|
7353
7452
|
const channel = await installedChromiumChannelForUI(configLocation, configCLIOverrides);
|
|
7354
|
-
const page = await import_coreBundle4.server.openTraceViewerApp(server.urlPrefix("precise"), "chromium", {
|
|
7453
|
+
const page = await import_coreBundle4.server.openTraceViewerApp(server.urlPrefix("precise") + uiModePath, "chromium", {
|
|
7355
7454
|
headless: isUnderTest() && process.env.PWTEST_HEADED_FOR_TEST !== "1",
|
|
7356
7455
|
persistentContextOptions: {
|
|
7357
7456
|
handleSIGINT: false,
|
|
@@ -7377,7 +7476,7 @@ async function installedChromiumChannelForUI(configLocation, configCLIOverrides)
|
|
|
7377
7476
|
async function runTestServer(configFile, configCLIOverrides, options) {
|
|
7378
7477
|
const configLocation = import_common11.configLoader.resolveConfigLocation(configFile);
|
|
7379
7478
|
return await innerRunTestServer(configLocation, configCLIOverrides, options, async (server) => {
|
|
7380
|
-
console.log("Listening on " + server.urlPrefix("precise").replace("http:", "ws:") + "/"
|
|
7479
|
+
console.log("Listening on " + server.urlPrefix("precise").replace("http:", "ws:") + "/ws");
|
|
7381
7480
|
});
|
|
7382
7481
|
}
|
|
7383
7482
|
async function innerRunTestServer(configLocation, configCLIOverrides, options, openUI) {
|
|
@@ -7413,7 +7512,7 @@ var watchMode_exports = {};
|
|
|
7413
7512
|
__export(watchMode_exports, {
|
|
7414
7513
|
runWatchModeLoop: () => runWatchModeLoop
|
|
7415
7514
|
});
|
|
7416
|
-
var
|
|
7515
|
+
var import_path20 = __toESM(require("path"));
|
|
7417
7516
|
var import_readline = __toESM(require("readline"));
|
|
7418
7517
|
var import_events4 = require("events");
|
|
7419
7518
|
var import_coreBundle5 = require("patchwright-core/lib/coreBundle");
|
|
@@ -7805,7 +7904,7 @@ async function runWatchModeLoop(configLocation, initialOptions) {
|
|
|
7805
7904
|
};
|
|
7806
7905
|
const testServerConnection = new TestServerConnection(transport);
|
|
7807
7906
|
transport.emit("open");
|
|
7808
|
-
const teleSuiteUpdater = new TeleSuiteUpdater({ pathSeparator:
|
|
7907
|
+
const teleSuiteUpdater = new TeleSuiteUpdater({ pathSeparator: import_path20.default.sep, onUpdate() {
|
|
7809
7908
|
} });
|
|
7810
7909
|
const dirtyTestFiles = /* @__PURE__ */ new Set();
|
|
7811
7910
|
const dirtyTestIds = /* @__PURE__ */ new Set();
|
|
@@ -8081,7 +8180,7 @@ function printBufferPrompt(dirtyTestFiles, rootDir) {
|
|
|
8081
8180
|
|
|
8082
8181
|
`);
|
|
8083
8182
|
for (const file of dirtyTestFiles)
|
|
8084
|
-
process.stdout.write(` \xB7 ${
|
|
8183
|
+
process.stdout.write(` \xB7 ${import_path20.default.relative(rootDir, file)}
|
|
8085
8184
|
`);
|
|
8086
8185
|
process.stdout.write(`
|
|
8087
8186
|
${colors6.dim(`Press`)} ${colors6.bold("enter")} ${colors6.dim("to run")}, ${colors6.bold("q")} ${colors6.dim("to quit or")} ${colors6.bold("h")} ${colors6.dim("for more options.")}
|
|
@@ -8115,8 +8214,8 @@ var merge_exports = {};
|
|
|
8115
8214
|
__export(merge_exports, {
|
|
8116
8215
|
createMergedReport: () => createMergedReport
|
|
8117
8216
|
});
|
|
8118
|
-
var
|
|
8119
|
-
var
|
|
8217
|
+
var import_fs16 = __toESM(require("fs"));
|
|
8218
|
+
var import_path21 = __toESM(require("path"));
|
|
8120
8219
|
|
|
8121
8220
|
// packages/playwright/src/isomorphic/stringInternPool.ts
|
|
8122
8221
|
var StringInternPool = class {
|
|
@@ -8178,8 +8277,8 @@ async function createMergedReport(config2, dir, reporterDescriptions, rootDirOve
|
|
|
8178
8277
|
if (shardFiles.length === 0)
|
|
8179
8278
|
throw new Error(`No report files found in ${dir}`);
|
|
8180
8279
|
const eventData = await mergeEvents(dir, shardFiles, stringPool, printStatus, rootDirOverride);
|
|
8181
|
-
const pathSeparator = rootDirOverride ?
|
|
8182
|
-
const pathPackage = pathSeparator === "/" ?
|
|
8280
|
+
const pathSeparator = rootDirOverride ? import_path21.default.sep : eventData.pathSeparatorFromMetadata ?? import_path21.default.sep;
|
|
8281
|
+
const pathPackage = pathSeparator === "/" ? import_path21.default.posix : import_path21.default.win32;
|
|
8183
8282
|
const receiver = new TeleReporterReceiver(multiplexer, {
|
|
8184
8283
|
mergeProjects: false,
|
|
8185
8284
|
mergeTestCases: false,
|
|
@@ -8207,7 +8306,7 @@ async function createMergedReport(config2, dir, reporterDescriptions, rootDirOve
|
|
|
8207
8306
|
reportPath: zipFile,
|
|
8208
8307
|
config: asFullConfig(config3)
|
|
8209
8308
|
});
|
|
8210
|
-
const reportJsonl = await
|
|
8309
|
+
const reportJsonl = await import_fs16.default.promises.readFile(reportFile);
|
|
8211
8310
|
const events = parseTestEvents(reportJsonl);
|
|
8212
8311
|
new JsonStringInternalizer(stringPool).traverse(events);
|
|
8213
8312
|
eventPatchers.patchers.push(new AttachmentPathPatcher(dir));
|
|
@@ -8253,15 +8352,15 @@ function splitBufferLines(buffer) {
|
|
|
8253
8352
|
}
|
|
8254
8353
|
async function extractAndParseReports(dir, shardFiles, internalizer, printStatus) {
|
|
8255
8354
|
const shardEvents = [];
|
|
8256
|
-
await
|
|
8355
|
+
await import_fs16.default.promises.mkdir(import_path21.default.join(dir, "resources"), { recursive: true });
|
|
8257
8356
|
const reportNames = new UniqueFileNameGenerator();
|
|
8258
8357
|
for (const file of shardFiles) {
|
|
8259
|
-
const absolutePath =
|
|
8358
|
+
const absolutePath = import_path21.default.join(dir, file);
|
|
8260
8359
|
printStatus(`extracting: ${(0, import_util19.relativeFilePath)(absolutePath)}`);
|
|
8261
8360
|
const zipFile = new ZipFile2(absolutePath);
|
|
8262
8361
|
const entryNames = await zipFile.entries();
|
|
8263
8362
|
for (const entryName of entryNames.sort()) {
|
|
8264
|
-
let reportFile =
|
|
8363
|
+
let reportFile = import_path21.default.join(dir, entryName);
|
|
8265
8364
|
const content = await zipFile.read(entryName);
|
|
8266
8365
|
if (entryName.endsWith(".jsonl")) {
|
|
8267
8366
|
reportFile = reportNames.makeUnique(reportFile);
|
|
@@ -8276,7 +8375,7 @@ async function extractAndParseReports(dir, shardFiles, internalizer, printStatus
|
|
|
8276
8375
|
parsedEvents
|
|
8277
8376
|
});
|
|
8278
8377
|
}
|
|
8279
|
-
await
|
|
8378
|
+
await import_fs16.default.promises.writeFile(reportFile, content);
|
|
8280
8379
|
}
|
|
8281
8380
|
zipFile.close();
|
|
8282
8381
|
}
|
|
@@ -8443,7 +8542,7 @@ function mergeEndEvents(endEvents) {
|
|
|
8443
8542
|
};
|
|
8444
8543
|
}
|
|
8445
8544
|
async function sortedShardFiles(dir) {
|
|
8446
|
-
const files = await
|
|
8545
|
+
const files = await import_fs16.default.promises.readdir(dir);
|
|
8447
8546
|
return files.filter((file) => file.endsWith(".zip")).sort();
|
|
8448
8547
|
}
|
|
8449
8548
|
function printStatusToStdout(message) {
|
|
@@ -8459,7 +8558,7 @@ var UniqueFileNameGenerator = class {
|
|
|
8459
8558
|
this._usedNames.add(name);
|
|
8460
8559
|
return name;
|
|
8461
8560
|
}
|
|
8462
|
-
const extension =
|
|
8561
|
+
const extension = import_path21.default.extname(name);
|
|
8463
8562
|
name = name.substring(0, name.length - extension.length);
|
|
8464
8563
|
let index = 0;
|
|
8465
8564
|
while (true) {
|
|
@@ -8542,11 +8641,11 @@ var AttachmentPathPatcher = class {
|
|
|
8542
8641
|
this._patchAttachments(event.params.result.attachments ?? []);
|
|
8543
8642
|
}
|
|
8544
8643
|
_patchAttachments(attachments) {
|
|
8545
|
-
const resourceRoot =
|
|
8644
|
+
const resourceRoot = import_path21.default.resolve(this._resourceDir);
|
|
8546
8645
|
for (const attachment of attachments) {
|
|
8547
8646
|
if (!attachment.path)
|
|
8548
8647
|
continue;
|
|
8549
|
-
const joined =
|
|
8648
|
+
const joined = import_path21.default.resolve(resourceRoot, attachment.path);
|
|
8550
8649
|
if (!isPathInside(resourceRoot, joined)) {
|
|
8551
8650
|
attachment.path = void 0;
|
|
8552
8651
|
continue;
|
|
@@ -8557,8 +8656,8 @@ var AttachmentPathPatcher = class {
|
|
|
8557
8656
|
};
|
|
8558
8657
|
var PathSeparatorPatcher = class {
|
|
8559
8658
|
constructor(from) {
|
|
8560
|
-
this._from = from ?? (
|
|
8561
|
-
this._to =
|
|
8659
|
+
this._from = from ?? (import_path21.default.sep === "/" ? "\\" : "/");
|
|
8660
|
+
this._to = import_path21.default.sep;
|
|
8562
8661
|
}
|
|
8563
8662
|
patchEvent(jsonEvent) {
|
|
8564
8663
|
if (this._from === this._to)
|