Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/dectyl/mod.ts>DeployWorker#run

Prototype library for testing Deno Deploy scripts using the Deno CLI
Latest
method DeployWorker.prototype.run
import { DeployWorker } from "https://deno.land/x/dectyl@0.10.7/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
});

Parameters

callback: (this: this) => T | Promise<T>

Returns

Promise<T>