diff --git a/src/__tests__/bun-setup.ts b/src/__tests__/bun-setup.ts index ee76b1c..8a979df 100644 --- a/src/__tests__/bun-setup.ts +++ b/src/__tests__/bun-setup.ts @@ -1,7 +1,7 @@ // Setup file for Bun test runner to provide DOM environment import { JSDOM } from 'jsdom'; -import '@testing-library/jest-dom'; -import { act } from '@testing-library/react'; + +console.log('Loading bun-setup.ts...'); const dom = new JSDOM('', { url: 'http://localhost', @@ -12,8 +12,16 @@ const dom = new JSDOM('', { (global as any).document = dom.window.document; (global as any).navigator = dom.window.navigator; -// Extend global act to handle async operations -const originalAct = act; -(global as any).act = async (callback: () => Promise | void) => { - return originalAct(callback); -}; +console.log('bun-setup.ts loaded - document:', typeof (global as any).document); +console.log('document.body:', (global as any).document?.body); + +// Import jest-dom matchers after setting up the DOM +import '@testing-library/jest-dom'; + +// Clear document body after each test +import { afterEach } from 'bun:test'; +afterEach(() => { + if (global.document?.body) { + global.document.body.innerHTML = ''; + } +});