/** What a check is given and may return. Kept apart from checks.ts (which loads files) so code the extension carries can use it. */ /** What a check receives: its arguments, the variables set so far, and ways to look at the page the run is on. */ export interface CheckContext { args: string[]; vars: Record; /** * The text of the element a target names (the same targets as in a script). Fails if the page cannot answer. With `blocks` the text of neighbouring blocks is * separated by a space, which is what reading a whole page for a handle or an amount needs. */ read(target: Record, options?: { blocks?: boolean }): Promise; /** The address of the page the run is on. */ url(): Promise; /** The profile the run uses, and the account it is signed in as when the config says so. */ profile: string; account: string | undefined; } /** A check says the test's starting state is wrong (a balance too low, an account limited), not the app, with reason "pre-state". Any other reason it names is a mismatch. */ export type CheckResult = void | undefined | boolean | { ok: boolean; reason?: "pre-state" | "internal"; message?: string; expected?: unknown; found?: unknown }; export type CheckFn = (ctx: CheckContext) => CheckResult | Promise; export type CheckModuleLoader = (path: string) => Promise;