import { DeployWorker } from "https://deno.land/x/dectyl@0.6.2/mod.ts";
Start server and execute the callback. Once the callback finishes, the worker will be closed. Run resolves or rejects with the value returned from the callback. The callback will be called with the context of the worker.
This is useful when you need to run a set of assertions against the worker where the assertions might throw, but want to ensure the worker gets closed irrespective of if the callback throws or not.
Example:
const helloWorld = await createWorker("./helloWorld.ts");
await helloWorld.run(async function () {
const [response, info] = await this.fetch("/");
// make assertions against the response
});