@averagehelper/corde
Version:
A simple library for Discord bot tests. (Republished fork to demonstrate a bugfix)
67 lines (66 loc) • 2.39 kB
TypeScript
import { AssertionProps, Group, Test, testFunctionType } from "../types";
import { Queue } from "../utils";
/**
* Contain all information of data collected from files in runtime test
* collection.
*/
declare class TestCollector {
/**
* Defines if the system is collecting tests assertions from a file
* @description This is used to tell node process the type of process that is
* existing.
*/
isCollecting: boolean;
/**
* Defines if the thread running has a **group** function.
*/
hasGroup: boolean;
/**
* Defines if the thread running has a **test** function.
*/
hasTest: boolean;
/**
* List of assertions found in running file.
* @description Assertions are the minor type of object in
* position tree, but being the most important of all them.
*/
assertions: AssertionProps[];
/**
* List of tests found in running file.
* @description Tests are the second in position of objects,
* all tests are encapsulated inside groups in the end of processing.
*/
tests: Test[];
/**
* List of groups found in running file.
*
* @description Groups are the major object of the thread,
* all tests and assertions are converted encapsulated in this in the end,
* but not necessary all assertions need a group or a test, that is why
* group name are optional
*/
groups: Group[];
beforeStartFunctions: Queue<VoidFunction>;
afterAllFunctions: Queue<VoidFunction>;
beforeEachFunctions: Queue<VoidFunction>;
afterEachFunctions: Queue<VoidFunction>;
testsFunctions: testFunctionType[];
isolatedFunctions: testFunctionType[];
private testClousureFunction;
private groupClousureFunction;
constructor();
addTestFunction(testFunction: testFunctionType): void;
hasTestFunctions(): boolean;
hasIsolatedTestFunctions(): boolean;
cloneTestFunctions(): testFunctionType[];
cloneIsolatedTestFunctions(): testFunctionType[];
clearTestFunctions(): void;
clearIsolatedTestFunctions(): void;
cleanAll(): void;
addToGroupClousure(fn: () => void | Promise<void>): void;
executeGroupClojure(): Promise<void>;
addToTestClousure(fn: () => void | Promise<void>): void;
executeTestClojure(): Promise<void>;
}
declare const testCollector: TestCollector;
export { testCollector };