UNPKG

@eggjs/supertest

Version:

SuperAgent driven library for testing HTTP servers

24 lines (22 loc) 664 B
import { Test } from "./test.js"; import { Request } from "./request.js"; import { TestAgent, proxyAgent } from "./agent.js"; //#region src/index.ts /** * Test against the given `app`, * returning a new `Test`. */ function request(app, options = {}) { return new Request(app, options); } var src_default = new Proxy(request, { apply(target, _, argumentsList) { return target(argumentsList[0], argumentsList[1]); }, get(target, property, receiver) { if (property === "agent") return proxyAgent; return Reflect.get(target, property, receiver); } }); //#endregion export { Request, Test, TestAgent, proxyAgent as agent, src_default as default, request };