дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-11-09 19:25:54 +02:00
test: stub Range layout methods once in the test setup (#53)
Root cause: jsdom has no layout and CodeMirror measures text ranges in an animation frame, sometimes after a test finished; test files that did not stub Range.getClientRects (e.g. search/codePreview) threw an unhandled TypeError that failed whole CI runs at random (seen on #41). Fix: stub Range.getClientRects / getBoundingClientRect once in src/test/setup.ts; drop the six per-file copies. Verified: vitest on editor/lsp, editor/refactor, templates, search (55 files, 458 tests, no unhandled errors). Claude-Session: https://claude.ai/code/session_01VUYsdXA2nkF5v6zsC93dpn
Цей коміт міститься в:
1 джерело
843127f4a3
коміт
5670c2e8dd
7 files changed
+4
-24
No files matched your search
@@ -120,10 +120,6 @@ const { clearLevelCache } = await import("./projectLevel");
|
||||
|
||||
// --- editor ---------------------------------------------------------------------
|
||||
|
||||
// jsdom has no layout; popups anchor at caret coordinates.
|
||||
Range.prototype.getClientRects ??= () => [] as unknown as DOMRectList;
|
||||
Range.prototype.getBoundingClientRect ??= () => new DOMRect();
|
||||
|
||||
let view: EditorView | null = null;
|
||||
|
||||
function editor(doc: string, language: string, path: string, sel: { anchor: number; head?: number }) {
|
||||
|
||||
@@ -55,10 +55,6 @@ const { lspDoc } = await import("@/editor/lsp/lsp");
|
||||
const { inplaceRenameExtension, inplaceSession } = await import("@/editor/lsp/inplaceRename");
|
||||
const { temporaryHighlights } = await import("@/editor/lsp/tempHighlight");
|
||||
|
||||
// jsdom has no layout; popups anchor at the caret.
|
||||
Range.prototype.getClientRects ??= () => [] as unknown as DOMRectList;
|
||||
Range.prototype.getBoundingClientRect ??= () => new DOMRect();
|
||||
|
||||
const action = (title: string, kind: string, disabledReason: string | null = null): CodeAction => ({
|
||||
title,
|
||||
kind,
|
||||
|
||||
Reference in new issue
Заблокувати користувача