From c63c427727434e28cc5a3dfc7f90ae0cb020eded Mon Sep 17 00:00:00 2001 From: Justin Halsall Date: Fri, 5 Jul 2024 10:46:00 +0200 Subject: [PATCH] chore: reduce flakey test due to '[vite] connected' message (#1525) --- .changeset/two-boats-boil.md | 2 ++ packages/rrweb/test/utils.ts | 14 +++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 .changeset/two-boats-boil.md diff --git a/.changeset/two-boats-boil.md b/.changeset/two-boats-boil.md new file mode 100644 index 0000000000..a845151cc8 --- /dev/null +++ b/.changeset/two-boats-boil.md @@ -0,0 +1,2 @@ +--- +--- diff --git a/packages/rrweb/test/utils.ts b/packages/rrweb/test/utils.ts index 90d4a8bd3c..03dcfd06ca 100644 --- a/packages/rrweb/test/utils.ts +++ b/packages/rrweb/test/utils.ts @@ -111,9 +111,17 @@ export function stringifySnapshots(snapshots: eventWithTime[]): string { snapshots .filter((s) => { if ( - s.type === EventType.IncrementalSnapshot && - (s.data.source === IncrementalSource.MouseMove || - s.data.source === IncrementalSource.ViewportResize) + // mouse move or viewport resize can happen on accidental user interference + // so we ignore them + (s.type === EventType.IncrementalSnapshot && + (s.data.source === IncrementalSource.MouseMove || + s.data.source === IncrementalSource.ViewportResize)) || + // ignore '[vite] connected' messages from vite + (s.type === EventType.Plugin && + s.data.plugin === 'rrweb/console@1' && + (s.data.payload as { payload: string[] })?.payload?.find((msg) => + msg.includes('[vite] connected'), + )) ) { return false; }