@smoothdeploy/playwright 1.58.3 → 1.60.0-beta-1780662356000

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (182) hide show
  1. package/ThirdPartyNotices.txt +8 -5036
  2. package/lib/agents/agentParser.js +2 -2
  3. package/lib/agents/generateAgents.js +21 -22
  4. package/lib/agents/playwright-test-healer.agent.md +1 -0
  5. package/lib/agents/playwright-test-planner.agent.md +2 -1
  6. package/lib/cli/reportActions.js +78 -0
  7. package/lib/cli/testActions.js +211 -0
  8. package/lib/common/index.js +2898 -0
  9. package/lib/common/index.js.txt +35 -0
  10. package/lib/errorContext.js +130 -0
  11. package/lib/index.js +283 -206
  12. package/lib/{isomorphic/testServerConnection.js → isomorphic.js} +70 -35
  13. package/lib/isomorphic.js.txt +9 -0
  14. package/lib/loader/loaderProcessEntry.js +34 -0
  15. package/lib/loader/loaderProcessEntry.js.txt +9 -0
  16. package/lib/matchers/expect.js +12988 -249
  17. package/lib/matchers/expect.js.LICENSE +693 -0
  18. package/lib/matchers/expect.js.txt +72 -0
  19. package/lib/mcp/test/browserBackend.js +49 -22
  20. package/lib/mcp/test/generatorTools.js +16 -16
  21. package/lib/mcp/test/plannerTools.js +25 -20
  22. package/lib/mcp/test/seed.js +7 -7
  23. package/lib/mcp/test/testBackend.js +30 -30
  24. package/lib/mcp/test/testContext.js +50 -33
  25. package/lib/mcp/test/testTools.js +15 -25
  26. package/lib/{internalsForTest.js → package.js} +13 -8
  27. package/lib/program.js +63 -263
  28. package/lib/runner/index.js +8339 -0
  29. package/lib/runner/index.js.txt +60 -0
  30. package/lib/transform/babelBundle.js +71002 -18
  31. package/lib/transform/babelBundle.js.LICENSE +2359 -0
  32. package/lib/transform/babelBundle.js.txt +325 -0
  33. package/lib/transform/esmLoader.js +5884 -30
  34. package/lib/transform/esmLoader.js.LICENSE +335 -0
  35. package/lib/transform/esmLoader.js.txt +55 -0
  36. package/lib/util.js +37 -34
  37. package/lib/worker/workerProcessEntry.js +3251 -0
  38. package/lib/worker/workerProcessEntry.js.txt +24 -0
  39. package/package.json +5 -16
  40. package/test.mjs +1 -0
  41. package/types/test.d.ts +173 -12
  42. package/types/testReporter.d.ts +7 -5
  43. package/lib/common/config.js +0 -282
  44. package/lib/common/configLoader.js +0 -344
  45. package/lib/common/esmLoaderHost.js +0 -104
  46. package/lib/common/expectBundle.js +0 -28
  47. package/lib/common/expectBundleImpl.js +0 -407
  48. package/lib/common/fixtures.js +0 -302
  49. package/lib/common/ipc.js +0 -60
  50. package/lib/common/poolBuilder.js +0 -85
  51. package/lib/common/process.js +0 -132
  52. package/lib/common/suiteUtils.js +0 -140
  53. package/lib/common/test.js +0 -321
  54. package/lib/common/testLoader.js +0 -101
  55. package/lib/common/testType.js +0 -298
  56. package/lib/common/validators.js +0 -68
  57. package/lib/fsWatcher.js +0 -67
  58. package/lib/isomorphic/events.js +0 -77
  59. package/lib/isomorphic/folders.js +0 -30
  60. package/lib/isomorphic/stringInternPool.js +0 -69
  61. package/lib/isomorphic/teleReceiver.js +0 -521
  62. package/lib/isomorphic/teleSuiteUpdater.js +0 -157
  63. package/lib/isomorphic/testServerInterface.js +0 -16
  64. package/lib/isomorphic/testTree.js +0 -329
  65. package/lib/isomorphic/types.d.js +0 -16
  66. package/lib/loader/loaderMain.js +0 -59
  67. package/lib/matchers/matcherHint.js +0 -44
  68. package/lib/matchers/matchers.js +0 -383
  69. package/lib/matchers/toBeTruthy.js +0 -75
  70. package/lib/matchers/toEqual.js +0 -100
  71. package/lib/matchers/toHaveURL.js +0 -101
  72. package/lib/matchers/toMatchAriaSnapshot.js +0 -159
  73. package/lib/matchers/toMatchSnapshot.js +0 -342
  74. package/lib/matchers/toMatchText.js +0 -99
  75. package/lib/mcp/browser/browserContextFactory.js +0 -329
  76. package/lib/mcp/browser/browserServerBackend.js +0 -84
  77. package/lib/mcp/browser/config.js +0 -421
  78. package/lib/mcp/browser/context.js +0 -244
  79. package/lib/mcp/browser/response.js +0 -278
  80. package/lib/mcp/browser/sessionLog.js +0 -75
  81. package/lib/mcp/browser/tab.js +0 -343
  82. package/lib/mcp/browser/tools/common.js +0 -65
  83. package/lib/mcp/browser/tools/console.js +0 -46
  84. package/lib/mcp/browser/tools/dialogs.js +0 -60
  85. package/lib/mcp/browser/tools/evaluate.js +0 -61
  86. package/lib/mcp/browser/tools/files.js +0 -58
  87. package/lib/mcp/browser/tools/form.js +0 -63
  88. package/lib/mcp/browser/tools/install.js +0 -72
  89. package/lib/mcp/browser/tools/keyboard.js +0 -107
  90. package/lib/mcp/browser/tools/mouse.js +0 -107
  91. package/lib/mcp/browser/tools/navigate.js +0 -71
  92. package/lib/mcp/browser/tools/network.js +0 -63
  93. package/lib/mcp/browser/tools/open.js +0 -57
  94. package/lib/mcp/browser/tools/pdf.js +0 -49
  95. package/lib/mcp/browser/tools/runCode.js +0 -78
  96. package/lib/mcp/browser/tools/screenshot.js +0 -93
  97. package/lib/mcp/browser/tools/snapshot.js +0 -173
  98. package/lib/mcp/browser/tools/tabs.js +0 -67
  99. package/lib/mcp/browser/tools/tool.js +0 -47
  100. package/lib/mcp/browser/tools/tracing.js +0 -74
  101. package/lib/mcp/browser/tools/utils.js +0 -94
  102. package/lib/mcp/browser/tools/verify.js +0 -143
  103. package/lib/mcp/browser/tools/wait.js +0 -63
  104. package/lib/mcp/browser/tools.js +0 -84
  105. package/lib/mcp/browser/watchdog.js +0 -44
  106. package/lib/mcp/config.d.js +0 -16
  107. package/lib/mcp/extension/cdpRelay.js +0 -351
  108. package/lib/mcp/extension/extensionContextFactory.js +0 -76
  109. package/lib/mcp/extension/protocol.js +0 -28
  110. package/lib/mcp/index.js +0 -61
  111. package/lib/mcp/log.js +0 -35
  112. package/lib/mcp/program.js +0 -111
  113. package/lib/mcp/sdk/exports.js +0 -28
  114. package/lib/mcp/sdk/http.js +0 -152
  115. package/lib/mcp/sdk/inProcessTransport.js +0 -71
  116. package/lib/mcp/sdk/server.js +0 -223
  117. package/lib/mcp/sdk/tool.js +0 -47
  118. package/lib/mcp/terminal/cli.js +0 -296
  119. package/lib/mcp/terminal/command.js +0 -56
  120. package/lib/mcp/terminal/commands.js +0 -333
  121. package/lib/mcp/terminal/daemon.js +0 -129
  122. package/lib/mcp/terminal/help.json +0 -32
  123. package/lib/mcp/terminal/helpGenerator.js +0 -88
  124. package/lib/mcp/terminal/socketConnection.js +0 -80
  125. package/lib/plugins/gitCommitInfoPlugin.js +0 -198
  126. package/lib/plugins/index.js +0 -28
  127. package/lib/plugins/webServerPlugin.js +0 -237
  128. package/lib/reporters/base.js +0 -634
  129. package/lib/reporters/blob.js +0 -138
  130. package/lib/reporters/dot.js +0 -99
  131. package/lib/reporters/empty.js +0 -32
  132. package/lib/reporters/github.js +0 -128
  133. package/lib/reporters/html.js +0 -633
  134. package/lib/reporters/internalReporter.js +0 -138
  135. package/lib/reporters/json.js +0 -254
  136. package/lib/reporters/junit.js +0 -232
  137. package/lib/reporters/line.js +0 -131
  138. package/lib/reporters/list.js +0 -253
  139. package/lib/reporters/listModeReporter.js +0 -69
  140. package/lib/reporters/markdown.js +0 -144
  141. package/lib/reporters/merge.js +0 -558
  142. package/lib/reporters/multiplexer.js +0 -112
  143. package/lib/reporters/reporterV2.js +0 -102
  144. package/lib/reporters/smoothdeploy.js +0 -333
  145. package/lib/reporters/teleEmitter.js +0 -317
  146. package/lib/reporters/versions/blobV1.js +0 -16
  147. package/lib/runner/dispatcher.js +0 -531
  148. package/lib/runner/failureTracker.js +0 -72
  149. package/lib/runner/lastRun.js +0 -77
  150. package/lib/runner/loadUtils.js +0 -334
  151. package/lib/runner/loaderHost.js +0 -89
  152. package/lib/runner/processHost.js +0 -180
  153. package/lib/runner/projectUtils.js +0 -241
  154. package/lib/runner/rebase.js +0 -189
  155. package/lib/runner/reporters.js +0 -140
  156. package/lib/runner/sigIntWatcher.js +0 -96
  157. package/lib/runner/storage.js +0 -91
  158. package/lib/runner/taskRunner.js +0 -127
  159. package/lib/runner/tasks.js +0 -410
  160. package/lib/runner/testGroups.js +0 -125
  161. package/lib/runner/testRunner.js +0 -398
  162. package/lib/runner/testServer.js +0 -269
  163. package/lib/runner/uiModeReporter.js +0 -30
  164. package/lib/runner/vcs.js +0 -72
  165. package/lib/runner/watchMode.js +0 -396
  166. package/lib/runner/workerHost.js +0 -104
  167. package/lib/third_party/pirates.js +0 -62
  168. package/lib/third_party/tsconfig-loader.js +0 -103
  169. package/lib/transform/babelBundleImpl.js +0 -461
  170. package/lib/transform/compilationCache.js +0 -274
  171. package/lib/transform/md.js +0 -221
  172. package/lib/transform/portTransport.js +0 -67
  173. package/lib/transform/transform.js +0 -303
  174. package/lib/utilsBundle.js +0 -50
  175. package/lib/utilsBundleImpl.js +0 -103
  176. package/lib/worker/fixtureRunner.js +0 -262
  177. package/lib/worker/testInfo.js +0 -536
  178. package/lib/worker/testTracing.js +0 -345
  179. package/lib/worker/timeoutManager.js +0 -174
  180. package/lib/worker/util.js +0 -31
  181. package/lib/worker/workerMain.js +0 -530
  182. /package/lib/{common/globals.js → globals.js} +0 -0
@@ -1,396 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var watchMode_exports = {};
30
- __export(watchMode_exports, {
31
- runWatchModeLoop: () => runWatchModeLoop
32
- });
33
- module.exports = __toCommonJS(watchMode_exports);
34
- var import_path = __toESM(require("path"));
35
- var import_readline = __toESM(require("readline"));
36
- var import_stream = require("stream");
37
- var import_playwrightServer = require("playwright-core/lib/remote/playwrightServer");
38
- var import_utils = require("playwright-core/lib/utils");
39
- var import_utils2 = require("playwright-core/lib/utils");
40
- var import_base = require("../reporters/base");
41
- var import_utilsBundle = require("../utilsBundle");
42
- var import_testServer = require("./testServer");
43
- var import_teleSuiteUpdater = require("../isomorphic/teleSuiteUpdater");
44
- var import_testServerConnection = require("../isomorphic/testServerConnection");
45
- class InMemoryTransport extends import_stream.EventEmitter {
46
- constructor(send) {
47
- super();
48
- this._send = send;
49
- }
50
- close() {
51
- this.emit("close");
52
- }
53
- onclose(listener) {
54
- this.on("close", listener);
55
- }
56
- onerror(listener) {
57
- }
58
- onmessage(listener) {
59
- this.on("message", listener);
60
- }
61
- onopen(listener) {
62
- this.on("open", listener);
63
- }
64
- send(data) {
65
- this._send(data);
66
- }
67
- }
68
- async function runWatchModeLoop(configLocation, initialOptions) {
69
- const options = { ...initialOptions };
70
- let bufferMode = false;
71
- const testServerDispatcher = new import_testServer.TestServerDispatcher(configLocation, {});
72
- const transport = new InMemoryTransport(
73
- async (data) => {
74
- const { id, method, params } = JSON.parse(data);
75
- try {
76
- const result2 = await testServerDispatcher.transport.dispatch(method, params);
77
- transport.emit("message", JSON.stringify({ id, result: result2 }));
78
- } catch (e) {
79
- transport.emit("message", JSON.stringify({ id, error: String(e) }));
80
- }
81
- }
82
- );
83
- testServerDispatcher.transport.sendEvent = (method, params) => {
84
- transport.emit("message", JSON.stringify({ method, params }));
85
- };
86
- const testServerConnection = new import_testServerConnection.TestServerConnection(transport);
87
- transport.emit("open");
88
- const teleSuiteUpdater = new import_teleSuiteUpdater.TeleSuiteUpdater({ pathSeparator: import_path.default.sep, onUpdate() {
89
- } });
90
- const dirtyTestFiles = /* @__PURE__ */ new Set();
91
- const dirtyTestIds = /* @__PURE__ */ new Set();
92
- let onDirtyTests = new import_utils.ManualPromise();
93
- let queue = Promise.resolve();
94
- const changedFiles = /* @__PURE__ */ new Set();
95
- testServerConnection.onTestFilesChanged(({ testFiles }) => {
96
- testFiles.forEach((file) => changedFiles.add(file));
97
- queue = queue.then(async () => {
98
- if (changedFiles.size === 0)
99
- return;
100
- const { report: report2 } = await testServerConnection.listTests({ locations: options.files, projects: options.projects, grep: options.grep });
101
- teleSuiteUpdater.processListReport(report2);
102
- for (const test of teleSuiteUpdater.rootSuite.allTests()) {
103
- if (changedFiles.has(test.location.file)) {
104
- dirtyTestFiles.add(test.location.file);
105
- dirtyTestIds.add(test.id);
106
- }
107
- }
108
- changedFiles.clear();
109
- if (dirtyTestIds.size > 0) {
110
- onDirtyTests.resolve("changed");
111
- onDirtyTests = new import_utils.ManualPromise();
112
- }
113
- });
114
- });
115
- testServerConnection.onReport((report2) => teleSuiteUpdater.processTestReportEvent(report2));
116
- await testServerConnection.initialize({
117
- interceptStdio: false,
118
- watchTestDirs: true,
119
- populateDependenciesOnList: true
120
- });
121
- await testServerConnection.runGlobalSetup({});
122
- const { report } = await testServerConnection.listTests({});
123
- teleSuiteUpdater.processListReport(report);
124
- const projectNames = teleSuiteUpdater.rootSuite.suites.map((s) => s.title);
125
- let lastRun = { type: "regular" };
126
- let result = "passed";
127
- while (true) {
128
- if (bufferMode)
129
- printBufferPrompt(dirtyTestFiles, teleSuiteUpdater.config.rootDir);
130
- else
131
- printPrompt();
132
- const waitForCommand = readCommand();
133
- const command = await Promise.race([
134
- onDirtyTests,
135
- waitForCommand.result
136
- ]);
137
- if (command === "changed")
138
- waitForCommand.dispose();
139
- if (bufferMode && command === "changed")
140
- continue;
141
- const shouldRunChangedFiles = bufferMode ? command === "run" : command === "changed";
142
- if (shouldRunChangedFiles) {
143
- if (dirtyTestIds.size === 0)
144
- continue;
145
- const testIds = [...dirtyTestIds];
146
- dirtyTestIds.clear();
147
- dirtyTestFiles.clear();
148
- await runTests(options, testServerConnection, { testIds, title: "files changed" });
149
- lastRun = { type: "changed", dirtyTestIds: testIds };
150
- continue;
151
- }
152
- if (command === "run") {
153
- await runTests(options, testServerConnection);
154
- lastRun = { type: "regular" };
155
- continue;
156
- }
157
- if (command === "project") {
158
- const { selectedProjects } = await import_utilsBundle.enquirer.prompt({
159
- type: "multiselect",
160
- name: "selectedProjects",
161
- message: "Select projects",
162
- choices: projectNames
163
- }).catch(() => ({ selectedProjects: null }));
164
- if (!selectedProjects)
165
- continue;
166
- options.projects = selectedProjects.length ? selectedProjects : void 0;
167
- await runTests(options, testServerConnection);
168
- lastRun = { type: "regular" };
169
- continue;
170
- }
171
- if (command === "file") {
172
- const { filePattern } = await import_utilsBundle.enquirer.prompt({
173
- type: "text",
174
- name: "filePattern",
175
- message: "Input filename pattern (regex)"
176
- }).catch(() => ({ filePattern: null }));
177
- if (filePattern === null)
178
- continue;
179
- if (filePattern.trim())
180
- options.files = filePattern.split(" ");
181
- else
182
- options.files = void 0;
183
- await runTests(options, testServerConnection);
184
- lastRun = { type: "regular" };
185
- continue;
186
- }
187
- if (command === "grep") {
188
- const { testPattern } = await import_utilsBundle.enquirer.prompt({
189
- type: "text",
190
- name: "testPattern",
191
- message: "Input test name pattern (regex)"
192
- }).catch(() => ({ testPattern: null }));
193
- if (testPattern === null)
194
- continue;
195
- if (testPattern.trim())
196
- options.grep = testPattern;
197
- else
198
- options.grep = void 0;
199
- await runTests(options, testServerConnection);
200
- lastRun = { type: "regular" };
201
- continue;
202
- }
203
- if (command === "failed") {
204
- const failedTestIds = teleSuiteUpdater.rootSuite.allTests().filter((t) => !t.ok()).map((t) => t.id);
205
- await runTests({}, testServerConnection, { title: "running failed tests", testIds: failedTestIds });
206
- lastRun = { type: "failed", failedTestIds };
207
- continue;
208
- }
209
- if (command === "repeat") {
210
- if (lastRun.type === "regular") {
211
- await runTests(options, testServerConnection, { title: "re-running tests" });
212
- continue;
213
- } else if (lastRun.type === "changed") {
214
- await runTests(options, testServerConnection, { title: "re-running tests", testIds: lastRun.dirtyTestIds });
215
- } else if (lastRun.type === "failed") {
216
- await runTests({}, testServerConnection, { title: "re-running tests", testIds: lastRun.failedTestIds });
217
- }
218
- continue;
219
- }
220
- if (command === "toggle-show-browser") {
221
- await toggleShowBrowser();
222
- continue;
223
- }
224
- if (command === "toggle-buffer-mode") {
225
- bufferMode = !bufferMode;
226
- continue;
227
- }
228
- if (command === "exit")
229
- break;
230
- if (command === "interrupted") {
231
- result = "interrupted";
232
- break;
233
- }
234
- }
235
- const teardown = await testServerConnection.runGlobalTeardown({});
236
- return result === "passed" ? teardown.status : result;
237
- }
238
- function readKeyPress(handler) {
239
- const promise = new import_utils.ManualPromise();
240
- const rl = import_readline.default.createInterface({ input: process.stdin, escapeCodeTimeout: 50 });
241
- import_readline.default.emitKeypressEvents(process.stdin, rl);
242
- if (process.stdin.isTTY)
243
- process.stdin.setRawMode(true);
244
- const listener = import_utils.eventsHelper.addEventListener(process.stdin, "keypress", (text, key) => {
245
- const result = handler(text, key);
246
- if (result)
247
- promise.resolve(result);
248
- });
249
- const dispose = () => {
250
- import_utils.eventsHelper.removeEventListeners([listener]);
251
- rl.close();
252
- if (process.stdin.isTTY)
253
- process.stdin.setRawMode(false);
254
- };
255
- void promise.finally(dispose);
256
- return { result: promise, dispose };
257
- }
258
- const isInterrupt = (text, key) => text === "" || text === "\x1B" || key && key.name === "escape" || key && key.ctrl && key.name === "c";
259
- async function runTests(watchOptions, testServerConnection, options) {
260
- printConfiguration(watchOptions, options?.title);
261
- const waitForDone = readKeyPress((text, key) => {
262
- if (isInterrupt(text, key)) {
263
- testServerConnection.stopTestsNoReply({});
264
- return "done";
265
- }
266
- });
267
- await testServerConnection.runTests({
268
- grep: watchOptions.grep,
269
- testIds: options?.testIds,
270
- locations: watchOptions?.files ?? [],
271
- // TODO: always collect locations based on knowledge about tree, so that we don't have to load all tests
272
- projects: watchOptions.projects,
273
- connectWsEndpoint,
274
- reuseContext: connectWsEndpoint ? true : void 0,
275
- workers: connectWsEndpoint ? 1 : void 0,
276
- headed: connectWsEndpoint ? true : void 0
277
- }).finally(() => waitForDone.dispose());
278
- }
279
- function readCommand() {
280
- return readKeyPress((text, key) => {
281
- if (isInterrupt(text, key))
282
- return "interrupted";
283
- if (process.platform !== "win32" && key && key.ctrl && key.name === "z") {
284
- process.kill(process.ppid, "SIGTSTP");
285
- process.kill(process.pid, "SIGTSTP");
286
- }
287
- const name = key?.name;
288
- if (name === "q")
289
- return "exit";
290
- if (name === "h") {
291
- process.stdout.write(`${(0, import_base.separator)(import_base.terminalScreen)}
292
- Run tests
293
- ${import_utils2.colors.bold("enter")} ${import_utils2.colors.dim("run tests")}
294
- ${import_utils2.colors.bold("f")} ${import_utils2.colors.dim("run failed tests")}
295
- ${import_utils2.colors.bold("r")} ${import_utils2.colors.dim("repeat last run")}
296
- ${import_utils2.colors.bold("q")} ${import_utils2.colors.dim("quit")}
297
-
298
- Change settings
299
- ${import_utils2.colors.bold("c")} ${import_utils2.colors.dim("set project")}
300
- ${import_utils2.colors.bold("p")} ${import_utils2.colors.dim("set file filter")}
301
- ${import_utils2.colors.bold("t")} ${import_utils2.colors.dim("set title filter")}
302
- ${import_utils2.colors.bold("s")} ${import_utils2.colors.dim("toggle show & reuse the browser")}
303
- ${import_utils2.colors.bold("b")} ${import_utils2.colors.dim("toggle buffer mode")}
304
- `);
305
- return;
306
- }
307
- switch (name) {
308
- case "return":
309
- return "run";
310
- case "r":
311
- return "repeat";
312
- case "c":
313
- return "project";
314
- case "p":
315
- return "file";
316
- case "t":
317
- return "grep";
318
- case "f":
319
- return "failed";
320
- case "s":
321
- return "toggle-show-browser";
322
- case "b":
323
- return "toggle-buffer-mode";
324
- }
325
- });
326
- }
327
- let showBrowserServer;
328
- let connectWsEndpoint = void 0;
329
- let seq = 1;
330
- function printConfiguration(options, title) {
331
- const packageManagerCommand = (0, import_utils.getPackageManagerExecCommand)();
332
- const tokens = [];
333
- tokens.push(`${packageManagerCommand} playwright test`);
334
- if (options.projects)
335
- tokens.push(...options.projects.map((p) => import_utils2.colors.blue(`--project ${p}`)));
336
- if (options.grep)
337
- tokens.push(import_utils2.colors.red(`--grep ${options.grep}`));
338
- if (options.files)
339
- tokens.push(...options.files.map((a) => import_utils2.colors.bold(a)));
340
- if (title)
341
- tokens.push(import_utils2.colors.dim(`(${title})`));
342
- tokens.push(import_utils2.colors.dim(`#${seq++}`));
343
- const lines = [];
344
- const sep = (0, import_base.separator)(import_base.terminalScreen);
345
- lines.push("\x1Bc" + sep);
346
- lines.push(`${tokens.join(" ")}`);
347
- lines.push(`${import_utils2.colors.dim("Show & reuse browser:")} ${import_utils2.colors.bold(showBrowserServer ? "on" : "off")}`);
348
- process.stdout.write(lines.join("\n"));
349
- }
350
- function printBufferPrompt(dirtyTestFiles, rootDir) {
351
- const sep = (0, import_base.separator)(import_base.terminalScreen);
352
- process.stdout.write("\x1Bc");
353
- process.stdout.write(`${sep}
354
- `);
355
- if (dirtyTestFiles.size === 0) {
356
- process.stdout.write(`${import_utils2.colors.dim("Waiting for file changes. Press")} ${import_utils2.colors.bold("q")} ${import_utils2.colors.dim("to quit or")} ${import_utils2.colors.bold("h")} ${import_utils2.colors.dim("for more options.")}
357
-
358
- `);
359
- return;
360
- }
361
- process.stdout.write(`${import_utils2.colors.dim(`${dirtyTestFiles.size} test ${dirtyTestFiles.size === 1 ? "file" : "files"} changed:`)}
362
-
363
- `);
364
- for (const file of dirtyTestFiles)
365
- process.stdout.write(` \xB7 ${import_path.default.relative(rootDir, file)}
366
- `);
367
- process.stdout.write(`
368
- ${import_utils2.colors.dim(`Press`)} ${import_utils2.colors.bold("enter")} ${import_utils2.colors.dim("to run")}, ${import_utils2.colors.bold("q")} ${import_utils2.colors.dim("to quit or")} ${import_utils2.colors.bold("h")} ${import_utils2.colors.dim("for more options.")}
369
-
370
- `);
371
- }
372
- function printPrompt() {
373
- const sep = (0, import_base.separator)(import_base.terminalScreen);
374
- process.stdout.write(`
375
- ${sep}
376
- ${import_utils2.colors.dim("Waiting for file changes. Press")} ${import_utils2.colors.bold("enter")} ${import_utils2.colors.dim("to run tests")}, ${import_utils2.colors.bold("q")} ${import_utils2.colors.dim("to quit or")} ${import_utils2.colors.bold("h")} ${import_utils2.colors.dim("for more options.")}
377
- `);
378
- }
379
- async function toggleShowBrowser() {
380
- if (!showBrowserServer) {
381
- showBrowserServer = new import_playwrightServer.PlaywrightServer({ mode: "extension", path: "/" + (0, import_utils.createGuid)(), maxConnections: 1 });
382
- connectWsEndpoint = await showBrowserServer.listen();
383
- process.stdout.write(`${import_utils2.colors.dim("Show & reuse browser:")} ${import_utils2.colors.bold("on")}
384
- `);
385
- } else {
386
- await showBrowserServer?.close();
387
- showBrowserServer = void 0;
388
- connectWsEndpoint = void 0;
389
- process.stdout.write(`${import_utils2.colors.dim("Show & reuse browser:")} ${import_utils2.colors.bold("off")}
390
- `);
391
- }
392
- }
393
- // Annotate the CommonJS export names for ESM import in node:
394
- 0 && (module.exports = {
395
- runWatchModeLoop
396
- });
@@ -1,104 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var workerHost_exports = {};
30
- __export(workerHost_exports, {
31
- WorkerHost: () => WorkerHost
32
- });
33
- module.exports = __toCommonJS(workerHost_exports);
34
- var import_fs = __toESM(require("fs"));
35
- var import_path = __toESM(require("path"));
36
- var import_utils = require("playwright-core/lib/utils");
37
- var import_processHost = require("./processHost");
38
- var import_ipc = require("../common/ipc");
39
- var import_folders = require("../isomorphic/folders");
40
- let lastWorkerIndex = 0;
41
- class WorkerHost extends import_processHost.ProcessHost {
42
- constructor(testGroup, options) {
43
- const workerIndex = lastWorkerIndex++;
44
- super(require.resolve("../worker/workerMain.js"), `worker-${workerIndex}`, {
45
- ...options.extraEnv,
46
- FORCE_COLOR: "1",
47
- DEBUG_COLORS: process.env.DEBUG_COLORS === void 0 ? "1" : process.env.DEBUG_COLORS
48
- });
49
- this._didFail = false;
50
- this.workerIndex = workerIndex;
51
- this.parallelIndex = options.parallelIndex;
52
- this._hash = testGroup.workerHash;
53
- this._params = {
54
- workerIndex: this.workerIndex,
55
- parallelIndex: options.parallelIndex,
56
- repeatEachIndex: testGroup.repeatEachIndex,
57
- projectId: testGroup.projectId,
58
- config: options.config,
59
- artifactsDir: import_path.default.join(options.outputDir, (0, import_folders.artifactsFolderName)(workerIndex)),
60
- pauseOnError: options.pauseOnError,
61
- pauseAtEnd: options.pauseAtEnd
62
- };
63
- }
64
- artifactsDir() {
65
- return this._params.artifactsDir;
66
- }
67
- async start() {
68
- await import_fs.default.promises.mkdir(this._params.artifactsDir, { recursive: true });
69
- return await this.startRunner(this._params, {
70
- onStdOut: (chunk) => this.emit("stdOut", (0, import_ipc.stdioChunkToParams)(chunk)),
71
- onStdErr: (chunk) => this.emit("stdErr", (0, import_ipc.stdioChunkToParams)(chunk))
72
- });
73
- }
74
- async onExit() {
75
- await (0, import_utils.removeFolders)([this._params.artifactsDir]);
76
- }
77
- async stop(didFail) {
78
- if (didFail)
79
- this._didFail = true;
80
- await super.stop();
81
- }
82
- runTestGroup(runPayload) {
83
- this.sendMessageNoReply({ method: "runTestGroup", params: runPayload });
84
- }
85
- async sendCustomMessage(payload) {
86
- return await this.sendMessage({ method: "customMessage", params: payload });
87
- }
88
- sendResume(payload) {
89
- this.sendMessageNoReply({ method: "resume", params: payload });
90
- }
91
- hash() {
92
- return this._hash;
93
- }
94
- projectId() {
95
- return this._params.projectId;
96
- }
97
- didFail() {
98
- return this._didFail;
99
- }
100
- }
101
- // Annotate the CommonJS export names for ESM import in node:
102
- 0 && (module.exports = {
103
- WorkerHost
104
- });
@@ -1,62 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var pirates_exports = {};
30
- __export(pirates_exports, {
31
- addHook: () => addHook
32
- });
33
- module.exports = __toCommonJS(pirates_exports);
34
- var import_module = __toESM(require("module"));
35
- var import_path = __toESM(require("path"));
36
- function addHook(transformHook, shouldTransform, extensions) {
37
- const extensionsToOverwrite = extensions.filter((e) => e !== ".cjs");
38
- const allSupportedExtensions = new Set(extensions);
39
- const loaders = import_module.default._extensions;
40
- const jsLoader = loaders[".js"];
41
- for (const extension of extensionsToOverwrite) {
42
- let newLoader2 = function(mod, filename, ...loaderArgs) {
43
- if (allSupportedExtensions.has(import_path.default.extname(filename)) && shouldTransform(filename)) {
44
- let newCompile2 = function(code, file, ...ignoredArgs) {
45
- mod._compile = oldCompile;
46
- return oldCompile.call(this, transformHook(code, filename), file);
47
- };
48
- var newCompile = newCompile2;
49
- const oldCompile = mod._compile;
50
- mod._compile = newCompile2;
51
- }
52
- originalLoader.call(this, mod, filename, ...loaderArgs);
53
- };
54
- var newLoader = newLoader2;
55
- const originalLoader = loaders[extension] || jsLoader;
56
- loaders[extension] = newLoader2;
57
- }
58
- }
59
- // Annotate the CommonJS export names for ESM import in node:
60
- 0 && (module.exports = {
61
- addHook
62
- });
@@ -1,103 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var tsconfig_loader_exports = {};
30
- __export(tsconfig_loader_exports, {
31
- loadTsConfig: () => loadTsConfig
32
- });
33
- module.exports = __toCommonJS(tsconfig_loader_exports);
34
- var import_path = __toESM(require("path"));
35
- var import_fs = __toESM(require("fs"));
36
- var import_utilsBundle = require("../utilsBundle");
37
- function loadTsConfig(configPath) {
38
- try {
39
- const references = [];
40
- const config = innerLoadTsConfig(configPath, references);
41
- return [config, ...references];
42
- } catch (e) {
43
- throw new Error(`Failed to load tsconfig file at ${configPath}:
44
- ${e.message}`);
45
- }
46
- }
47
- function resolveConfigFile(baseConfigFile, referencedConfigFile) {
48
- if (!referencedConfigFile.endsWith(".json"))
49
- referencedConfigFile += ".json";
50
- const currentDir = import_path.default.dirname(baseConfigFile);
51
- let resolvedConfigFile = import_path.default.resolve(currentDir, referencedConfigFile);
52
- if (referencedConfigFile.includes("/") && referencedConfigFile.includes(".") && !import_fs.default.existsSync(resolvedConfigFile))
53
- resolvedConfigFile = import_path.default.join(currentDir, "node_modules", referencedConfigFile);
54
- return resolvedConfigFile;
55
- }
56
- function innerLoadTsConfig(configFilePath, references, visited = /* @__PURE__ */ new Map()) {
57
- if (visited.has(configFilePath))
58
- return visited.get(configFilePath);
59
- let result = {
60
- tsConfigPath: configFilePath
61
- };
62
- visited.set(configFilePath, result);
63
- if (!import_fs.default.existsSync(configFilePath))
64
- return result;
65
- const configString = import_fs.default.readFileSync(configFilePath, "utf-8");
66
- const cleanedJson = StripBom(configString);
67
- const parsedConfig = import_utilsBundle.json5.parse(cleanedJson);
68
- const extendsArray = Array.isArray(parsedConfig.extends) ? parsedConfig.extends : parsedConfig.extends ? [parsedConfig.extends] : [];
69
- for (const extendedConfig of extendsArray) {
70
- const extendedConfigPath = resolveConfigFile(configFilePath, extendedConfig);
71
- const base = innerLoadTsConfig(extendedConfigPath, references, visited);
72
- Object.assign(result, base, { tsConfigPath: configFilePath });
73
- }
74
- if (parsedConfig.compilerOptions?.allowJs !== void 0)
75
- result.allowJs = parsedConfig.compilerOptions.allowJs;
76
- if (parsedConfig.compilerOptions?.paths !== void 0) {
77
- result.paths = {
78
- mapping: parsedConfig.compilerOptions.paths,
79
- pathsBasePath: import_path.default.dirname(configFilePath)
80
- };
81
- }
82
- if (parsedConfig.compilerOptions?.baseUrl !== void 0) {
83
- result.absoluteBaseUrl = import_path.default.resolve(import_path.default.dirname(configFilePath), parsedConfig.compilerOptions.baseUrl);
84
- }
85
- for (const ref of parsedConfig.references || [])
86
- references.push(innerLoadTsConfig(resolveConfigFile(configFilePath, ref.path), references, visited));
87
- if (import_path.default.basename(configFilePath) === "jsconfig.json" && result.allowJs === void 0)
88
- result.allowJs = true;
89
- return result;
90
- }
91
- function StripBom(string) {
92
- if (typeof string !== "string") {
93
- throw new TypeError(`Expected a string, got ${typeof string}`);
94
- }
95
- if (string.charCodeAt(0) === 65279) {
96
- return string.slice(1);
97
- }
98
- return string;
99
- }
100
- // Annotate the CommonJS export names for ESM import in node:
101
- 0 && (module.exports = {
102
- loadTsConfig
103
- });