http-request-mock
Version:
Intercept & mock http requests issued by XMLHttpRequest, fetch, nodejs https/http module, axios, jquery, superagent, ky, node-fetch, request, got or any other request libraries by intercepting XMLHttpRequest, fetch and nodejs native requests in low level.
18 lines (17 loc) • 665 B
TypeScript
export = vitePluginHttpRequestMock;
/**
* @param {{appEntry: RegExp; mockDir: string; enable: boolean; debug: boolean}} opts
* appEntry Required, app entry file which mock dependencies will be injected into.
* mockDir Required, mock directory which contains all mock files & the runtime mock config entry file.
* enable Optional, whether or not to enable this plugin. Default: true
* debug Optional, output some debug logs. Default: false
*/
declare function vitePluginHttpRequestMock(opts: {
appEntry: RegExp;
mockDir: string;
enable: boolean;
debug: boolean;
}): {
name: string;
transform(code: any, id: any): string | undefined;
};