MCPcopy Create free account
hub / github.com/TanStack/devtools / createMockServer

Function createMockServer

packages/devtools-vite/tests/index.test.ts:28–53  ·  view source on GitHub ↗
(
  options: {
    https?: boolean | object
    host?: string | boolean
    port?: number
    httpServer?: any
  } = {},
)

Source from the content-addressed store, hash-verified

26
27// Helper to create a mock Vite server
28function 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
55describe('devtools plugin', () => {
56 describe('connection-injection plugin', () => {

Callers 1

index.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected