diff --git a/emoji.js b/emoji.js index 644a900..335af61 100644 --- a/emoji.js +++ b/emoji.js @@ -1,4 +1,4 @@ "use strict"; console.log( - Array.from({ length: 14000 }, (_, i) => String.fromCodePoint(i)).join("") + Array.from({ length: 14000 }, (_, i) => String.fromCodePoint(i)).join(""), ); diff --git a/get-cursor-position.js b/get-cursor-position.js index 0ddc7b5..b806c86 100644 --- a/get-cursor-position.js +++ b/get-cursor-position.js @@ -26,6 +26,6 @@ setTimeout(() => { WINDOW_POSITION, FOREGROUND_COLOR, BACKGROUND_COLOR, - ].join("") + ].join(""), ); }, 200); diff --git a/package-lock.json b/package-lock.json index 99b4a32..ee49e1f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,7 +20,7 @@ "@typescript-eslint/parser": "6.4.0", "eslint": "8.47.0", "eslint-plugin-vitest": "0.2.8", - "prettier": "2.7.1", + "prettier": "3.0.2", "typescript": "5.1.6", "vitest": "0.34.2" } @@ -2044,15 +2044,15 @@ } }, "node_modules/prettier": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.7.1.tgz", - "integrity": "sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.0.2.tgz", + "integrity": "sha512-o2YR9qtniXvwEZlOKbveKfDQVyqxbEIWn48Z8m3ZJjBjcCmUy3xZGIv+7AkaeuaTr6yPXJjwv07ZWlsWbEy1rQ==", "dev": true, "bin": { - "prettier": "bin-prettier.js" + "prettier": "bin/prettier.cjs" }, "engines": { - "node": ">=10.13.0" + "node": ">=14" }, "funding": { "url": "https://github.com/prettier/prettier?sponsor=1" diff --git a/package.json b/package.json index a27e102..f4a800b 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "@typescript-eslint/parser": "6.4.0", "eslint": "8.47.0", "eslint-plugin-vitest": "0.2.8", - "prettier": "2.7.1", + "prettier": "3.0.2", "typescript": "5.1.6", "vitest": "0.34.2" }, diff --git a/run-pty.js b/run-pty.js index 761cf3d..0170128 100755 --- a/run-pty.js +++ b/run-pty.js @@ -104,7 +104,7 @@ const CLEAR_REGEX = (() => { permutations([ ...items.slice(0, index), ...items.slice(index + 1), - ]).map((rest) => [first, ...rest]) + ]).map((rest) => [first, ...rest]), ); const variants = [ @@ -242,7 +242,7 @@ const summarizeLabels = (labels) => { return LABEL_GROUPS.flatMap((group, index) => { const previousLength = LABEL_GROUPS.slice(0, index).reduce( (sum, previousGroup) => sum + previousGroup.length, - 0 + 0, ); const currentLength = previousLength + group.length; return numLabels > previousLength @@ -252,7 +252,7 @@ const summarizeLabels = (labels) => { : []; }) .map((group) => - group.length === 1 ? group[0] : `${group[0]}-${group[group.length - 1]}` + group.length === 1 ? group[0] : `${group[0]}-${group[group.length - 1]}`, ) .join("/"); }; @@ -324,7 +324,7 @@ const killAllLabel = (commands) => const drawDashboardCommandLines = ( commands, selection, - { width, useSeparateKilledIndicator } + { width, useSeparateKilledIndicator }, ) => { const lines = commands.map((command) => { const [icon, status] = statusText(command.status, { @@ -344,7 +344,7 @@ const drawDashboardCommandLines = ( const widestStatus = Math.max( 0, - ...lines.map(({ status }) => (status === undefined ? 0 : status.length)) + ...lines.map(({ status }) => (status === undefined ? 0 : status.length)), ); return lines.map(({ label, icon, status, title }, index) => { @@ -368,7 +368,7 @@ const drawDashboardCommandLines = ( : `${separator}${truncatedEnd}`; return { line: `${start}${RESET_COLOR}${cursorHorizontalAbsolute( - startLength + 1 + startLength + 1, )}${CLEAR_RIGHT}${finalEnd}${RESET_COLOR}`, length, }; @@ -400,7 +400,7 @@ const drawDashboard = ({ { width, useSeparateKilledIndicator: autoExit.tag === "AutoExit", - } + }, ) .map(({ line }) => line) .join("\n"); @@ -426,7 +426,7 @@ const drawDashboard = ({ ? commands.some( (command) => command.status.tag === "Exit" && - (command.status.exitCode !== 0 || command.status.wasKilled) + (command.status.exitCode !== 0 || command.status.wasKilled), ) ? `${shortcut(KEYS.enter)} restart failed` : "" @@ -434,7 +434,7 @@ const drawDashboard = ({ ? `${shortcut(KEYS.enter)} restart exited` : "" : `${shortcut(KEYS.enter)} focus selected${pid}\n${shortcut( - KEYS.unselect + KEYS.unselect, )} unselect`; const sessionEnds = "The session ends automatically once all commands are "; @@ -446,7 +446,7 @@ const drawDashboard = ({ autoExit.maxParallel === 1 ? "command runs" : "commands run" } at a time.`, `${sessionEnds}${exitIndicator(0)}${cursorHorizontalAbsolute( - sessionEnds.length + ICON_WIDTH + 1 + sessionEnds.length + ICON_WIDTH + 1, )} ${bold("exit 0")}.`, ] .filter((x) => x !== undefined) @@ -473,14 +473,14 @@ const drawSummary = (commands) => { (command) => command.status.tag === "Exit" && command.status.exitCode === 0 && - !command.status.wasKilled + !command.status.wasKilled, ) ? "success" : commands.some( (command) => command.status.tag === "Exit" && command.status.exitCode !== 0 && - !command.status.wasKilled + !command.status.wasKilled, ) ? "failure" : "aborted"; @@ -514,7 +514,7 @@ const isDone = ({ commands, attemptedKillAll, autoExit }) => (command) => command.status.tag === "Exit" && command.status.exitCode === 0 && - !command.status.wasKilled + !command.status.wasKilled, )); /** @@ -617,7 +617,7 @@ const exitText = (commands, command, status, autoExit) => { status.wasKilled && autoExit.tag === "AutoExit" ? abortedIndicator : exitIndicator(status.exitCode), - command + command, ); const restart = autoExit.tag === "AutoExit" && status.exitCode === 0 && !status.wasKilled @@ -644,7 +644,7 @@ const exitTextAndHistory = ({ command, exitCode, numExited, numTotal }) => { return ` ${commandTitleOnlyWithIndicator(exitIndicator(exitCode), command)} ${cwdText(command)}${command.history}${CLEAR_DOWN}${newline}${bold( - `exit ${exitCode}` + `exit ${exitCode}`, )} ${dim(`(${numExited}/${numTotal} exited)`)} `.trimStart(); @@ -657,7 +657,7 @@ ${cwdText(command)}${command.history}${CLEAR_DOWN}${newline}${bold( */ const statusText = ( status, - { statusFromRules, useSeparateKilledIndicator } + { statusFromRules, useSeparateKilledIndicator }, ) => { switch (status.tag) { case "Waiting": @@ -706,7 +706,7 @@ const NOT_SIMPLE_LOG_ESCAPE_RAW = /(\x1B\[0?J)|\x1B\[(?:\d*[FLMST]|[su]|(?!(?:[01](?:;[01])?)?[fH]\x1B\[[02]?J)(?:\d+(?:;\d+)?)?[fH])|(?!\n\x1B\[1?A)(?:^|[^])\x1B\[\d*A/; const NOT_SIMPLE_LOG_ESCAPE = RegExp( `(${CLEAR_REGEX.source})|${NOT_SIMPLE_LOG_ESCAPE_RAW.source}`, - "g" + "g", ); // These escapes should be printed when they first occur, but not when @@ -841,9 +841,9 @@ const commandToPresentationName = (command) => ? "\\'" : /^[\w.,:/=@%+-]+$/.test(subPart) ? subPart - : `'${subPart}'` + : `'${subPart}'`, ) - .join("") + .join(""), ) .join(" "); @@ -862,7 +862,7 @@ const cmdEscapeMetaChars = (arg) => const cmdEscapeArg = (arg) => // https://qntm.org/cmd cmdEscapeMetaChars( - `"${arg.replace(/(\\*)"/g, '$1$1\\"').replace(/(\\+)$/, "$1$1")}"` + `"${arg.replace(/(\\*)"/g, '$1$1\\"').replace(/(\\+)$/, "$1$1")}"`, ); const AUTO_EXIT_REGEX = /^--auto-exit(?:=(\d+|auto))?$/; @@ -1040,7 +1040,7 @@ const commandDescriptionDecoder = Decode.fields( return { title: field( "title", - Decode.optional(Decode.string, commandToPresentationName(command)) + Decode.optional(Decode.string, commandToPresentationName(command)), ), cwd: field("cwd", Decode.optional(Decode.string, ".")), command, @@ -1054,19 +1054,19 @@ const commandDescriptionDecoder = Decode.fields( } catch (error) { throw Decode.DecoderError.at(error, key); } - }) + }), ), - [] - ) + [], + ), ), defaultStatus: field("defaultStatus", Decode.optional(statusDecoder)), killAllSequence: field( "killAllSequence", - Decode.optional(Decode.string, KEY_CODES.kill) + Decode.optional(Decode.string, KEY_CODES.kill), ), }; }, - { exact: "throw" } + { exact: "throw" }, ); /** @@ -1088,7 +1088,7 @@ function nonEmptyArray(decoder) { const statusDecoder = Decode.nullable( Decode.tuple([Decode.string, Decode.string]), - undefined + undefined, ); /** @@ -1184,7 +1184,7 @@ class Command { start({ needsToWait }) { if ("terminal" in this.status) { throw new Error( - `Cannot start command because the command is ${this.status.tag} with pid ${this.status.terminal.pid} for: ${this.title}` + `Cannot start command because the command is ${this.status.tag} with pid ${this.status.terminal.pid} for: ${this.title}`, ); } @@ -1240,7 +1240,7 @@ class Command { ) { part = rawPart.replace( CONPTY_CURSOR_MOVE, - CONPTY_CURSOR_MOVE_REPLACEMENT + CONPTY_CURSOR_MOVE_REPLACEMENT, ); this.windowsConptyCursorMoveWorkaround = false; } @@ -1312,7 +1312,7 @@ class Command { case "Waiting": case "Exit": throw new Error( - `Cannot kill ${this.status.tag} pty for: ${this.title}` + `Cannot kill ${this.status.tag} pty for: ${this.title}`, ); } } @@ -1341,7 +1341,7 @@ class Command { } else { if (this.historyAlternateScreen.length > MAX_HISTORY) { this.historyAlternateScreen = this.historyAlternateScreen.slice( - -MAX_HISTORY + -MAX_HISTORY, ); } } @@ -1381,7 +1381,7 @@ class Command { */ updateStatusFromRules(data) { const lastLine = getLastLine( - this.isOnAlternateScreen ? this.historyAlternateScreen : this.history + this.isOnAlternateScreen ? this.historyAlternateScreen : this.history, ); const lines = (lastLine + data).split(/(?:\r?\n|\r)/); @@ -1453,7 +1453,7 @@ const runInteractively = (commandDescriptions, autoExit) => { const printDataWithExtraText = ( command, data, - { ignoreAlternateScreen = false } = {} + { ignoreAlternateScreen = false } = {}, ) => { // Note: For a simple log (no complicating cursor movements or anything) we // can _always_ show extra text. Otherwise, it’s better not to print @@ -1467,8 +1467,8 @@ const runInteractively = (commandDescriptions, autoExit) => { // `RESTORE_CURSOR` to restore the current colors when done. process.stdout.write( `${SAVE_CURSOR}${cursorDown( - 1 - )}${RESET_COLOR}${CLEAR_LEFT}${CLEAR_DOWN}${RESTORE_CURSOR}` + 1, + )}${RESET_COLOR}${CLEAR_LEFT}${CLEAR_DOWN}${RESTORE_CURSOR}`, ); extraTextPrinted = false; } @@ -1516,7 +1516,7 @@ const runInteractively = (commandDescriptions, autoExit) => { "\n".repeat(1) + CLEAR_DOWN + extraText + - RESTORE_CURSOR + RESTORE_CURSOR, ); extraTextPrinted = true; } else { @@ -1533,7 +1533,7 @@ const runInteractively = (commandDescriptions, autoExit) => { helper( command.status.slow ? killingText(command.status.terminal.pid) - : runningText(command.status.terminal.pid) + : runningText(command.status.terminal.pid), ); return undefined; @@ -1558,7 +1558,7 @@ const runInteractively = (commandDescriptions, autoExit) => { newlines + (command.status.tag === "Waiting" ? waitingText(commands) - : exitText(commands, command, command.status, autoExit)) + : exitText(commands, command, command.status, autoExit)), ); extraTextPrinted = false; @@ -1606,14 +1606,14 @@ const runInteractively = (commandDescriptions, autoExit) => { .map((line, index) => line === previousRender[index] ? "" - : cursorAbsolute(index + 1, 1) + CLEAR_RIGHT + line + : cursorAbsolute(index + 1, 1) + CLEAR_RIGHT + line, ) .join("") + Array.from( { length: numLinesToClear }, (_, index) => - cursorAbsolute(currentRender.length + index + 1, 1) + CLEAR_RIGHT - ).join("") + cursorAbsolute(currentRender.length + index + 1, 1) + CLEAR_RIGHT, + ).join(""), ); }; @@ -1634,7 +1634,7 @@ const runInteractively = (commandDescriptions, autoExit) => { DISABLE_APPLICATION_CURSOR_KEYS + DISABLE_MOUSE + RESET_COLOR + - CLEAR + CLEAR, ); extraTextPrinted = false; @@ -1658,7 +1658,7 @@ const runInteractively = (commandDescriptions, autoExit) => { const killAll = () => { attemptedKillAll = true; const notExited = commands.filter( - (command) => "terminal" in command.status + (command) => "terminal" in command.status, ); if (notExited.length === 0) { switchToDashboard({ forceClearScrollback: true }); @@ -1682,7 +1682,7 @@ const runInteractively = (commandDescriptions, autoExit) => { if (autoExit.tag === "AutoExit") { if (!(status.exitCode === 0 && !status.wasKilled)) { const numRunning = commands.filter( - (command2) => "terminal" in command2.status + (command2) => "terminal" in command2.status, ).length; attemptedKillAll = false; command.start({ @@ -1705,11 +1705,11 @@ const runInteractively = (commandDescriptions, autoExit) => { const exited = commands.filter( (command) => command.status.tag === "Exit" && - (command.status.exitCode !== 0 || command.status.wasKilled) + (command.status.exitCode !== 0 || command.status.wasKilled), ); if (exited.length > 0) { const numRunning = commands.filter( - (command2) => "terminal" in command2.status + (command2) => "terminal" in command2.status, ).length; attemptedKillAll = false; for (const [index, command] of exited.entries()) { @@ -1720,7 +1720,7 @@ const runInteractively = (commandDescriptions, autoExit) => { } } else { const exited = commands.filter( - (command) => command.status.tag === "Exit" + (command) => command.status.tag === "Exit", ); if (exited.length > 0) { attemptedKillAll = false; @@ -1770,7 +1770,7 @@ const runInteractively = (commandDescriptions, autoExit) => { case "Waiting": case "Exit": throw new Error( - `Received unexpected output from ${command.status.tag} pty for: ${command.title}\n${data}` + `Received unexpected output from ${command.status.tag} pty for: ${command.title}\n${data}`, ); } } @@ -1794,12 +1794,12 @@ const runInteractively = (commandDescriptions, autoExit) => { if (isDone({ commands, attemptedKillAll, autoExit })) { switchToDashboard({ forceClearScrollback: true }); process.exit( - autoExit.tag === "AutoExit" && attemptedKillAll ? 1 : 0 + autoExit.tag === "AutoExit" && attemptedKillAll ? 1 : 0, ); } const nextWaitingIndex = commands.findIndex( - (command) => command.status.tag === "Waiting" + (command) => command.status.tag === "Waiting", ); if (nextWaitingIndex !== -1 && !attemptedKillAll) { commands[nextWaitingIndex].start({ needsToWait: false }); @@ -1828,7 +1828,7 @@ const runInteractively = (commandDescriptions, autoExit) => { return undefined; } }, - }) + }), ); process.stdout.on("resize", () => { @@ -1836,7 +1836,7 @@ const runInteractively = (commandDescriptions, autoExit) => { if ("terminal" in command.status) { command.status.terminal.resize( process.stdout.columns, - process.stdout.rows + process.stdout.rows, ); } } @@ -1875,7 +1875,7 @@ const runInteractively = (commandDescriptions, autoExit) => { ).split("\n").length; const likelyRow = Math.min(numLines, process.stdout.rows); command.status.terminal.write( - part.replace(CURSOR_POSITION_RESPONSE, `$1${likelyRow};1R`) + part.replace(CURSOR_POSITION_RESPONSE, `$1${likelyRow};1R`), ); break; } @@ -1899,7 +1899,7 @@ const runInteractively = (commandDescriptions, autoExit) => { setSelection, killAll, restart, - restartExited + restartExited, ); } } @@ -1907,7 +1907,7 @@ const runInteractively = (commandDescriptions, autoExit) => { process.on("exit", () => { process.stdout.write( - SHOW_CURSOR + DISABLE_BRACKETED_PASTE_MODE + DISABLE_MOUSE + RESET_COLOR + SHOW_CURSOR + DISABLE_BRACKETED_PASTE_MODE + DISABLE_MOUSE + RESET_COLOR, ); }); @@ -1947,7 +1947,7 @@ const onStdin = ( setSelection, killAll, restart, - restartExited + restartExited, ) => { switch (current.tag) { case "Command": { @@ -2051,7 +2051,7 @@ const onStdin = ( default: { const commandIndex = commands.findIndex( - (command) => command.label === data + (command) => command.label === data, ); if (commandIndex !== -1) { switchToCommand(commandIndex, { hideSelection: true }); @@ -2065,7 +2065,7 @@ const onStdin = ( const index = getCommandIndexFromMousePosition( commands, - mousePosition + mousePosition, ); switch (mousePosition.type) { @@ -2122,7 +2122,7 @@ const getCommandIndexFromMousePosition = (commands, { x, y }) => { { width: process.stdout.columns, useSeparateKilledIndicator: false, - } + }, ); if (y >= 0 && y < lines.length) { @@ -2149,7 +2149,7 @@ const runNonInteractively = (commandDescriptions, maxParallel) => { const killAll = () => { attemptedKillAll = true; const notExited = commands.filter( - (command) => "terminal" in command.status + (command) => "terminal" in command.status, ); // Pressing ctrl+c prints `^C` to the terminal. Move the cursor back so we @@ -2164,7 +2164,7 @@ const runNonInteractively = (commandDescriptions, maxParallel) => { for (const command of notExited) { command.kill(); process.stdout.write( - `${commandTitleOnlyWithIndicator(killingIndicator, command)}\n\n` + `${commandTitleOnlyWithIndicator(killingIndicator, command)}\n\n`, ); } } @@ -2190,16 +2190,16 @@ const runNonInteractively = (commandDescriptions, maxParallel) => { }, onExit: (exitCode) => { const numRunning = commands.filter( - (command) => "terminal" in command.status + (command) => "terminal" in command.status, ).length; const numExit = commands.filter( - (command) => command.status.tag === "Exit" + (command) => command.status.tag === "Exit", ).length; const numExit0 = commands.filter( (command) => command.status.tag === "Exit" && command.status.exitCode === 0 && - !command.status.wasKilled + !command.status.wasKilled, ).length; process.stdout.write( @@ -2208,7 +2208,7 @@ const runNonInteractively = (commandDescriptions, maxParallel) => { exitCode, numExited: numExit, numTotal: commands.length, - }) + }), ); // Exit the whole program if all commands have exited. @@ -2221,13 +2221,13 @@ const runNonInteractively = (commandDescriptions, maxParallel) => { } const nextWaitingIndex = commands.findIndex( - (command) => command.status.tag === "Waiting" + (command) => command.status.tag === "Waiting", ); if (nextWaitingIndex !== -1 && !attemptedKillAll) { const command = commands[nextWaitingIndex]; command.start({ needsToWait: false }); process.stdout.write( - `${commandTitleOnlyWithIndicator(runningIndicator, command)}\n\n` + `${commandTitleOnlyWithIndicator(runningIndicator, command)}\n\n`, ); } @@ -2243,7 +2243,7 @@ const runNonInteractively = (commandDescriptions, maxParallel) => { if ("terminal" in command.status) { command.status.terminal.resize( process.stdout.columns, - process.stdout.rows + process.stdout.rows, ); } } @@ -2257,8 +2257,8 @@ const runNonInteractively = (commandDescriptions, maxParallel) => { process.stdout.write( `${commandTitleOnlyWithIndicator( needsToWait ? waitingIndicator : runningIndicator, - command - )}\n\n` + command, + )}\n\n`, ); } }; @@ -2322,11 +2322,11 @@ const run = () => { } else if (parseResult.autoExit.tag === "AutoExit") { runNonInteractively( parseResult.commands, - parseResult.autoExit.maxParallel + parseResult.autoExit.maxParallel, ); } else { console.error( - "run-pty requires stdin to be a TTY to run properly (unless --auto-exit is used)." + "run-pty requires stdin to be a TTY to run properly (unless --auto-exit is used).", ); process.exit(1); } diff --git a/test-clear.js b/test-clear.js index 42d5a8e..31ec013 100644 --- a/test-clear.js +++ b/test-clear.js @@ -10,19 +10,19 @@ const permutations = (items) => ? [items] : items.flatMap((first, index) => permutations([...items.slice(0, index), ...items.slice(index + 1)]).map( - (rest) => [first, ...rest] - ) + (rest) => [first, ...rest], + ), ); const variants = [ ...permutations(["\x1B[2J", "\x1B[3J", "\x1B[H"]).map((items) => - items.join("") + items.join(""), ), ...permutations(["\x1B[2J", "\x1B[3J", "\x1B[0;0f"]).map((items) => - items.join("") + items.join(""), ), ...permutations(["\x1B[2J", "\x1B[3J", "\x1B[1;1H"]).map((items) => - items.join("") + items.join(""), ), () => { process.stdout.write("\x1B[3J"); diff --git a/test-keys.js b/test-keys.js index 9e0426e..2262340 100644 --- a/test-keys.js +++ b/test-keys.js @@ -27,5 +27,5 @@ process.stdin.on( if (keypress.ctrl && keypress.name === "c") { process.exit(); } - } + }, ); diff --git a/test-split-color-codes.js b/test-split-color-codes.js index 5f4fa29..aba5533 100644 --- a/test-split-color-codes.js +++ b/test-split-color-codes.js @@ -36,7 +36,7 @@ async function run() { await waitMs(1); } process.stdout.write( - `Line ${index + 1} (${variation.length} variations)\x1B[0m\n` + `Line ${index + 1} (${variation.length} variations)\x1B[0m\n`, ); await waitMs(100); } diff --git a/test/run-pty.test.js b/test/run-pty.test.js index a31ce45..a26175a 100644 --- a/test/run-pty.test.js +++ b/test/run-pty.test.js @@ -183,7 +183,7 @@ describe("dashboard", () => { width = 80, attemptedKillAll = false, autoExit = { tag: "NoAutoExit" }, - } = {} + } = {}, ) { return replaceAnsi( drawDashboard({ @@ -192,7 +192,7 @@ describe("dashboard", () => { attemptedKillAll, autoExit, selection: { tag: "Invisible", index: 0 }, - }) + }), ); } @@ -211,7 +211,7 @@ describe("dashboard", () => { command: ["npm", "start"], status: { tag: "Exit", exitCode: 0, wasKilled: false }, }, - ]) + ]), ).toMatchInlineSnapshot(` ⧙[⧘⧙1⧘⧙]⧘ ⚪⧘ ⧙exit 0⧘ npm start⧘ @@ -232,8 +232,8 @@ describe("dashboard", () => { }, ], - { autoExit: { tag: "AutoExit", maxParallel: 3 } } - ) + { autoExit: { tag: "AutoExit", maxParallel: 3 } }, + ), ).toMatchInlineSnapshot(` ⧙[⧘⧙1⧘⧙]⧘ 🟢⧘ npm start⧘ @@ -256,8 +256,8 @@ describe("dashboard", () => { }, ], - { autoExit: { tag: "AutoExit", maxParallel: 1 } } - ) + { autoExit: { tag: "AutoExit", maxParallel: 1 } }, + ), ).toMatchInlineSnapshot(` ⧙[⧘⧙1⧘⧙]⧘ 🟢⧘ npm start⧘ @@ -280,8 +280,8 @@ describe("dashboard", () => { }, ], - { autoExit: { tag: "AutoExit", maxParallel: 2 } } - ) + { autoExit: { tag: "AutoExit", maxParallel: 2 } }, + ), ).toMatchInlineSnapshot(` ⧙[⧘⧙1⧘⧙]⧘ 🟢⧘ npm start⧘ @@ -309,8 +309,8 @@ describe("dashboard", () => { }, ], - { autoExit: { tag: "AutoExit", maxParallel: 3 } } - ) + { autoExit: { tag: "AutoExit", maxParallel: 3 } }, + ), ).toMatchInlineSnapshot(` ⧙[⧘⧙1⧘⧙]⧘ 🟢⧘ npm start⧘ ⧙[⧘⧙2⧘⧙]⧘ ⛔️⧘ ⧙exit 1⧘ npm run build⧘ @@ -339,8 +339,8 @@ describe("dashboard", () => { }, }, ], - { attemptedKillAll: true } - ) + { attemptedKillAll: true }, + ), ).toMatchInlineSnapshot(` ⧙[⧘⧙1⧘⧙]⧘ ⭕⧘ npm start⧘ @@ -368,8 +368,8 @@ describe("dashboard", () => { { attemptedKillAll: true, autoExit: { tag: "AutoExit", maxParallel: 3 }, - } - ) + }, + ), ).toMatchInlineSnapshot(` ⧙[⧘⧙1⧘⧙]⧘ ⭕⧘ npm start⧘ @@ -395,8 +395,8 @@ describe("dashboard", () => { { attemptedKillAll: true, autoExit: { tag: "AutoExit", maxParallel: 3 }, - } - ) + }, + ), ).toMatchInlineSnapshot(` ⧙[⧘⧙1⧘⧙]⧘ ⛔️⧘ ⧙exit 0⧘ npm start⧘␊ @@ -456,7 +456,7 @@ describe("dashboard", () => { title: "very long title for some reason that needs to be cut off at some point", }, - ]) + ]), ).toMatchInlineSnapshot(` ⧙[⧘⧙1⧘⧙]⧘ ⚪⧘ ⧙exit 0⧘ echo ./Some_script2.js -v '$end' '' \\'quoted\\''th|ng'\\' 'hel…⧘ ⧙[⧘⧙2⧘⧙]⧘ ⚪⧘ ⧙exit 130⧘ npm run server⧘ @@ -481,8 +481,8 @@ describe("dashboard", () => { tag: "Running", terminal: fakeTerminal({ pid: 9980 + i }), }, - })) - ) + })), + ), ).toMatchInlineSnapshot(` ⧙[⧘⧙1⧘⧙]⧘ 🟢⧘ echo 0⧘ ⧙[⧘⧙2⧘⧙]⧘ 🟢⧘ echo 1⧘ @@ -574,7 +574,7 @@ describe("summary", () => { command: ["npm", "start"], status: { tag: "Exit", exitCode: 0, wasKilled: false }, }, - ]) + ]), ).toMatchInlineSnapshot(` ⧙Summary – success:⧘ ⚪ ⧙exit 0⧘ npm start⧘ @@ -592,7 +592,7 @@ describe("summary", () => { command: ["npm", "test"], status: { tag: "Exit", exitCode: 1, wasKilled: false }, }, - ]) + ]), ).toMatchInlineSnapshot(` ⧙Summary – failure:⧘ ⚪ ⧙exit 0⧘ npm start⧘ @@ -611,7 +611,7 @@ describe("summary", () => { command: ["npm", "test"], status: { tag: "Exit", exitCode: 0, wasKilled: true }, }, - ]) + ]), ).toMatchInlineSnapshot(` ⧙Summary – aborted:⧘ ⚪ ⧙exit 0⧘ npm start⧘ @@ -634,7 +634,7 @@ describe("summary", () => { command: ["npm", "test"], status: { tag: "Exit", exitCode: 0, wasKilled: false }, }, - ]) + ]), ).toMatchInlineSnapshot(` ⧙Summary – failure:⧘ 🔴 ⧙exit 126⧘ npm start⧘ @@ -660,7 +660,7 @@ describe("focused command", () => { "Expected `titlePossiblyWithGraphicRenditions` not to be used", cwd, history: "", - }) + }), ); } @@ -669,8 +669,8 @@ describe("focused command", () => { render( (command) => historyStart(runningIndicator, command), "npm start", - "./" - ) + "./", + ), ).toMatchInlineSnapshot(` 🟢 npm start⧘␊ @@ -682,8 +682,8 @@ describe("focused command", () => { render( (command) => historyStart(runningIndicator, command), "frontend: npm start", - "web/frontend" - ) + "web/frontend", + ), ).toMatchInlineSnapshot(` 🟢 frontend: npm start⧘ 📂 ⧙web/frontend⧘␊ @@ -708,7 +708,7 @@ describe("focused command", () => { test("killing with cwd", () => { expect( - render(() => killingText(12345), "frontend: npm start", "web/frontend") + render(() => killingText(12345), "frontend: npm start", "web/frontend"), ).toMatchInlineSnapshot(` ⧙[⧘⧙ctrl+c⧘⧙]⧘ kill ⧙(double-press to force) (pid 12345)⧘ ⧙[⧘⧙ctrl+z⧘⧙]⧘ dashboard @@ -723,11 +723,11 @@ describe("focused command", () => { [], command, { tag: "Exit", exitCode: 0, wasKilled: false }, - { tag: "NoAutoExit" } + { tag: "NoAutoExit" }, ), "frontend: npm start", - "web/frontend" - ) + "web/frontend", + ), ).toMatchInlineSnapshot(` ⚪ frontend: npm start⧘ 📂 ⧙web/frontend⧘ @@ -747,11 +747,11 @@ describe("focused command", () => { [], command, { tag: "Exit", exitCode: 0, wasKilled: false }, - { tag: "NoAutoExit" } + { tag: "NoAutoExit" }, ), "frontend: npm start", - "." - ) + ".", + ), ).toMatchInlineSnapshot(` ⚪ frontend: npm start⧘ exit 0 @@ -773,11 +773,11 @@ describe("focused command", () => { { tag: "AutoExit", maxParallel: 3, - } + }, ), "frontend: npm start", - "." - ) + ".", + ), ).toMatchInlineSnapshot(` ⚪ frontend: npm start⧘ exit 0 @@ -798,12 +798,12 @@ describe("focused command", () => { { tag: "AutoExit", maxParallel: 3, - } + }, ), "frontend: npm start", - "." - ) + ".", + ), ).toMatchInlineSnapshot(` ⛔️ frontend: npm start⧘ exit 0 @@ -822,11 +822,11 @@ describe("focused command", () => { [], command, { tag: "Exit", exitCode: 1, wasKilled: false }, - { tag: "NoAutoExit" } + { tag: "NoAutoExit" }, ), "frontend: npm start", - "." - ) + ".", + ), ).toMatchInlineSnapshot(` 🔴 frontend: npm start⧘ exit 1 @@ -871,8 +871,8 @@ describe("exit text and history", () => { exitCode: 0, numExited: 1, numTotal: 1, - }) - ) + }), + ), ).toMatchInlineSnapshot(` ⚪ npm test⧘ ⧙exit 0⧘ ⧙(1/1 exited)⧘␊ @@ -893,8 +893,8 @@ describe("exit text and history", () => { exitCode: 1, numExited: 2, numTotal: 11, - }) - ) + }), + ), ).toMatchInlineSnapshot(` 🔴 npm test⧘ First line @@ -919,8 +919,8 @@ describe("exit text and history", () => { exitCode: 2, numExited: 11, numTotal: 11, - }) - ) + }), + ), ).toMatchInlineSnapshot(` 🔴 npm test⧘ 📂 ⧙web/frontend⧘ @@ -1018,7 +1018,7 @@ describe("parse args", () => { */ function parsedCommands( commands, - { autoExit = { tag: "NoAutoExit" } } = {} + { autoExit = { tag: "NoAutoExit" } } = {}, ) { return { tag: "Parsed", @@ -1035,7 +1035,7 @@ describe("parse args", () => { } expect(parseArgs(["%", "npm", "start"])).toStrictEqual( - parsedCommands([["npm", "start"]]) + parsedCommands([["npm", "start"]]), ); expect( @@ -1047,12 +1047,12 @@ describe("parse args", () => { "webpack-dev-server", "--entry", "/entry/file", - ]) + ]), ).toStrictEqual( parsedCommands([ ["npm", "start"], ["webpack-dev-server", "--entry", "/entry/file"], - ]) + ]), ); expect( @@ -1066,58 +1066,58 @@ describe("parse args", () => { "@", "ping", "localhost", - ]) + ]), ).toStrictEqual( parsedCommands([ ["./report_progress.bash", "--root", "/", "--unit", "%"], ["ping", "localhost"], - ]) + ]), ); expect(parseArgs(["+", "one", "+", "+", "+two", "+"])).toStrictEqual( - parsedCommands([["one"], ["+two"]]) + parsedCommands([["one"], ["+two"]]), ); expect(parseArgs(["-", "one", "-", "-two", "-"])).toStrictEqual( - parsedCommands([["one"], ["-two"]]) + parsedCommands([["one"], ["-two"]]), ); expect(parseArgs(["--", "one", "--", "--two", "--"])).toStrictEqual( - parsedCommands([["one"], ["--two"]]) + parsedCommands([["one"], ["--two"]]), ); expect(parseArgs(["---", "one", "---", "---two", "---"])).toStrictEqual( - parsedCommands([["one"], ["---two"]]) + parsedCommands([["one"], ["---two"]]), ); expect( - parseArgs(["--auto-exit", "%", "one", "%", "two", "--auto-exit"]) + parseArgs(["--auto-exit", "%", "one", "%", "two", "--auto-exit"]), ).toStrictEqual( parsedCommands([["one"], ["two", "--auto-exit"]], { autoExit: { tag: "AutoExit", maxParallel: os.cpus().length, }, - }) + }), ); expect( - parseArgs(["--auto-exit=234", "%", "one", "%", "two", "--auto-exit"]) + parseArgs(["--auto-exit=234", "%", "one", "%", "two", "--auto-exit"]), ).toStrictEqual( parsedCommands([["one"], ["two", "--auto-exit"]], { autoExit: { tag: "AutoExit", maxParallel: 234 }, - }) + }), ); expect( - parseArgs(["--auto-exit=auto", "%", "one", "%", "two", "--auto-exit"]) + parseArgs(["--auto-exit=auto", "%", "one", "%", "two", "--auto-exit"]), ).toStrictEqual( parsedCommands([["one"], ["two", "--auto-exit"]], { autoExit: { tag: "AutoExit", maxParallel: os.cpus().length, }, - }) + }), ); }); }); @@ -1263,7 +1263,7 @@ describe("--auto-exit runs", () => { const child = childProcess.spawnSync( "node", [path.join(__dirname, "..", "run-pty.js"), ...args], - { encoding: "utf8" } + { encoding: "utf8" }, ); expect(child.error).toBeUndefined();