Skip to content

Commit

Permalink
Add a trailing log line in case another playwright reporter removes o…
Browse files Browse the repository at this point in the history
…ur last line (#613)

* Add a trailing log line in case another playwright reporter removes our last line

* Update packages/playwright/src/reporter.ts

Co-authored-by: Mateusz Burzyński <[email protected]>

---------

Co-authored-by: Mateusz Burzyński <[email protected]>
  • Loading branch information
hbenl and Andarist authored Jul 9, 2024
1 parent 190165f commit 8cd22ea
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/empty-brooms-cross.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@replayio/playwright": patch
---

Add a trailing log line in case another playwright reporter removes our last line
13 changes: 13 additions & 0 deletions packages/playwright/src/reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,19 @@ export default class ReplayPlaywrightReporter implements Reporter {
console.warn(`[replay.io]: ${line}`);
});
}

// we need to output an extra line that is safe to be deleted
// Playwright's line reporter removes the last line here:
// https://github.com/microsoft/playwright/blob/0c11d6ed803db582a5508c70f89e55dc9a36c751/packages/playwright/src/reporters/line.ts#L91
//
// so if the user configured their reporters like this:
//
// reporters: [replayReporter({ upload: true }), ['line']]
//
// that can lead to removing *our* last log line
//
// the issue is tracked here: https://github.com/microsoft/playwright/issues/23875
console.log("[replay.io]:");
} finally {
await Promise.all([mixpanelAPI.close().catch(noop), logger.close().catch(noop)]);
}
Expand Down

0 comments on commit 8cd22ea

Please sign in to comment.