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

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

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

Properties

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

The name of the test.

optional
ignore: boolean

If truthy the current test step will be ignored.

It 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
only: boolean

If at least one test has only set to true, only run tests that have only set to true and fail the test suite.

optional
sanitizeOps: boolean = true

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.

optional
sanitizeResources: boolean = true

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

optional
sanitizeExit: boolean = true

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

optional
permissions: PermissionOptions = "inherit"

Specifies the permissions that should be used to run the test.

Set this to "inherit" to keep the calling runtime permissions, set this to "none" to revoke all permissions, or set a more specific set of permissions using a PermissionOptionsObject.