UNPKG

2.33 kBTypeScriptView Raw
1/**
2 * @module SlimRunner
3 */
4import { Test } from '../Test';
5import { Group } from '../Group';
6import { Assert } from '../Assert';
7import { ICallback, IConfigureOptions } from '../Contracts';
8/**
9 * The type for the arguments to be passed to a
10 * test
11 */
12declare type TestArgs = [Assert, Function];
13/**
14 * The type for the arguments to be passed to a
15 * hook
16 */
17declare type HookArgs = [Function];
18/**
19 * Group instance exposed by slim runner
20 */
21declare type RunnerGroup = Pick<Group<TestArgs, HookArgs>, Exclude<keyof Group<TestArgs, HookArgs>, 'run' | 'toJSON' | 'test'>>;
22/**
23 * Test instance exposed by slim runner
24 */
25declare type RunnerTest = Pick<Test<TestArgs>, Exclude<keyof Test<TestArgs>, 'run' | 'toJSON'>>;
26/**
27 * Create a new test
28 */
29export declare function test(title: string, callback: ICallback<TestArgs>): RunnerTest;
30/**
31 * Run all the tests using the runner
32 */
33export declare function run(exitProcess?: boolean): Promise<void>;
34export declare namespace test {
35 /**
36 * Create a new test to group all test together
37 */
38 function group(title: string, callback: (group: RunnerGroup) => void): void;
39 /**
40 * Only run the specified test
41 */
42 function only(title: string, callback: ICallback<TestArgs>): RunnerTest;
43 /**
44 * Create a test, and mark it as skipped. Skipped functions are
45 * never executed. However, their hooks are executed
46 */
47 function skip(title: string, callback: ICallback<TestArgs>): RunnerTest;
48 /**
49 * Create a test, and mark it as skipped only when running in CI. Skipped
50 * functions are never executed. However, their hooks are executed.
51 */
52 function skipInCI(title: string, callback: ICallback<TestArgs>): RunnerTest;
53 /**
54 * Create a test and run it only in the CI.
55 */
56 function runInCI(title: string, callback: ICallback<TestArgs>): RunnerTest;
57 /**
58 * Create regression test
59 */
60 function failing(title: string, callback: ICallback<TestArgs>): RunnerTest;
61 /**
62 * Configure test runner
63 */
64 function configure(options: Partial<IConfigureOptions>): void;
65 /**
66 * Nested only
67 */
68 namespace failing {
69 /**
70 * Only run the specified test
71 */
72 function only(title: string, callback: ICallback<TestArgs>): RunnerTest;
73 }
74}
75export {};