nock
Version:
HTTP server mocking and expectations library for Node.js
61 lines (60 loc) • 2.93 kB
TypeScript
import type { Options, Definition } from './lib/scope.ts';
import type { BackOptions, BackContext, BackMode, Back, InterceptorSurface } from './lib/back.ts';
import type { RecorderOptions } from './lib/recorder.ts';
import type { InterceptorMatchResult } from './lib/global_emitter.ts';
import type { DataMatcher, DataMatcherArray, DataMatcherMap, RequestBodyMatcher, RequestHeaderMatcher, Body, ReplyBody, ReplyHeaderFunction, ReplyHeaderValue, ReplyHeaders, StatusCode, ReplyFnResult, Interceptor } from './lib/interceptor.ts';
import type { Scope } from './lib/scope.ts';
import { removeAll } from './lib/intercept.ts';
declare function nock(basePath: string | RegExp | URL, options?: Options): Scope;
declare namespace nock {
var activate: typeof import("./lib/intercept.ts").activate;
var isActive: () => boolean;
var isDone: typeof import("./lib/intercept.ts").isDone;
var pendingMocks: typeof import("./lib/intercept.ts").pendingMocks;
var activeMocks: typeof import("./lib/intercept.ts").activeMocks;
var removeInterceptor: typeof import("./lib/intercept.ts").removeInterceptor;
var disableNetConnect: typeof import("./lib/intercept.ts").disableNetConnect;
var enableNetConnect: typeof import("./lib/intercept.ts").enableNetConnect;
var cleanAll: typeof removeAll;
var abortPendingRequests: typeof import("./lib/common.ts").removeAllTimers;
var load: typeof import("./lib/scope.ts").load;
var loadDefs: typeof import("./lib/scope.ts").loadDefs;
var define: typeof import("./lib/scope.ts").define;
var emitter: import("events")<{
'no match': [req: Request, interceptorResults?: InterceptorMatchResult[]];
}>;
var recorder: {
rec: typeof import("./lib/recorder.ts").record;
clear: typeof import("./lib/recorder.ts").clear;
play: typeof import("./lib/recorder.ts").outputs;
};
var restore: typeof import("./lib/recorder.ts").restore;
var back: typeof import("./lib/back.ts").default;
var getGetRequestBody: typeof import("./lib/utils/node/index.ts").getGetRequestBody;
}
export default nock;
declare namespace nock {
export type { Scope };
export type { Interceptor };
export type { Options };
export type { Definition };
export type { BackMode };
export type { BackContext };
export type { BackOptions };
export type { RecorderOptions };
export type { InterceptorSurface };
export type { InterceptorMatchResult };
export type { DataMatcher };
export type { DataMatcherArray };
export type { DataMatcherMap };
export type { RequestBodyMatcher };
export type { RequestHeaderMatcher };
export type { Body };
export type { ReplyBody };
export type { ReplyHeaderFunction };
export type { ReplyHeaderValue };
export type { ReplyHeaders };
export type { StatusCode };
export type { ReplyFnResult };
export type { Back };
}