@compas/cli
Version:
CLI containing utilities and simple script runner
74 lines (73 loc) • 1.9 kB
TypeScript
/**
* Mutate the global areTestsRunning
*
* @param {boolean} running
*/
export function setAreTestRunning(running: boolean): void;
/**
* Set the test logger
*
* @param {import("@compas/stdlib").Logger} logger
*/
export function setTestLogger(logger: import("@compas/stdlib").Logger): void;
/**
* @typedef {object} TestAssertion
* @property {string} type
* @property {boolean} passed
* @property {{
* actual: boolean
* }|{
* actual?: any,
* expected?: any,
* message?: string
* }|undefined} meta
* @property {string|undefined} [message]
*/
/**
* @typedef {(t: import("../../types/advanced-types.js").TestRunner) =>
* (void|any|Promise<any>)} TestCallback
*/
/**
* @typedef {object} TestState
* @property {TestState|undefined} [parent]
* @property {boolean|undefined} [hasFailure]
* @property {string} name
* @property {TestCallback|undefined} [callback]
* @property {Array<TestAssertion>} assertions
* @property {Array<TestState>} children
* @property {Error|undefined} [caughtException]
*/
/**
* @type {import("@compas/stdlib").Logger}
*/
export let testLogger: import("@compas/stdlib").Logger;
/**
* @type {boolean}
*/
export let areTestsRunning: boolean;
/**
* @type {TestState}
*/
export const state: TestState;
export type TestAssertion = {
type: string;
passed: boolean;
meta: {
actual: boolean;
} | {
actual?: any;
expected?: any;
message?: string;
} | undefined;
message?: string | undefined;
};
export type TestCallback = (t: import("../../types/advanced-types.js").TestRunner) => (void | any | Promise<any>);
export type TestState = {
parent?: TestState | undefined;
hasFailure?: boolean | undefined;
name: string;
callback?: TestCallback | undefined;
assertions: Array<TestAssertion>;
children: Array<TestState>;
caughtException?: Error | undefined;
};