Skip to content

Commit e0590bb

Browse files
authored
chore: reduce flakey test due to '[vite] connected' message (#1525)
1 parent 68076b7 commit e0590bb

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

.changeset/two-boats-boil.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---

packages/rrweb/test/utils.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,17 @@ export function stringifySnapshots(snapshots: eventWithTime[]): string {
110110
snapshots
111111
.filter((s) => {
112112
if (
113-
s.type === EventType.IncrementalSnapshot &&
114-
(s.data.source === IncrementalSource.MouseMove ||
115-
s.data.source === IncrementalSource.ViewportResize)
113+
// mouse move or viewport resize can happen on accidental user interference
114+
// so we ignore them
115+
(s.type === EventType.IncrementalSnapshot &&
116+
(s.data.source === IncrementalSource.MouseMove ||
117+
s.data.source === IncrementalSource.ViewportResize)) ||
118+
// ignore '[vite] connected' messages from vite
119+
(s.type === EventType.Plugin &&
120+
s.data.plugin === 'rrweb/console@1' &&
121+
(s.data.payload as { payload: string[] })?.payload?.find((msg) =>
122+
msg.includes('[vite] connected'),
123+
))
116124
) {
117125
return false;
118126
}

0 commit comments

Comments
 (0)