Files
orangecat/tests/setup.ts
bae4be1aa3 refactor(test): migrate the unit suite from Jest 30 to Vitest 4 (#859)
Full parity: 282 test files / 2645 tests green before and after.

- vitest.config.ts mirrors the old moduleNameMapper as ordered resolve.alias
  entries; jsdom env, globals, 30s timeout, v8 coverage with the same ratchet.
- vitest.setup.ts ports jest.setup.ts; lucide-react is now a vi.mock Proxy
  (any icon resolves — the old CJS-alias Proxy surfaced no named exports and
  every unlisted icon crashed renders as "Element type is invalid").
- Codemod jest.* -> vi.* across tests; @jest-environment -> @vitest-environment.
- Constructor mocks use function expressions (vitest news the implementation;
  arrows are not constructable).
- Factories returning a bare component now return { default: ... };
  one TDZ factory moved under vi.hoisted; one require() -> await import().
- jest.isolateModulesAsync dropped in the auth smoke test (resetModules +
  doMock per test covers it).
- Scripts ported (positional path filters replace --testPathPatterns);
  verify's --watchAll flag removed; ci.yml comment updated.
- Deleted jest.config.js, jest.setup.ts, __mocks__/vitest.js,
  tsconfig.test.json, tests/jest-dom.d.ts, and the unimported jest-era
  tests/utils.ts; uninstalled jest, ts-jest, jest-environment-jsdom,
  @types/jest; dropped the dead mcp:jest script.
- Snapshot file rewritten in Vitest format (content byte-identical).


Claude-Session: https://claude.ai/code/session_01WqKqMnHQHSmkGFfc5t7Rxn

Co-authored-by: Georgy Butaev <41178744+g-but@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-31 16:14:36 +00:00

12 lines
187 B
TypeScript

import '@testing-library/jest-dom';
// Mock next/router
vi.mock('next/router', () => ({
useRouter: () => ({
push: vi.fn(),
}),
}));
// Mock window.alert
window.alert = vi.fn();