UNPKG

@japa/runner

Version:

A simple yet powerful testing framework for Node.js

41 lines (40 loc) 1.55 kB
import type { TestExecutor } from '@japa/core/types'; import type { Config } from './src/types.js'; import { Group, Test, TestContext } from './modules/core/main.js'; type OmitFirstArg<F> = F extends [_: any, ...args: infer R] ? R : never; /** * Create a Japa test. Defining a test without the callback * will create a todo test. */ export declare function test(title: string, callback?: TestExecutor<TestContext, undefined>): Test<undefined>; export declare namespace test { var group: (title: string, callback: (group: Group) => void) => Group; var macro: <T extends (test: Test, ...args: any[]) => any>(callback: T) => (...args: OmitFirstArg<Parameters<T>>) => ReturnType<T>; } /** * Get the test of currently running test */ export declare function getActiveTest(): Test<any> | undefined; /** * Get the test of currently running test or throw an error */ export declare function getActiveTestOrFail(): Test<any>; /** * Make Japa process command line arguments. Later the parsed output * will be used by Japa to compute the configuration */ export declare function processCLIArgs(argv: string[]): void; /** * Configure the tests runner with inline configuration. You must * call configure method before the run method. * * Do note: The CLI flags will overwrite the options provided * to the configure method. */ export declare function configure(options: Config): void; /** * Execute Japa tests. Calling this function will import the test * files behind the scenes */ export declare function run(): Promise<void>; export {};