diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2022-01-18 15:02:56 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-18 15:02:56 -0500 |
commit | 0f3a53e5d477ca2c422ed58a65bd368d1eb0a5b2 (patch) | |
tree | 43e8199a4b5831c01bfefd439b53a2098ee4805d /cli/dts/lib.deno.ns.d.ts | |
parent | ce52bfc59c6700e64dbe941485d078ceb9dd2158 (diff) |
feat: stabilize test steps API (#13400)
Diffstat (limited to 'cli/dts/lib.deno.ns.d.ts')
-rw-r--r-- | cli/dts/lib.deno.ns.d.ts | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/cli/dts/lib.deno.ns.d.ts b/cli/dts/lib.deno.ns.d.ts index e23f44d9a..46b4bda71 100644 --- a/cli/dts/lib.deno.ns.d.ts +++ b/cli/dts/lib.deno.ns.d.ts @@ -113,8 +113,40 @@ declare namespace Deno { * See: https://no-color.org/ */ export const noColor: boolean; - /** **UNSTABLE**: New option, yet to be vetted. */ export interface TestContext { + /** 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`. + */ + step(t: TestStepDefinition): Promise<boolean>; + + /** 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`. + */ + step( + name: string, + fn: (t: TestContext) => void | Promise<void>, + ): Promise<boolean>; + } + + export interface TestStepDefinition { + fn: (t: TestContext) => void | Promise<void>; + name: string; + ignore?: boolean; + /** Check that the number of async completed ops after the test step is the same + * as number of dispatched ops. Defaults to the parent test or step's value. */ + sanitizeOps?: boolean; + /** Ensure the test step does not "leak" resources - ie. the resource table + * after the test has exactly the same contents as before the test. Defaults + * to the parent test or step's value. */ + sanitizeResources?: 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. */ + sanitizeExit?: boolean; } export interface TestDefinition { |