import { Server as HttpServer, RequestListener } from 'node:http'; import Test from './Test'; export { Test }; export { fetch }; export interface IExpressLike extends RequestListener { route(prefix: T): unknown; } /** * Fetch a resource from a server, returns a Test. * * @param server - The server to fetch from. If the server is not already * listening, this function will start it listening and then will close the * server at the end of the test. * @param url - A Request or a string representing a relative URL. Same as * WHATWG Fetch. URL should be relative to the server (e.g. '/foo/bar'). * @param options - Same as WHATWG Fetch. * @returns - a Test, which is like a Promise, but it also * has 'expect' methods on it. */ export default function fetch(server: HttpServer, url: string | Request, init?: RequestInit): Test; export type FetchFunction = (url: string | Request, init?: RequestInit | undefined) => Test; /** * Creates a `fetch` function for a server. * * @param server - The server to fetch from. If the server is not already * listening, th server will be started before each call to `fetch()`, and * closed after each call. * @returns - a `fetch(url, options)` function, compatible with WHATWG * fetch, but which returns `Test` objects. */ export declare function makeFetch(target: HttpServer | IExpressLike): FetchFunction;