feat: migrate from npm to Bun
- 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:
@@ -1,24 +1,24 @@
|
||||
import { describe, it, expect, vi, beforeEach, MockedFunction } from 'vitest'
|
||||
import { describe, it, expect, mock, beforeEach, MockedFunction } from 'bun:test'
|
||||
import { render, screen, waitFor } from '@testing-library/react'
|
||||
import userEvent from '@testing-library/user-event'
|
||||
import EditTournamentForm from '@/components/EditTournamentForm'
|
||||
|
||||
// Mock next/navigation
|
||||
vi.mock('next/navigation', () => ({
|
||||
mock.module('next/navigation', () => ({
|
||||
useRouter: () => ({
|
||||
push: vi.fn(),
|
||||
push: mock(() => {}),
|
||||
}),
|
||||
}))
|
||||
|
||||
// Mock next/link
|
||||
vi.mock('next/link', () => ({
|
||||
mock.module('next/link', () => ({
|
||||
default: ({ children, href }: { children: React.ReactNode; href: string }) => (
|
||||
<a href={href}>{children}</a>
|
||||
),
|
||||
}))
|
||||
|
||||
// Mock fetch
|
||||
const mockFetch = vi.fn()
|
||||
const mockFetch = mock(() => {})
|
||||
global.fetch = mockFetch as MockedFunction<typeof global.fetch>
|
||||
|
||||
const mockTournament = {
|
||||
@@ -40,7 +40,7 @@ const mockTournament = {
|
||||
|
||||
describe('EditTournamentForm', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks()
|
||||
mock.clearAllMocks()
|
||||
})
|
||||
|
||||
it('renders form with initial values', () => {
|
||||
|
||||
Reference in New Issue
Block a user