buildkite / terminal-to-html

Converts arbitrary shell output (with ANSI) into beautifully rendered HTML
http://buildkite.github.io/terminal-to-html
MIT License
642 stars 45 forks source link

Incorrect output for `playwright` output - lines being incorrectly removed #127

Closed BPScott closed 4 months ago

BPScott commented 5 months ago

When https://playwright.dev/ detects a TTY it will use control codes to erase current output and replace it with new output

This lets it print what test is currently underway when it starts:

     1 [chromium] › one-page/happy-path.spec.ts:4:5 › [redesign] Happy path

And then replace that line with a line containing a status and duration when it finishes

  ✓  1 [chromium] › one-page/happy-path.spec.ts:4:5 › [redesign] Happy path (15.8s)

Unfortunately running this on buildkite results seems to result in incorrect output, regarding the cursor control signals. Multiple prior lines are erased and instead of seeing a line per test, I see a mangled output of part of the final line.

Given the Raw CI log:

$ npx playwright test --config=app/tests/e2e/config/playwright.config.prod.ts --project=chromium -g c1
_bk;t=1706575117741Starting the run with 8 tests
_bk;t=1706575117741
_bk;t=1706575117741Running 8 tests using 1 worker, shard 1 of 2
_bk;t=1706575117741
_bk;t=1706575118071     1 [chromium] › c1/default/checkout.spec.ts:3:5 › checkout default flow
_bk;t=1706575129980_bk;t=1706575129980  ✓  1 [chromium] › c1/default/checkout.spec.ts:3:5 › checkout default flow (11.7s)     2 [chromium] › c1/default/checkout.spec.ts:40:5 › checkout default flow with phone number
_bk;t=1706575144169_bk;t=1706575144169  ✓  2 [chromium] › c1/default/checkout.spec.ts:40:5 › checkout default flow with phone number (14.2s)     3 [chromium] › c1/default/checkout.spec.ts:77:5 › checkout default flow with digital product
_bk;t=1706575156277_bk;t=1706575156277  ✓  3 [chromium] › c1/default/checkout.spec.ts:77:5 › checkout default flow with digital product (12.1s)     4 [chromium] › c1/default/checkout.spec.ts:109:5 › checkout default flow with free digital product
_bk;t=1706575165823_bk;t=1706575165823  ✓  4 [chromium] › c1/default/checkout.spec.ts:109:5 › checkout default flow with free digital product (9.5s)     5 [chromium] › c1/default/checkout.spec.ts:133:5 › checkout default flow with free physical product
_bk;t=1706575177303_bk;t=1706575177303  ✓  5 [chromium] › c1/default/checkout.spec.ts:133:5 › checkout default flow with free physical product (11.6s)     6 [chromium] › c1/default/checkout.spec.ts:162:5 › checkout default flow with a manual payment
_bk;t=1706575193194_bk;t=1706575193194  ✓  6 [chromium] › c1/default/checkout.spec.ts:162:5 › checkout default flow with a manual payment (15.9s)     7 [chromium] › c1/default/checkout.spec.ts:197:5 › checkout default flow with a custom payment
_bk;t=1706575205691_bk;t=1706575205691  ✓  7 [chromium] › c1/default/checkout.spec.ts:197:5 › checkout default flow with a custom payment (12.5s)     8 [chromium] › c1/default/duplicate-tabs.spec.ts:4:6 › checkout with duplicate tabs
_bk;t=1706575205691_bk;t=1706575205691  -  8 [chromium] › c1/default/duplicate-tabs.spec.ts:4:6 › checkout with duplicate tabsFinished test run: passed
_bk;t=1706575205958
_bk;t=1706575205958  1 skipped
_bk;t=1706575205958  7 passed (1.6m)
_bk;t=1706575205978
Done in 96.34s.

Results in the visible output:

  | $ npx playwright test --config=app/tests/e2e/config/playwright.config.prod.ts --project=chromium -g c1
  | Starting the run with 8 tests
  |  
  | Running 8 tests using 1 worker, shard 1 of 2
  |  
  | -  8 [chromium] › c1/default/duplicate-tabs.spec.ts:4:6 › checkout with duplicate tabs[1EFinished test run: passed
  |  
  | 1 skipped
  | 7 passed (1.6m)
  | Done in 96.34s.

I would expect this to look something like


  | $ npx playwright test --config=app/tests/e2e/config/playwright.config.prod.ts --project=chromium -g c1
  | Starting the run with 8 tests
  |  
  | Running 8 tests using 1 worker, shard 1 of 2
  |  
  | ✓  1 [chromium] › c1/default/checkout.spec.ts:3:5 › checkout default flow (11.7s)
  | ✓  2 [chromium] › c1/default/checkout.spec.ts:40:5 › checkout default flow with phone number (14.2s)
  | ✓  3 [chromium] › c1/default/checkout.spec.ts:77:5 › checkout default flow with digital product (12.1s)
  | ✓  4 [chromium] › c1/default/checkout.spec.ts:109:5 › checkout default flow with free digital product (9.5s)
  | ✓  5 [chromium] › c1/default/checkout.spec.ts:133:5 › checkout default flow with free physical product (11.6s)
  | ✓  6 [chromium] › c1/default/checkout.spec.ts:162:5 › checkout default flow with a manual payment (15.9s)
  | ✓  7 [chromium] › c1/default/checkout.spec.ts:197:5 › checkout default flow with a custom payment (12.5s)
  | -  8 [chromium] › c1/default/duplicate-tabs.spec.ts:4:6 › checkout with duplicate tabs
  | Finished test run: pass
  |  
  | 1 skipped
  | 7 passed (1.6m)
  | Done