docs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10
Capture request traces and unmatched calls for a single HTTP(S) host using a mocking dependency.
/**
* Creates a tracer for a single base URL using the HTTP mocking dependency.
*
* @param {string} baseUrl - Host (with protocol) to intercept.
* @param {{ allowUnmocked?: boolean }} [options]
* @returns {{
* scope: unknown,
* traces: Array<{ type: 'request' | 'replied', method: string, path: string, status?: number, body?: any }>,
* unmatched: Array<{ method: string, url: string }>,
* mock(method: string, path: string, status: number, body?: any, headers?: Record<string, string>): void,
* teardown(): void
* }}
*/
export function createMockTrace(baseUrl, options);Mocks HTTP(S) requests and emits lifecycle events for trace and unmatched requests.