From f82f04f2045a8411e2b4d10c24186e108e8a7c48 Mon Sep 17 00:00:00 2001 From: Simon Knott Date: Tue, 16 Jul 2024 16:31:41 +0200 Subject: [PATCH] refactor(list reporter): early-return if there's no TTY --- packages/playwright/src/reporters/list.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/playwright/src/reporters/list.ts b/packages/playwright/src/reporters/list.ts index 514541eab2..642826d884 100644 --- a/packages/playwright/src/reporters/list.ts +++ b/packages/playwright/src/reporters/list.ts @@ -94,18 +94,17 @@ class ListReporter extends BaseReporter { return; const testIndex = this._resultIndex.get(result) || ''; - if (!this._printSteps) { - if (isTTY) - this._updateLine(this._testRows.get(test)!, colors.dim(formatTestTitle(this.config, test, step)) + this._retrySuffix(result), this._testPrefix(testIndex, '')); + if (!isTTY) return; - } - if (isTTY) { + if (this._printSteps) { this._maybeWriteNewLine(); this._stepRows.set(step, this._lastRow); const prefix = this._testPrefix(this.getStepIndex(testIndex, result, step), ''); const line = test.title + colors.dim(stepSuffix(step)); this._appendLine(line, prefix); + } else { + this._updateLine(this._testRows.get(test)!, colors.dim(formatTestTitle(this.config, test, step)) + this._retrySuffix(result), this._testPrefix(testIndex, '')); } }