BUPKIS
    Preparing search index...

    Function createTrackedServer

    • Creates a tracked MSW server that records all handled requests.

      This is a drop-in replacement for MSW's setupServer that adds request tracking capabilities for use with bupkis assertions.

      Parameters

      • ...handlers: RequestHandler<RequestHandlerDefaultInfo, any, any, RequestHandlerOptions>[]

        MSW request handlers to register

      Returns TrackedServer

      A TrackedServer instance with request tracking capabilities

      import { createTrackedServer } from '@bupkis/msw';
      import { http, HttpResponse } from 'msw';

      const server = createTrackedServer(
      http.get('/api/users', () =>
      HttpResponse.json([{ id: 1, name: 'Alice' }]),
      ),
      );

      server.listen();
      // ... make requests ...
      expect(server, 'to have handled request to', '/api/users');
      server.close();