Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
import "@testing-library/jest-dom/vitest";
import "@multica/vitest-setup/web-storage";
// Everything below patches gaps in jsdom. Pure-logic suites opt out of jsdom
// with `// @vitest-environment node` and share this file, so there is no DOM to
// patch there — bail out rather than guard each stub.
if (typeof window !== "undefined") {
// jsdom doesn't provide matchMedia; useIsMobile() relies on it.
if (typeof window.matchMedia !== "function") {
window.matchMedia = (query: string) =>
({
matches: false,
media: query,
onchange: null,
addListener: () => {},
removeListener: () => {},
addEventListener: () => {},
removeEventListener: () => {},
dispatchEvent: () => false,
}) as MediaQueryList;
}
// jsdom doesn't provide ResizeObserver; stub it so components that rely on it
// (e.g. input-otp) can render in tests.
if (typeof globalThis.ResizeObserver === "undefined") {
globalThis.ResizeObserver = class ResizeObserver {
observe() {}
unobserve() {}
disconnect() {}
} as unknown as typeof ResizeObserver;
}
// jsdom doesn't implement elementFromPoint; input-otp uses it internally.
if (typeof document.elementFromPoint !== "function") {
document.elementFromPoint = () => null;
}
// jsdom has no layout, so it doesn't implement scrollIntoView; list components
// that keep a keyboard cursor in view (e.g. the thread navigator) call it.
if (typeof Element.prototype.scrollIntoView !== "function") {
Element.prototype.scrollIntoView = () => {};
}
// jsdom doesn't implement Range geometry. ProseMirror's post-dispatch
// scrollToSelection measures the caret through coordsAtPos, which calls these
// on a text Range, so any test that types into an editor would throw.
// Return an empty layout; tests that need real geometry override them.
if (typeof Range.prototype.getClientRects !== "function") {
Range.prototype.getClientRects = () =>
({ length: 0, item: () => null, [Symbol.iterator]: function* () {} }) as unknown as DOMRectList;
}
if (typeof Range.prototype.getBoundingClientRect !== "function") {
Range.prototype.getBoundingClientRect = () => new DOMRect(0, 0, 0, 0);
}
}