ScuttleBot

scuttlebot / tests / e2e / node_modules / playwright / lib / runner / watchMode.js
Source Blame History 396 lines
f7eb47b… lmata 1 "use strict";
f7eb47b… lmata 2 var __create = Object.create;
f7eb47b… lmata 3 var __defProp = Object.defineProperty;
f7eb47b… lmata 4 var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
f7eb47b… lmata 5 var __getOwnPropNames = Object.getOwnPropertyNames;
f7eb47b… lmata 6 var __getProtoOf = Object.getPrototypeOf;
f7eb47b… lmata 7 var __hasOwnProp = Object.prototype.hasOwnProperty;
f7eb47b… lmata 8 var __export = (target, all) => {
f7eb47b… lmata 9 for (var name in all)
f7eb47b… lmata 10 __defProp(target, name, { get: all[name], enumerable: true });
f7eb47b… lmata 11 };
f7eb47b… lmata 12 var __copyProps = (to, from, except, desc) => {
f7eb47b… lmata 13 if (from && typeof from === "object" || typeof from === "function") {
f7eb47b… lmata 14 for (let key of __getOwnPropNames(from))
f7eb47b… lmata 15 if (!__hasOwnProp.call(to, key) && key !== except)
f7eb47b… lmata 16 __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
f7eb47b… lmata 17 }
f7eb47b… lmata 18 return to;
f7eb47b… lmata 19 };
f7eb47b… lmata 20 var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
f7eb47b… lmata 21 // If the importer is in node compatibility mode or this is not an ESM
f7eb47b… lmata 22 // file that has been converted to a CommonJS file using a Babel-
f7eb47b… lmata 23 // compatible transform (i.e. "__esModule" has not been set), then set
f7eb47b… lmata 24 // "default" to the CommonJS "module.exports" for node compatibility.
f7eb47b… lmata 25 isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
f7eb47b… lmata 26 mod
f7eb47b… lmata 27 ));
f7eb47b… lmata 28 var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
f7eb47b… lmata 29 var watchMode_exports = {};
f7eb47b… lmata 30 __export(watchMode_exports, {
f7eb47b… lmata 31 runWatchModeLoop: () => runWatchModeLoop
f7eb47b… lmata 32 });
f7eb47b… lmata 33 module.exports = __toCommonJS(watchMode_exports);
f7eb47b… lmata 34 var import_path = __toESM(require("path"));
f7eb47b… lmata 35 var import_readline = __toESM(require("readline"));
f7eb47b… lmata 36 var import_stream = require("stream");
f7eb47b… lmata 37 var import_playwrightServer = require("playwright-core/lib/remote/playwrightServer");
f7eb47b… lmata 38 var import_utils = require("playwright-core/lib/utils");
f7eb47b… lmata 39 var import_utils2 = require("playwright-core/lib/utils");
f7eb47b… lmata 40 var import_base = require("../reporters/base");
f7eb47b… lmata 41 var import_utilsBundle = require("../utilsBundle");
f7eb47b… lmata 42 var import_testServer = require("./testServer");
f7eb47b… lmata 43 var import_teleSuiteUpdater = require("../isomorphic/teleSuiteUpdater");
f7eb47b… lmata 44 var import_testServerConnection = require("../isomorphic/testServerConnection");
f7eb47b… lmata 45 class InMemoryTransport extends import_stream.EventEmitter {
f7eb47b… lmata 46 constructor(send) {
f7eb47b… lmata 47 super();
f7eb47b… lmata 48 this._send = send;
f7eb47b… lmata 49 }
f7eb47b… lmata 50 close() {
f7eb47b… lmata 51 this.emit("close");
f7eb47b… lmata 52 }
f7eb47b… lmata 53 onclose(listener) {
f7eb47b… lmata 54 this.on("close", listener);
f7eb47b… lmata 55 }
f7eb47b… lmata 56 onerror(listener) {
f7eb47b… lmata 57 }
f7eb47b… lmata 58 onmessage(listener) {
f7eb47b… lmata 59 this.on("message", listener);
f7eb47b… lmata 60 }
f7eb47b… lmata 61 onopen(listener) {
f7eb47b… lmata 62 this.on("open", listener);
f7eb47b… lmata 63 }
f7eb47b… lmata 64 send(data) {
f7eb47b… lmata 65 this._send(data);
f7eb47b… lmata 66 }
f7eb47b… lmata 67 }
f7eb47b… lmata 68 async function runWatchModeLoop(configLocation, initialOptions) {
f7eb47b… lmata 69 const options = { ...initialOptions };
f7eb47b… lmata 70 let bufferMode = false;
f7eb47b… lmata 71 const testServerDispatcher = new import_testServer.TestServerDispatcher(configLocation, {});
f7eb47b… lmata 72 const transport = new InMemoryTransport(
f7eb47b… lmata 73 async (data) => {
f7eb47b… lmata 74 const { id, method, params } = JSON.parse(data);
f7eb47b… lmata 75 try {
f7eb47b… lmata 76 const result2 = await testServerDispatcher.transport.dispatch(method, params);
f7eb47b… lmata 77 transport.emit("message", JSON.stringify({ id, result: result2 }));
f7eb47b… lmata 78 } catch (e) {
f7eb47b… lmata 79 transport.emit("message", JSON.stringify({ id, error: String(e) }));
f7eb47b… lmata 80 }
f7eb47b… lmata 81 }
f7eb47b… lmata 82 );
f7eb47b… lmata 83 testServerDispatcher.transport.sendEvent = (method, params) => {
f7eb47b… lmata 84 transport.emit("message", JSON.stringify({ method, params }));
f7eb47b… lmata 85 };
f7eb47b… lmata 86 const testServerConnection = new import_testServerConnection.TestServerConnection(transport);
f7eb47b… lmata 87 transport.emit("open");
f7eb47b… lmata 88 const teleSuiteUpdater = new import_teleSuiteUpdater.TeleSuiteUpdater({ pathSeparator: import_path.default.sep, onUpdate() {
f7eb47b… lmata 89 } });
f7eb47b… lmata 90 const dirtyTestFiles = /* @__PURE__ */ new Set();
f7eb47b… lmata 91 const dirtyTestIds = /* @__PURE__ */ new Set();
f7eb47b… lmata 92 let onDirtyTests = new import_utils.ManualPromise();
f7eb47b… lmata 93 let queue = Promise.resolve();
f7eb47b… lmata 94 const changedFiles = /* @__PURE__ */ new Set();
f7eb47b… lmata 95 testServerConnection.onTestFilesChanged(({ testFiles }) => {
f7eb47b… lmata 96 testFiles.forEach((file) => changedFiles.add(file));
f7eb47b… lmata 97 queue = queue.then(async () => {
f7eb47b… lmata 98 if (changedFiles.size === 0)
f7eb47b… lmata 99 return;
f7eb47b… lmata 100 const { report: report2 } = await testServerConnection.listTests({ locations: options.files, projects: options.projects, grep: options.grep });
f7eb47b… lmata 101 teleSuiteUpdater.processListReport(report2);
f7eb47b… lmata 102 for (const test of teleSuiteUpdater.rootSuite.allTests()) {
f7eb47b… lmata 103 if (changedFiles.has(test.location.file)) {
f7eb47b… lmata 104 dirtyTestFiles.add(test.location.file);
f7eb47b… lmata 105 dirtyTestIds.add(test.id);
f7eb47b… lmata 106 }
f7eb47b… lmata 107 }
f7eb47b… lmata 108 changedFiles.clear();
f7eb47b… lmata 109 if (dirtyTestIds.size > 0) {
f7eb47b… lmata 110 onDirtyTests.resolve("changed");
f7eb47b… lmata 111 onDirtyTests = new import_utils.ManualPromise();
f7eb47b… lmata 112 }
f7eb47b… lmata 113 });
f7eb47b… lmata 114 });
f7eb47b… lmata 115 testServerConnection.onReport((report2) => teleSuiteUpdater.processTestReportEvent(report2));
f7eb47b… lmata 116 await testServerConnection.initialize({
f7eb47b… lmata 117 interceptStdio: false,
f7eb47b… lmata 118 watchTestDirs: true,
f7eb47b… lmata 119 populateDependenciesOnList: true
f7eb47b… lmata 120 });
f7eb47b… lmata 121 await testServerConnection.runGlobalSetup({});
f7eb47b… lmata 122 const { report } = await testServerConnection.listTests({});
f7eb47b… lmata 123 teleSuiteUpdater.processListReport(report);
f7eb47b… lmata 124 const projectNames = teleSuiteUpdater.rootSuite.suites.map((s) => s.title);
f7eb47b… lmata 125 let lastRun = { type: "regular" };
f7eb47b… lmata 126 let result = "passed";
f7eb47b… lmata 127 while (true) {
f7eb47b… lmata 128 if (bufferMode)
f7eb47b… lmata 129 printBufferPrompt(dirtyTestFiles, teleSuiteUpdater.config.rootDir);
f7eb47b… lmata 130 else
f7eb47b… lmata 131 printPrompt();
f7eb47b… lmata 132 const waitForCommand = readCommand();
f7eb47b… lmata 133 const command = await Promise.race([
f7eb47b… lmata 134 onDirtyTests,
f7eb47b… lmata 135 waitForCommand.result
f7eb47b… lmata 136 ]);
f7eb47b… lmata 137 if (command === "changed")
f7eb47b… lmata 138 waitForCommand.dispose();
f7eb47b… lmata 139 if (bufferMode && command === "changed")
f7eb47b… lmata 140 continue;
f7eb47b… lmata 141 const shouldRunChangedFiles = bufferMode ? command === "run" : command === "changed";
f7eb47b… lmata 142 if (shouldRunChangedFiles) {
f7eb47b… lmata 143 if (dirtyTestIds.size === 0)
f7eb47b… lmata 144 continue;
f7eb47b… lmata 145 const testIds = [...dirtyTestIds];
f7eb47b… lmata 146 dirtyTestIds.clear();
f7eb47b… lmata 147 dirtyTestFiles.clear();
f7eb47b… lmata 148 await runTests(options, testServerConnection, { testIds, title: "files changed" });
f7eb47b… lmata 149 lastRun = { type: "changed", dirtyTestIds: testIds };
f7eb47b… lmata 150 continue;
f7eb47b… lmata 151 }
f7eb47b… lmata 152 if (command === "run") {
f7eb47b… lmata 153 await runTests(options, testServerConnection);
f7eb47b… lmata 154 lastRun = { type: "regular" };
f7eb47b… lmata 155 continue;
f7eb47b… lmata 156 }
f7eb47b… lmata 157 if (command === "project") {
f7eb47b… lmata 158 const { selectedProjects } = await import_utilsBundle.enquirer.prompt({
f7eb47b… lmata 159 type: "multiselect",
f7eb47b… lmata 160 name: "selectedProjects",
f7eb47b… lmata 161 message: "Select projects",
f7eb47b… lmata 162 choices: projectNames
f7eb47b… lmata 163 }).catch(() => ({ selectedProjects: null }));
f7eb47b… lmata 164 if (!selectedProjects)
f7eb47b… lmata 165 continue;
f7eb47b… lmata 166 options.projects = selectedProjects.length ? selectedProjects : void 0;
f7eb47b… lmata 167 await runTests(options, testServerConnection);
f7eb47b… lmata 168 lastRun = { type: "regular" };
f7eb47b… lmata 169 continue;
f7eb47b… lmata 170 }
f7eb47b… lmata 171 if (command === "file") {
f7eb47b… lmata 172 const { filePattern } = await import_utilsBundle.enquirer.prompt({
f7eb47b… lmata 173 type: "text",
f7eb47b… lmata 174 name: "filePattern",
f7eb47b… lmata 175 message: "Input filename pattern (regex)"
f7eb47b… lmata 176 }).catch(() => ({ filePattern: null }));
f7eb47b… lmata 177 if (filePattern === null)
f7eb47b… lmata 178 continue;
f7eb47b… lmata 179 if (filePattern.trim())
f7eb47b… lmata 180 options.files = filePattern.split(" ");
f7eb47b… lmata 181 else
f7eb47b… lmata 182 options.files = void 0;
f7eb47b… lmata 183 await runTests(options, testServerConnection);
f7eb47b… lmata 184 lastRun = { type: "regular" };
f7eb47b… lmata 185 continue;
f7eb47b… lmata 186 }
f7eb47b… lmata 187 if (command === "grep") {
f7eb47b… lmata 188 const { testPattern } = await import_utilsBundle.enquirer.prompt({
f7eb47b… lmata 189 type: "text",
f7eb47b… lmata 190 name: "testPattern",
f7eb47b… lmata 191 message: "Input test name pattern (regex)"
f7eb47b… lmata 192 }).catch(() => ({ testPattern: null }));
f7eb47b… lmata 193 if (testPattern === null)
f7eb47b… lmata 194 continue;
f7eb47b… lmata 195 if (testPattern.trim())
f7eb47b… lmata 196 options.grep = testPattern;
f7eb47b… lmata 197 else
f7eb47b… lmata 198 options.grep = void 0;
f7eb47b… lmata 199 await runTests(options, testServerConnection);
f7eb47b… lmata 200 lastRun = { type: "regular" };
f7eb47b… lmata 201 continue;
f7eb47b… lmata 202 }
f7eb47b… lmata 203 if (command === "failed") {
f7eb47b… lmata 204 const failedTestIds = teleSuiteUpdater.rootSuite.allTests().filter((t) => !t.ok()).map((t) => t.id);
f7eb47b… lmata 205 await runTests({}, testServerConnection, { title: "running failed tests", testIds: failedTestIds });
f7eb47b… lmata 206 lastRun = { type: "failed", failedTestIds };
f7eb47b… lmata 207 continue;
f7eb47b… lmata 208 }
f7eb47b… lmata 209 if (command === "repeat") {
f7eb47b… lmata 210 if (lastRun.type === "regular") {
f7eb47b… lmata 211 await runTests(options, testServerConnection, { title: "re-running tests" });
f7eb47b… lmata 212 continue;
f7eb47b… lmata 213 } else if (lastRun.type === "changed") {
f7eb47b… lmata 214 await runTests(options, testServerConnection, { title: "re-running tests", testIds: lastRun.dirtyTestIds });
f7eb47b… lmata 215 } else if (lastRun.type === "failed") {
f7eb47b… lmata 216 await runTests({}, testServerConnection, { title: "re-running tests", testIds: lastRun.failedTestIds });
f7eb47b… lmata 217 }
f7eb47b… lmata 218 continue;
f7eb47b… lmata 219 }
f7eb47b… lmata 220 if (command === "toggle-show-browser") {
f7eb47b… lmata 221 await toggleShowBrowser();
f7eb47b… lmata 222 continue;
f7eb47b… lmata 223 }
f7eb47b… lmata 224 if (command === "toggle-buffer-mode") {
f7eb47b… lmata 225 bufferMode = !bufferMode;
f7eb47b… lmata 226 continue;
f7eb47b… lmata 227 }
f7eb47b… lmata 228 if (command === "exit")
f7eb47b… lmata 229 break;
f7eb47b… lmata 230 if (command === "interrupted") {
f7eb47b… lmata 231 result = "interrupted";
f7eb47b… lmata 232 break;
f7eb47b… lmata 233 }
f7eb47b… lmata 234 }
f7eb47b… lmata 235 const teardown = await testServerConnection.runGlobalTeardown({});
f7eb47b… lmata 236 return result === "passed" ? teardown.status : result;
f7eb47b… lmata 237 }
f7eb47b… lmata 238 function readKeyPress(handler) {
f7eb47b… lmata 239 const promise = new import_utils.ManualPromise();
f7eb47b… lmata 240 const rl = import_readline.default.createInterface({ input: process.stdin, escapeCodeTimeout: 50 });
f7eb47b… lmata 241 import_readline.default.emitKeypressEvents(process.stdin, rl);
f7eb47b… lmata 242 if (process.stdin.isTTY)
f7eb47b… lmata 243 process.stdin.setRawMode(true);
f7eb47b… lmata 244 const listener = import_utils.eventsHelper.addEventListener(process.stdin, "keypress", (text, key) => {
f7eb47b… lmata 245 const result = handler(text, key);
f7eb47b… lmata 246 if (result)
f7eb47b… lmata 247 promise.resolve(result);
f7eb47b… lmata 248 });
f7eb47b… lmata 249 const dispose = () => {
f7eb47b… lmata 250 import_utils.eventsHelper.removeEventListeners([listener]);
f7eb47b… lmata 251 rl.close();
f7eb47b… lmata 252 if (process.stdin.isTTY)
f7eb47b… lmata 253 process.stdin.setRawMode(false);
f7eb47b… lmata 254 };
f7eb47b… lmata 255 void promise.finally(dispose);
f7eb47b… lmata 256 return { result: promise, dispose };
f7eb47b… lmata 257 }
f7eb47b… lmata 258 const isInterrupt = (text, key) => text === "" || text === "\x1B" || key && key.name === "escape" || key && key.ctrl && key.name === "c";
f7eb47b… lmata 259 async function runTests(watchOptions, testServerConnection, options) {
f7eb47b… lmata 260 printConfiguration(watchOptions, options?.title);
f7eb47b… lmata 261 const waitForDone = readKeyPress((text, key) => {
f7eb47b… lmata 262 if (isInterrupt(text, key)) {
f7eb47b… lmata 263 testServerConnection.stopTestsNoReply({});
f7eb47b… lmata 264 return "done";
f7eb47b… lmata 265 }
f7eb47b… lmata 266 });
f7eb47b… lmata 267 await testServerConnection.runTests({
f7eb47b… lmata 268 grep: watchOptions.grep,
f7eb47b… lmata 269 testIds: options?.testIds,
f7eb47b… lmata 270 locations: watchOptions?.files ?? [],
f7eb47b… lmata 271 // TODO: always collect locations based on knowledge about tree, so that we don't have to load all tests
f7eb47b… lmata 272 projects: watchOptions.projects,
f7eb47b… lmata 273 connectWsEndpoint,
f7eb47b… lmata 274 reuseContext: connectWsEndpoint ? true : void 0,
f7eb47b… lmata 275 workers: connectWsEndpoint ? 1 : void 0,
f7eb47b… lmata 276 headed: connectWsEndpoint ? true : void 0
f7eb47b… lmata 277 }).finally(() => waitForDone.dispose());
f7eb47b… lmata 278 }
f7eb47b… lmata 279 function readCommand() {
f7eb47b… lmata 280 return readKeyPress((text, key) => {
f7eb47b… lmata 281 if (isInterrupt(text, key))
f7eb47b… lmata 282 return "interrupted";
f7eb47b… lmata 283 if (process.platform !== "win32" && key && key.ctrl && key.name === "z") {
f7eb47b… lmata 284 process.kill(process.ppid, "SIGTSTP");
f7eb47b… lmata 285 process.kill(process.pid, "SIGTSTP");
f7eb47b… lmata 286 }
f7eb47b… lmata 287 const name = key?.name;
f7eb47b… lmata 288 if (name === "q")
f7eb47b… lmata 289 return "exit";
f7eb47b… lmata 290 if (name === "h") {
f7eb47b… lmata 291 process.stdout.write(`${(0, import_base.separator)(import_base.terminalScreen)}
f7eb47b… lmata 292 Run tests
f7eb47b… lmata 293 ${import_utils2.colors.bold("enter")} ${import_utils2.colors.dim("run tests")}
f7eb47b… lmata 294 ${import_utils2.colors.bold("f")} ${import_utils2.colors.dim("run failed tests")}
f7eb47b… lmata 295 ${import_utils2.colors.bold("r")} ${import_utils2.colors.dim("repeat last run")}
f7eb47b… lmata 296 ${import_utils2.colors.bold("q")} ${import_utils2.colors.dim("quit")}
f7eb47b… lmata 297
f7eb47b… lmata 298 Change settings
f7eb47b… lmata 299 ${import_utils2.colors.bold("c")} ${import_utils2.colors.dim("set project")}
f7eb47b… lmata 300 ${import_utils2.colors.bold("p")} ${import_utils2.colors.dim("set file filter")}
f7eb47b… lmata 301 ${import_utils2.colors.bold("t")} ${import_utils2.colors.dim("set title filter")}
f7eb47b… lmata 302 ${import_utils2.colors.bold("s")} ${import_utils2.colors.dim("toggle show & reuse the browser")}
f7eb47b… lmata 303 ${import_utils2.colors.bold("b")} ${import_utils2.colors.dim("toggle buffer mode")}
f7eb47b… lmata 304 `);
f7eb47b… lmata 305 return;
f7eb47b… lmata 306 }
f7eb47b… lmata 307 switch (name) {
f7eb47b… lmata 308 case "return":
f7eb47b… lmata 309 return "run";
f7eb47b… lmata 310 case "r":
f7eb47b… lmata 311 return "repeat";
f7eb47b… lmata 312 case "c":
f7eb47b… lmata 313 return "project";
f7eb47b… lmata 314 case "p":
f7eb47b… lmata 315 return "file";
f7eb47b… lmata 316 case "t":
f7eb47b… lmata 317 return "grep";
f7eb47b… lmata 318 case "f":
f7eb47b… lmata 319 return "failed";
f7eb47b… lmata 320 case "s":
f7eb47b… lmata 321 return "toggle-show-browser";
f7eb47b… lmata 322 case "b":
f7eb47b… lmata 323 return "toggle-buffer-mode";
f7eb47b… lmata 324 }
f7eb47b… lmata 325 });
f7eb47b… lmata 326 }
f7eb47b… lmata 327 let showBrowserServer;
f7eb47b… lmata 328 let connectWsEndpoint = void 0;
f7eb47b… lmata 329 let seq = 1;
f7eb47b… lmata 330 function printConfiguration(options, title) {
f7eb47b… lmata 331 const packageManagerCommand = (0, import_utils.getPackageManagerExecCommand)();
f7eb47b… lmata 332 const tokens = [];
f7eb47b… lmata 333 tokens.push(`${packageManagerCommand} playwright test`);
f7eb47b… lmata 334 if (options.projects)
f7eb47b… lmata 335 tokens.push(...options.projects.map((p) => import_utils2.colors.blue(`--project ${p}`)));
f7eb47b… lmata 336 if (options.grep)
f7eb47b… lmata 337 tokens.push(import_utils2.colors.red(`--grep ${options.grep}`));
f7eb47b… lmata 338 if (options.files)
f7eb47b… lmata 339 tokens.push(...options.files.map((a) => import_utils2.colors.bold(a)));
f7eb47b… lmata 340 if (title)
f7eb47b… lmata 341 tokens.push(import_utils2.colors.dim(`(${title})`));
f7eb47b… lmata 342 tokens.push(import_utils2.colors.dim(`#${seq++}`));
f7eb47b… lmata 343 const lines = [];
f7eb47b… lmata 344 const sep = (0, import_base.separator)(import_base.terminalScreen);
f7eb47b… lmata 345 lines.push("\x1Bc" + sep);
f7eb47b… lmata 346 lines.push(`${tokens.join(" ")}`);
f7eb47b… lmata 347 lines.push(`${import_utils2.colors.dim("Show & reuse browser:")} ${import_utils2.colors.bold(showBrowserServer ? "on" : "off")}`);
f7eb47b… lmata 348 process.stdout.write(lines.join("\n"));
f7eb47b… lmata 349 }
f7eb47b… lmata 350 function printBufferPrompt(dirtyTestFiles, rootDir) {
f7eb47b… lmata 351 const sep = (0, import_base.separator)(import_base.terminalScreen);
f7eb47b… lmata 352 process.stdout.write("\x1Bc");
f7eb47b… lmata 353 process.stdout.write(`${sep}
f7eb47b… lmata 354 `);
f7eb47b… lmata 355 if (dirtyTestFiles.size === 0) {
f7eb47b… lmata 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.")}
f7eb47b… lmata 357
f7eb47b… lmata 358 `);
f7eb47b… lmata 359 return;
f7eb47b… lmata 360 }
f7eb47b… lmata 361 process.stdout.write(`${import_utils2.colors.dim(`${dirtyTestFiles.size} test ${dirtyTestFiles.size === 1 ? "file" : "files"} changed:`)}
f7eb47b… lmata 362
f7eb47b… lmata 363 `);
f7eb47b… lmata 364 for (const file of dirtyTestFiles)
f7eb47b… lmata 365 process.stdout.write(` \xB7 ${import_path.default.relative(rootDir, file)}
f7eb47b… lmata 366 `);
f7eb47b… lmata 367 process.stdout.write(`
f7eb47b… lmata 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.")}
f7eb47b… lmata 369
f7eb47b… lmata 370 `);
f7eb47b… lmata 371 }
f7eb47b… lmata 372 function printPrompt() {
f7eb47b… lmata 373 const sep = (0, import_base.separator)(import_base.terminalScreen);
f7eb47b… lmata 374 process.stdout.write(`
f7eb47b… lmata 375 ${sep}
f7eb47b… lmata 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.")}
f7eb47b… lmata 377 `);
f7eb47b… lmata 378 }
f7eb47b… lmata 379 async function toggleShowBrowser() {
f7eb47b… lmata 380 if (!showBrowserServer) {
f7eb47b… lmata 381 showBrowserServer = new import_playwrightServer.PlaywrightServer({ mode: "extension", path: "/" + (0, import_utils.createGuid)(), maxConnections: 1 });
f7eb47b… lmata 382 connectWsEndpoint = await showBrowserServer.listen();
f7eb47b… lmata 383 process.stdout.write(`${import_utils2.colors.dim("Show & reuse browser:")} ${import_utils2.colors.bold("on")}
f7eb47b… lmata 384 `);
f7eb47b… lmata 385 } else {
f7eb47b… lmata 386 await showBrowserServer?.close();
f7eb47b… lmata 387 showBrowserServer = void 0;
f7eb47b… lmata 388 connectWsEndpoint = void 0;
f7eb47b… lmata 389 process.stdout.write(`${import_utils2.colors.dim("Show & reuse browser:")} ${import_utils2.colors.bold("off")}
f7eb47b… lmata 390 `);
f7eb47b… lmata 391 }
f7eb47b… lmata 392 }
f7eb47b… lmata 393 // Annotate the CommonJS export names for ESM import in node:
f7eb47b… lmata 394 0 && (module.exports = {
f7eb47b… lmata 395 runWatchModeLoop
f7eb47b… lmata 396 });

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button