Automatically connect HTTP(s) servers to a randomly available port for each request. Makes testing your Express/Connect/Node servers easy!
npm install popsicle-server --save
import { toFetch } from "popsicle";
import { middleware } from "popsicle/dist/node";
import { compose } from "throwback";
import { Request } from "servie/dist/node";
import { server } from "popsicle-server";
const fetch = toFetch(
compose([
server((req, res) => {
res.write(`${req.method} ${req.url}`);
res.end();
}),
middleware
]),
Request
);
await fetch("/users");
MIT license