| 26 | |
| 27 | // Helper to create a mock Vite server |
| 28 | function createMockServer( |
| 29 | options: { |
| 30 | https?: boolean | object |
| 31 | host?: string | boolean |
| 32 | port?: number |
| 33 | httpServer?: any |
| 34 | } = {}, |
| 35 | ) { |
| 36 | return { |
| 37 | config: { |
| 38 | server: { |
| 39 | https: options.https ?? false, |
| 40 | host: options.host ?? 'localhost', |
| 41 | port: options.port ?? 5173, |
| 42 | }, |
| 43 | mode: 'development', |
| 44 | }, |
| 45 | httpServer: options.httpServer ?? { |
| 46 | on: vi.fn(), |
| 47 | address: vi.fn().mockReturnValue({ port: 5173 }), |
| 48 | }, |
| 49 | middlewares: { |
| 50 | use: vi.fn(), |
| 51 | }, |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | describe('devtools plugin', () => { |
| 56 | describe('connection-injection plugin', () => { |