From 2027d98a8e9e530277ab301841872cdea7e2d590 Mon Sep 17 00:00:00 2001 From: Leo Kettmeir Date: Tue, 24 Jan 2023 15:41:01 +0100 Subject: feat: allow first arg in test step to be a function (#17096) --- cli/tsc/dts/lib.deno.ns.d.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'cli/tsc') diff --git a/cli/tsc/dts/lib.deno.ns.d.ts b/cli/tsc/dts/lib.deno.ns.d.ts index 7473b1415..b6add6e4b 100644 --- a/cli/tsc/dts/lib.deno.ns.d.ts +++ b/cli/tsc/dts/lib.deno.ns.d.ts @@ -668,6 +668,25 @@ declare namespace Deno { name: string, fn: (t: TestContext) => void | Promise, ): Promise; + + /** Run a sub step of the parent test or step. Returns a promise + * that resolves to a boolean signifying if the step completed successfully. + * + * The returned promise never rejects unless the arguments are invalid. + * + * If the test was ignored the promise returns `false`. + * + * ```ts + * Deno.test(async function aParentTest(t) { + * console.log("before the step"); + * await t.step(function step1(t) { + * console.log("current step:", t.name); + * }); + * console.log("after the step"); + * }); + * ``` + */ + step(fn: (t: TestContext) => void | Promise): Promise; } /** @category Testing */ -- cgit v1.2.3