Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(desktop): snapshot background preview tabs without timing out #24133

ClosedWosca(GitHub profile, opens in a new tab)wants to merge 3 commits intomain fromrefs/pull/24133/headopened View on GitHub

Showing 6 changed files with 130 additions and 9 deletions (loading 5).

x
0 of 6 viewed, 6 left
130 additions and 9 deletionsapps/desktop/src/preview/DesktopBrowserHost.test.tsModified
View file
@@ -6,6 +6,7 @@
import * as Queue from "effect/Queue";
import * as Schema from "effect/Schema";
import * as Stream from "effect/Stream";
+import * as TestClock from "effect/testing/TestClock";
import * as NodeEvents from "node:events";
​
import * as DesktopBrowserHost from "./DesktopBrowserHost.ts";
@@ -30,24 +31,37 @@
}),
);
​
-const makeDebuggee = () => {
+const makeDebuggee = (
+ prepareSurface: () => Promise<unknown> = async () => true,
+ restoreSurface: () => Promise<unknown> = async () => true,
+) => {
const emitter = new NodeEvents.EventEmitter();
- const pending: Array<() => void> = [];
+ const pending: Array<(cause?: Error) => void> = [];
const sent: Array<unknown> = [];
const sendWaiters: Array<() => void> = [];
const debuggee = Object.assign(emitter, {
sendCommand: (method: string, params?: { id?: number }) =>
- new Promise((resolve) => {
+ new Promise((resolve, reject) => {
if (method === "Target.getTargetInfo") {
resolve({ targetInfo: { targetId: "GUEST" } });
return;