Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 12 additions & 15 deletions vitest.setup.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { afterEach, vi, beforeAll } from 'vitest';
import { afterEach, vi } from 'vitest';

// Track unhandled errors for better debugging
const originalConsoleError = console.error;
Expand Down Expand Up @@ -28,20 +28,17 @@ process.on('uncaughtException', error => {
});

// Mock Astro content collections before any imports
beforeAll(() => {
// Mock astro:content module
vi.mock('astro:content', () => ({
getEntry: vi.fn().mockResolvedValue({
data: {
'nav.home': 'Home',
'nav.docs': 'Docs',
'getting-started': 'Getting Started',
FAQ: 'FAQ'
}
}),
getCollection: vi.fn().mockResolvedValue([])
}));
});
vi.mock('astro:content', () => ({
getEntry: vi.fn().mockResolvedValue({
data: {
'nav.home': 'Home',
'nav.docs': 'Docs',
'getting-started': 'Getting Started',
FAQ: 'FAQ'
}
}),
getCollection: vi.fn().mockResolvedValue([])
}));

// Global cleanup after each test
afterEach(() => {
Expand Down
Loading