UNPKG

1.67 kBTypeScriptView Raw
1/**
2 * A function defining a new test case or a test suite, e.g. `it` or `describe`.
3 */
4export type TestDefinition<ARGS extends unknown[], RETVAL> = (name: string, ...args: ARGS) => RETVAL;
5/**
6 * Helper function for skipping tests when a certain condition is met.
7 *
8 * @example
9 * ```ts
10 * skipIf(
11 * !features.freeFormProperties,
12 * describe,
13 * 'free-form properties (strict: false)',
14 * () => {
15 * // the tests
16 * }
17 * );
18 * ```
19 *
20 * @param skip - Should the test case/suite be skipped?
21 * @param verb - The function to invoke to define the test case or the test
22 * suite, e.g. `it` or `describe`.
23 * @param name - The test name (the first argument of `verb` function).
24 * @param args - Additional arguments (framework specific), typically a function
25 * implementing the test.
26 */
27export declare function skipIf<ARGS extends unknown[], RETVAL>(skip: boolean, verb: TestDefinition<ARGS, RETVAL> & {
28 skip: TestDefinition<ARGS, RETVAL>;
29}, name: string, ...args: ARGS): RETVAL;
30/**
31 * Helper function for skipping tests on Travis CI.
32 *
33 * @example
34 *
35 * ```ts
36 * skipOnTravis(it, 'does something when some condition', async () => {
37 * // the test
38 * });
39 * ```
40 *
41 * @param verb - The function to invoke to define the test case or the test
42 * suite, e.g. `it` or `describe`.
43 * @param name - The test name (the first argument of `verb` function).
44 * @param args - Additional arguments (framework specific), typically a function
45 * implementing the test.
46 */
47export declare function skipOnTravis<ARGS extends unknown[], RETVAL>(verb: TestDefinition<ARGS, RETVAL> & {
48 skip: TestDefinition<ARGS, RETVAL>;
49}, name: string, ...args: ARGS): RETVAL;