japa
Version:
Lean test runner for Node.js
76 lines (75 loc) • 2.33 kB
TypeScript
/**
* @module SlimRunner
*/
import { Test } from '../Test';
import { Group } from '../Group';
import { Assert } from '../Assert';
import { ICallback, IConfigureOptions } from '../Contracts';
/**
* The type for the arguments to be passed to a
* test
*/
declare type TestArgs = [Assert, Function];
/**
* The type for the arguments to be passed to a
* hook
*/
declare type HookArgs = [Function];
/**
* Group instance exposed by slim runner
*/
declare type RunnerGroup = Pick<Group<TestArgs, HookArgs>, Exclude<keyof Group<TestArgs, HookArgs>, 'run' | 'toJSON' | 'test'>>;
/**
* Test instance exposed by slim runner
*/
declare type RunnerTest = Pick<Test<TestArgs>, Exclude<keyof Test<TestArgs>, 'run' | 'toJSON'>>;
/**
* Create a new test
*/
export declare function test(title: string, callback: ICallback<TestArgs>): RunnerTest;
/**
* Run all the tests using the runner
*/
export declare function run(exitProcess?: boolean): Promise<void>;
export declare namespace test {
/**
* Create a new test to group all test together
*/
function group(title: string, callback: (group: RunnerGroup) => void): void;
/**
* Only run the specified test
*/
function only(title: string, callback: ICallback<TestArgs>): RunnerTest;
/**
* Create a test, and mark it as skipped. Skipped functions are
* never executed. However, their hooks are executed
*/
function skip(title: string, callback: ICallback<TestArgs>): RunnerTest;
/**
* Create a test, and mark it as skipped only when running in CI. Skipped
* functions are never executed. However, their hooks are executed.
*/
function skipInCI(title: string, callback: ICallback<TestArgs>): RunnerTest;
/**
* Create a test and run it only in the CI.
*/
function runInCI(title: string, callback: ICallback<TestArgs>): RunnerTest;
/**
* Create regression test
*/
function failing(title: string, callback: ICallback<TestArgs>): RunnerTest;
/**
* Configure test runner
*/
function configure(options: Partial<IConfigureOptions>): void;
/**
* Nested only
*/
namespace failing {
/**
* Only run the specified test
*/
function only(title: string, callback: ICallback<TestArgs>): RunnerTest;
}
}
export {};