test(vcs): close the blame popup inside act in teardown (#8300)

closeBlamePopup renders null into the popup's React root; called outside act in afterEach, React sometimes ran that work after the test environment was torn down, failing the Frontend job with an unhandled window-is-not-defined error. Both blame test files now close it inside act.
Цей коміт міститься в:
l0ng-ai authored and GitHub committed 2026-12-06 05:04:48 +08:00
1 джерело ca6efe197c
коміт 7abf1d2ac7
2 files changed
+5 -2

No files matched your search

+2 -1
Переглянути файл
@@ -94,7 +94,8 @@ beforeEach(() => {
});
afterEach(() => {
closeBlamePopup();
// Inside act: the popup's root renders the close now, not after the test environment is gone.
act(() => closeBlamePopup());
view?.destroy();
view = undefined;
vi.useRealTimers();
+3 -1
Переглянути файл
@@ -5,6 +5,7 @@
// change) is crates/ide-svn/tests/ij_history.rs.
import { EditorState } from "@codemirror/state";
import { EditorView } from "@codemirror/view";
import { act } from "@testing-library/react";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import type { BlameLine } from "@/bindings";
import { useI18n } from "@/platform/i18n";
@@ -78,7 +79,8 @@ beforeEach(() => {
});
afterEach(() => {
closeBlamePopup();
// Inside act: the popup's root renders the close now, not after the test environment is gone.
act(() => closeBlamePopup());
view?.destroy();
view = undefined;
vi.useRealTimers();