MCPcopy
hub / github.com/mswjs/msw / createServer

Function createServer

test/node/msw-api/setup-server/input-validation.node.test.ts:5–12  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3
4test('throws an error given an Array of request handlers to "setupServer"', () => {
5 const createServer = () => {
6 // @ts-expect-error intentionally invalid parameters for setupServer to force it to throw
7 return setupServer([
8 http.get('https://test.mswjs.io/book/:bookId', () => {
9 return HttpResponse.json({ title: 'Original title' })
10 }),
11 ])
12 }
13
14 expect(createServer).toThrow(
15 `[MSW] Failed to apply given request handlers: invalid input. Did you forget to spread the request handlers Array?`,

Callers

nothing calls this directly

Calls 2

setupServerFunction · 0.90
jsonMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…