Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ vi.mock('react-i18next', () => ({
}))

vi.mock('lucide-react', () => ({
Check: (props: Record<string, unknown>) => <span data-testid="check-icon" {...props} />,
Search: (props: Record<string, unknown>) => <span data-testid="search-icon" {...props} />,
Check: () => <span data-testid="check-icon" />,
Search: () => <span data-testid="search-icon" />,
}))

vi.mock('../../../../../lib/formatCardTitle', () => ({
formatCardTitle: (type: string) => type.replace(/_/g, ' '),
}))

vi.mock('../../../../../lib/icons', () => ({
getIcon: () => (props: Record<string, unknown>) => <span data-testid="cat-icon" {...props} />,
getIcon: () => () => <span data-testid="cat-icon" />,
}))

vi.mock('../../../templates', () => ({
Expand Down
2 changes: 1 addition & 1 deletion web/src/hooks/useMissions.provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ export function useMissions() {
const context = useContext(MissionContext)
if (!context) {
if (import.meta.env.DEV) {
logger.warn('useMissions was called outside MissionProvider — returning safe fallback')
console.warn('useMissions was called outside MissionProvider — returning safe fallback')
}
return MISSIONS_FALLBACK
}
Expand Down
6 changes: 3 additions & 3 deletions web/src/test/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,16 +226,16 @@ afterEach(() => {
window.sessionStorage?.clear()
}
vi.unstubAllEnvs()
vi.restoreAllMocks() // Restore mocks but preserve global stubs (e.g., localStorage) (#20007)
vi.clearAllMocks()
Comment on lines 228 to 230
})

// Clear global stubs after every test file.
// In vitest 4.x with pool:'forks'/isolate:false and maxWorkers:1 (CI), all test
// files in a shard share one worker process, so vi.stubGlobal() calls in one
// file's beforeAll leak into subsequent files.
// afterAll in setupFiles runs once per worker (end of shard), not once per file,
// so this only partially mitigates contamination — see issue #20256 for the
// full architectural fix (pool:'forks', isolate:true).
// afterAll in setupFiles runs once per worker (end of shard), not once per file.
// Belt-and-suspenders: primary cleanup now happens in afterEach above (#20007).
afterAll(() => {
vi.unstubAllGlobals()
})
6 changes: 3 additions & 3 deletions web/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,9 +319,9 @@ export default defineConfig(({ mode }) => ({
// isolate: true ensures each test file runs in its own subprocess with a clean global environment,
// preventing vi.stubGlobal() cross-contamination between files (#20256)
isolate: true,
// poolOptions.forks removed — deprecated in Vitest 4 (#5860).
// maxWorkers/minWorkers above handle fork limits; teardownTimeout
// above handles worker termination timeout.
// CI: use threads pool instead of forks to prevent OOM from subprocess spawn storm (#20007)
// Threads share memory, no fork overhead. Local dev uses default (forks) for stronger isolation.
pool: process.env.CI ? 'threads' : undefined,
coverage: {
provider: 'v8',
// Disable coverage.all to prevent force-importing source files that trigger
Expand Down
Loading