summaryrefslogtreecommitdiff
path: root/cli/dts/lib.deno.unstable.d.ts
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2021-10-11 09:45:02 -0400
committerGitHub <noreply@github.com>2021-10-11 09:45:02 -0400
commit426ebf854a82c63cdaa2413fbd1b005025dba95b (patch)
tree316a426e280db29745444e7606952c8c235c846a /cli/dts/lib.deno.unstable.d.ts
parent668b400ff2fa5634f575e54f40ab1f0b78fcdf16 (diff)
feat(unstable/test): imperative test steps API (#12190)
Diffstat (limited to 'cli/dts/lib.deno.unstable.d.ts')
-rw-r--r--cli/dts/lib.deno.unstable.d.ts37
1 files changed, 37 insertions, 0 deletions
diff --git a/cli/dts/lib.deno.unstable.d.ts b/cli/dts/lib.deno.unstable.d.ts
index 73f4bfcb2..3bea165e5 100644
--- a/cli/dts/lib.deno.unstable.d.ts
+++ b/cli/dts/lib.deno.unstable.d.ts
@@ -948,6 +948,43 @@ declare namespace Deno {
};
}
+ /** **UNSTABLE**: New option, yet to be vetted. */
+ export interface TestContext {
+ /** Run a sub step of the parent test with a given name. 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`.
+ */
+ step(t: TestStepDefinition): Promise<boolean>;
+
+ /** Run a sub step of the parent test with a given name. 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`.
+ */
+ step(
+ name: string,
+ fn: (t: TestContext) => void | Promise<void>,
+ ): Promise<boolean>;
+ }
+
+ /** **UNSTABLE**: New option, yet to be vetted. */
+ export interface TestStepDefinition {
+ fn: (t: TestContext) => void | Promise<void>;
+ name: string;
+ ignore?: boolean;
+ /** Check that the number of async completed ops after the test is the same
+ * as number of dispatched ops. Defaults to true. */
+ sanitizeOps?: 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. */
+ sanitizeResources?: boolean;
+ /** Ensure the test case does not prematurely cause the process to exit,
+ * for example via a call to `Deno.exit`. Defaults to true. */
+ sanitizeExit?: boolean;
+ }
+
/** **UNSTABLE**: new API, yet to be vetted.
*
* A generic transport listener for message-oriented protocols. */