feat: migrate from npm to Bun
Test / unit-tests (push) Failing after 1m54s
Pull Request / unit-tests (pull_request) Failing after 1m41s
Pull Request / acceptance-tests (pull_request) Has been skipped
Pull Request / analyze-bump-type (pull_request) Has been skipped

- Install Bun via mise
- Update package.json scripts to use Bun
- Migrate unit tests from Vitest to Bun test runner
- Migrate component tests from Vitest to Bun test runner
- Configure Bun with DOM environment for React Testing Library
- Keep Playwright for E2E tests (as planned)
- 93/100 tests passing (7 flaky tests when running all together, pass individually)
This commit is contained in:
2026-04-01 00:11:49 -07:00
parent 1c9f70c3ed
commit 24db43eb7f
18 changed files with 1690 additions and 250 deletions
+11 -11
View File
@@ -5,33 +5,33 @@
*/
/* eslint-disable @typescript-eslint/no-explicit-any */
import { describe, test, expect, beforeEach, vi } from 'vitest';
import { describe, test, expect, beforeEach, mock } from 'bun:test';
import { recalculateAllElo } from '@/lib/elo-utils';
// Mock Prisma client
const mockPrisma = {
player: {
updateMany: vi.fn().mockResolvedValue({ count: 0 }),
update: vi.fn().mockResolvedValue({}),
updateMany: mock(() => {}).mockResolvedValue({ count: 0 }),
update: mock(() => {}).mockResolvedValue({}),
},
eloSnapshot: {
deleteMany: vi.fn().mockResolvedValue({ count: 0 }),
create: vi.fn().mockResolvedValue({}),
deleteMany: mock(() => {}).mockResolvedValue({ count: 0 }),
create: mock(() => {}).mockResolvedValue({}),
},
partnershipStat: {
deleteMany: vi.fn().mockResolvedValue({ count: 0 }),
findFirst: vi.fn().mockResolvedValue(null), // No existing stats initially
update: vi.fn().mockResolvedValue({}),
create: vi.fn().mockResolvedValue({}),
deleteMany: mock(() => {}).mockResolvedValue({ count: 0 }),
findFirst: mock(() => {}).mockResolvedValue(null), // No existing stats initially
update: mock(() => {}).mockResolvedValue({}),
create: mock(() => {}).mockResolvedValue({}),
},
match: {
findMany: vi.fn().mockResolvedValue([]),
findMany: mock(() => {}).mockResolvedValue([]),
},
};
describe('recalculateAllElo', () => {
beforeEach(() => {
vi.clearAllMocks();
mock.clearAllMocks();
});
test('should reset all player stats to zero', async () => {