/** * @devgrid/testing - Cross-runtime testing utilities */ export * from './runtime/test-adapter.js'; export * from './async/index.js'; export * from './errors.js'; // Re-export specific runtime adapters based on environment export { RUNTIME } from './runtime/test-adapter.js'; // Export utility types export type MockFunction any> = T & { mock: { calls: Parameters[]; results: ReturnType[]; lastCall: () => Parameters | undefined; }; mockImplementation: (impl: T) => MockFunction; mockReturnValue: (value: ReturnType) => MockFunction; mockResolvedValue: (value: Awaited>) => MockFunction; mockRejectedValue: (value: any) => MockFunction; mockClear: () => void; mockReset: () => void; }; // Helper function to import the correct adapter based on runtime export function loadRuntimeAdapter() { const runtime = (() => { if (typeof (globalThis as any).Bun !== 'undefined') return 'bun'; if (typeof (globalThis as any).Deno !== 'undefined') return 'deno'; return 'node'; })(); switch (runtime) { case 'bun': return import('./runtime/bun-adapter.js'); case 'deno': return import('./runtime/deno-adapter.js'); default: return import('./runtime/node-adapter.js'); } }