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

x/deno/cli/tsc/dts/lib.deno.ns.d.ts>Deno.TestStepDefinition

A modern runtime for JavaScript and TypeScript.
Latest
interface Deno.TestStepDefinition
import { type Deno } from "https://deno.land/x/deno@v2.0.4/cli/tsc/dts/lib.deno.ns.d.ts";
const { TestStepDefinition } = Deno;

Properties

fn: (t: TestContext) => void | Promise<void>

The test function that will be tested when this step is executed. The function can take an argument which will provide information about the current step's context.

name: string

The name of the step.

optional
ignore: boolean

If truthy the current test step will be ignored.

This is a quick way to skip over a step, but also can be used for conditional logic, like determining if an environment feature is present.

optional
sanitizeOps: boolean

Check that the number of async completed operations after the test step is the same as number of dispatched operations. This ensures that the code tested does not start async operations which it then does not await. This helps in preventing logic errors and memory leaks in the application code.

Defaults to the parent test or step's value.

optional
sanitizeResources: boolean

Ensure the test step does not "leak" resources - like open files or network connections - by ensuring the open resources at the start of the step match the open resources at the end of the step.

Defaults to the parent test or step's value.

optional
sanitizeExit: boolean

Ensure the test step does not prematurely cause the process to exit, for example via a call to Deno.exit.

Defaults to the parent test or step's value.