Skip to content

Commit 4f2f69d

Browse files
committed
fix(test-utils): Use strict inequality for timestamp filter
Change from >= to > when filtering buffered events. This prevents stale events from previous tests leaking through when they were buffered at the same millisecond as the new listener started. New events arriving after the listener is registered go through the callback directly (not the buffer), so they're unaffected by this filter.
1 parent d873831 commit 4f2f69d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

dev-packages/test-utils/src/event-proxy-server.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,12 @@ export async function startProxyServer(
138138

139139
eventCallbackListeners.add(callbackListener);
140140

141+
// Use strict inequality to prevent stale events from previous tests leaking through.
142+
// If a previous test's event was buffered at the same millisecond as this listener started,
143+
// we want to exclude it. New events arriving after the listener is registered go through
144+
// the callback directly (not the buffer), so they're not affected by this filter.
141145
eventBuffer.forEach(bufferedEvent => {
142-
if (bufferedEvent.timestamp >= listenerTimestamp) {
146+
if (bufferedEvent.timestamp > listenerTimestamp) {
143147
callbackListener(bufferedEvent.data);
144148
}
145149
});

0 commit comments

Comments
 (0)