export type HostileMode = /** A retired route behind Traefik/nginx: plain text, HTTP 404. THE one that * produced the JSON parse error, because `404 page not found` parses as the * number 404 and then fails at position 4. */ 'text404' /** A parked domain or a login wall: HTML with a 200. */ | 'html200' /** An upstream that is up but broken. */ | 'gateway502' /** Authenticated but forbidden — a revoked device token looks like this. */ | 'forbidden403' /** 200, valid JSON, but not our API: a different service on the same host. */ | 'notOurApi' /** Accepts the connection and never answers. A dropped packet looks like this * to the client, and it is the failure people describe as "it just hangs". */ | 'silent'; export interface HostileServer { url: string; /** Every path the CLI actually asked for, in order. A test that only checks * the printed message cannot tell "the CLI handled a 404 well" from "the CLI * never sent a request" — and the first version of this harness spawned the * CLI with execFileSync, which blocks the test process's event loop, so this * server answered NOTHING and four assertions passed on a timeout. */ hits: string[]; close: () => Promise; } /** Start one. Always on 127.0.0.1 and an ephemeral port, so tests can run in * parallel and nothing is exposed. */ export declare function startHostileServer(mode: HostileMode): Promise; /** * A port nothing listens on — connection refused, immediately. Distinct from * 'silent' (accepted then ignored) and from a name that does not resolve. * * IT HAS TO BE A REAL PORT. This returned `http://127.0.0.1:1`, and port 1 is on * the WHATWG "bad port" list, so undici refuses the request before it opens a * socket and throws a bare `Error: bad port` with no code. The test asserting * "a refused port says refused" was therefore never testing a refused port, and * it failed against a CLI whose ECONNREFUSED handling was correct all along. * * Bind an ephemeral port, read it, close it: nothing else can be listening on it * at that instant, and the number is one undici will actually dial. */ export declare function refusedUrl(): Promise; /** A hostname that cannot resolve. `.invalid` is reserved by RFC 2606 exactly so * a test can rely on this without depending on somebody's DNS. */ export declare function unresolvableUrl(): string; //# sourceMappingURL=hostile-server.d.ts.map