Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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]:");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks really odd on its own. Maybe we could add some text to this, like this?

Suggested change
console.log("[replay.io]:");
console.log("[replay.io]: Completed");

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it looks odd since we already output some (almost) empty lines like this. I see this line as padding.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This padding always bothered me - I intuitively expected to find some extra text below it. I think Brian had similar sentiment since he removed this recently here.

Perhaps it's the fact that this line is not completely empty (it has our prefix) makes is weird to me 🤷‍♂️

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer if this were just be an empty line :) but it's at least better this way than for Playwright to trim it off.

hbenl marked this conversation as resolved.
Show resolved Hide resolved
} finally {
await Promise.all([mixpanelAPI.close().catch(noop), logger.close().catch(noop)]);
}
Expand Down