W3cubDocs

/Deno

Deno.TestDefinition

interface TestDefinition {
fn: (t: TestContext) => void | Promise<void>;
ignore?: boolean;
name: string;
only?: boolean;
permissions?: "inherit" | "none" | {
env?: "inherit" | boolean | string[];
hrtime?: "inherit" | boolean;
net?: "inherit" | boolean | string[];
ffi?: "inherit" | boolean | Array<string | URL>;
read?: "inherit" | boolean | Array<string | URL>;
run?: "inherit" | boolean | Array<string | URL>;
write?: "inherit" | boolean | Array<string | URL>;
}
;
sanitizeExit?: boolean;
sanitizeOps?: boolean;
sanitizeResources?: boolean;
}

Properties

fn: (t: TestContext) => void | Promise<void>
ignore?: boolean
name: string
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.

permissions?: "inherit" | "none" | {
env?: "inherit" | boolean | string[];
hrtime?: "inherit" | boolean;
net?: "inherit" | boolean | string[];
ffi?: "inherit" | boolean | Array<string | URL>;
read?: "inherit" | boolean | Array<string | URL>;
run?: "inherit" | boolean | Array<string | URL>;
write?: "inherit" | boolean | Array<string | URL>;
}

Specifies the permissions that should be used to run the test. Set this to "inherit" to keep the calling thread's permissions. Set this to "none" to revoke all permissions.

Defaults to "inherit".

sanitizeExit?: boolean

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

sanitizeOps?: boolean

Check that the number of async completed ops after the test is the same as number of dispatched ops. Defaults to true.

sanitizeResources?: boolean

Ensure the test case does not "leak" resources - ie. the resource table after the test has exactly the same contents as before the test. Defaults to true.