feat/bun-transition #21

Merged
david merged 24 commits from feat/bun-transition into main 2026-04-02 04:51:20 +00:00
Showing only changes of commit 09302fd911 - Show all commits
+15 -7
View File
@@ -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('<!DOCTYPE html><html><body></body></html>', {
url: 'http://localhost',
@@ -12,8 +12,16 @@ const dom = new JSDOM('<!DOCTYPE html><html><body></body></html>', {
(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> | 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 = '';
}
});