fix: prevent makeBodyVisible timeout from running after test teardown (#22972)

* fix: prevent makeBodyVisible timeout from running after test teardown

- Add timeout tracking to makeBodyVisible function to enable cleanup
- Add vi.clearAllTimers() to test teardown to clear recursive timeouts
- Prevents 'ReferenceError: document is not defined' in CI tests

Fixes intermittent test failures where makeBodyVisible recursive timeout
continues running after test environment is torn down.

Co-Authored-By: anik@cal.com <adhabal2002@gmail.com>

* simplify: use only vi.clearAllTimers() to fix timeout issue

Based on code review feedback, test if vi.clearAllTimers() alone
is sufficient without modifying makeBodyVisible function.

- Reverted makeBodyVisible function changes
- Kept only vi.clearAllTimers() in test teardown
- Verified with multiple test runs and type checking

Co-Authored-By: anik@cal.com <adhabal2002@gmail.com>

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
authored and GitHub committed 2025-08-08 08:07:08 -03:00
1 parent bf8f966811
commit 6af473a486
1 file changed
+1
@@ -11,6 +11,7 @@ afterEach(() => {
vi.clearAllMocks();
vi.resetModules();
vi.useRealTimers();
vi.clearAllTimers();
});
describe("embedStore.router.ensureQueryParamsInUrl", async () => {