type WaitFn = (t: Test) => Promise | void; export declare let passedChecks: number; export declare let failedChecks: number; export declare let erroredChecks: number; export declare class BailError extends Error { } export declare let bailOut: boolean; export declare function bail(message: string): void; export declare class Test { readonly title: string; protected success: boolean; ended: boolean; protected assertions: number; protected firstNonSuccessMessage: string | undefined; protected firstNonSuccessStatus: 'error' | 'failed' | undefined; private iterativeTestingMode; private waitQueue; errorCommentFns: (() => string)[]; constructor(title: string); private addAssertion; protected trackError(message: string, extra?: any): void; private assertNotEnded; /** * Print a message that a check passed. */ pass(message?: string): void; /** * Print a message that a check has failed */ fail(message?: string, extra?: any): void; private _fail; /** * Report that the test has thrown an error. */ errorOut(message: string, extra?: any): void; /** * Check that **actual** is truthy. */ true(actual: any, message?: string): void; /** * Check that **actual** is truthy. */ ok(actual: any, message?: string): void; /** * Check that **actual** is falsy. */ false(actual: any, message?: string): void; /** * Check that **actual** is falsy. */ notOk(actual: any, message?: string): void; /** * Check that **actual** === **expected**. */ equal(actual: T, expected: T, message?: string): void; /** * Check that **actual** !== **expected**. */ notEqual(actual: T, expected: T, message?: string): void; /** * Check that **actual** is strict deep-equal to **expected**. * "Strict" means that leaf-nodes are compared with ===. * Maps and Sets are compared for content only - insertion order does not matter. */ deepEqual(actual: T, expected: T, message?: string): void; /** * Check that **actual** is not strict deep-equal to **expected**. * "Strict" means that leaf-nodes are compared with ===. * Maps and Sets are compared for content only - insertion order does not matter. */ notDeepEqual(actual: T, expected: T, message?: string): void; /** * Check that **actual** is loose deep-equal to **expected**. * "Loose" means that leaf-nodes are compared with ==. * Maps and Sets are compared for content only - insertion order does not matter. */ deepLooseEqual(actual: T, expected: T, message?: string): void; /** * Check that **actual** is not loose deep-equal to **expected**. * "Loose" means that leaf-nodes are compared with ==. * Maps and Sets are compared for content only - insertion order does not matter. */ notDeepLooseEqual(actual: T, expected: T, message?: string): void; /** * Check that **fn** throws an error. **expected** is a regexp that should * match the toString() of the error if specified. */ throws(fn: () => void, expected?: RegExp, message?: string): void; /** * Check that **fn** either * - does not throw an error or * - throws an error whose toString() does not match the **expected** regexp * * In other words, the check is ok if **fn** does not throw an error whose toString() * matches **regexp** */ doesNotThrow(fn: () => void, expected?: RegExp, message?: string): void; /** * Check that **actual** < **expected** */ lt(actual: T, expected: T, message?: string): void; /** * Check that **actual** <= **expected** */ lte(actual: T, expected: T, message?: string): void; /** * Check that **actual** > **expected** */ gt(actual: T, expected: T, message?: string): void; /** * Check that **actual** >= **expected** */ gte(actual: T, expected: T, message?: string): void; /** * Checks that **err** is falsy. If err is not falsy, * it reports a failure with the text from err.message */ error(err: any): void; /** * Logs a comment */ comment(message: string): void; /** * Include this comment in the output if * an assertion in the test errors or fails. * * Carries over from beforeEach to the actual test. * If a function is passed, the function will be executed * after the assertion has failed. */ errorComment(message: string | (() => string)): void; /** * Logs a message indicating that a check was skipped. */ skip(message: string): void; /** * Print a Bail out! message, skip all further tests and process.exit(1) */ bail(message?: string): void; private startIterativeTesting; private endIterativeTesting; private endTryUntil; private endPassUntil; private waitSuccess; private resetWait; /** * Try a test-function fn until all checks in fn succeeds or until * timeout expires. Wait interval ms between each invocation * of fn. * * If tryUntil times out without all checks succeeding, * it will abort the entire test()-case by throwing an exception * that is caught by purple-tape * * interval defaults to interval/30 but at least 100ms and at most 5s. */ tryUntil(fn: WaitFn, timeout: number, interval?: number): Promise; /** * Run a test-function fn over and over again and verify that all checks in fn succeeds * every time it runs. Wait interval ms between each invocation * of fn. * * passWhile exits after timeout ms or the first time that the fn in fn do not all pass. * passWhile will only add the result of the checks in the last invocation of fn * to the test output. * * interval defaults to interval/30 but at least 100ms and at most 5s. */ passWhile(fn: WaitFn, timeout: number, interval?: number): Promise; } export declare function smartInterval(timeout: number): number; export declare class TryUntilFailed extends Error { } export {};