mirror of
https://github.com/morluto/rea.git
synced 2026-10-31 20:06:14 +00:00
Sample the browser monotonic clock with observation already subscribed, filter historical lifecycle and network facts, and preserve scope and termination handling when event time is unknown. Bound pre-arm retention using transport-owned wire bytes. Fail closed when the relevant-event buffer fills, and keep unrelated protocol payloads outside that budget. BREAKING CHANGE: observe_web_session timeline timestamps can be null when the producer supplies no comparable timestamp. Consumers must handle unknown time explicitly. Refs #5609
22 lines
622 B
TypeScript
22 lines
622 B
TypeScript
import { afterEach } from "vitest";
|
|
|
|
import type { FakeCdpBrowser } from "../../fixtures/fakeCdpBrowser.js";
|
|
|
|
const browsers: FakeCdpBrowser[] = [];
|
|
|
|
afterEach(async () => {
|
|
await Promise.all(browsers.splice(0).map(async (browser) => browser.close()));
|
|
});
|
|
|
|
export const trackBrowser = (browser: FakeCdpBrowser): void => {
|
|
browsers.push(browser);
|
|
};
|
|
|
|
export const waitFor = async (ready: () => boolean, description: string) => {
|
|
const deadline = Date.now() + 5_000;
|
|
while (!ready()) {
|
|
if (Date.now() > deadline) throw new Error(description);
|
|
await new Promise((resolve) => setTimeout(resolve, 10));
|
|
}
|
|
};
|