From aac006da5c0bbab17d2b79ff27d9a6fbde786de1 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 78c9ebcab4..15e4d30ea0 100644 --- a/packages/rrweb/test/utils.ts +++ b/packages/rrweb/test/utils.ts @@ -110,9 +110,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; }