import Macroable from '@poppinss/macroable'; import { type Test } from '../test/main.ts'; import { type Refiner } from '../refiner.ts'; import { type Emitter } from '../emitter.ts'; import type { GroupHooksHandler, TestHooksHandler, GroupOptions } from '../types.ts'; /** * Group class exposes an API to group multiple tests together * and bulk configure them. * * NOTE: Nested groups are not supported on purpose. * * @example * const group = new Group('addition', emitter, refiner) * const test = new Test('2 + 2 = 4', emitter, refiner) * * group.add(test) * await group.exec() */ export declare class Group> extends Macroable { #private; title: string; /** * Know if one or more tests/hooks within this group * has failed. */ get failed(): boolean; options: GroupOptions; /** * An array of tests registered under the given group */ tests: Test[]; /** * Shortcut methods to configure tests */ each: { setup: (handler: TestHooksHandler) => void; teardown: (handler: TestHooksHandler) => void; timeout: (timeout: number) => void; retry: (retries: number) => void; skip: (skip?: boolean | (() => Promise | boolean), skipReason?: string) => void; disableTimeout: () => void; }; constructor(title: string, emitter: Emitter, refiner: Refiner); /** * Enable/disable the bail mode. In bail mode, all * upcoming tests will be skipped when the current * test fails */ bail(toggle?: boolean): this; /** * Add a test to the group. Adding a test to the group * mutates the test properties */ add(test: Test): this; /** * Tap into each test and configure it */ tap(callback: (test: Test) => void): this; /** * Define setup hook for the group */ setup(handler: GroupHooksHandler): this; /** * Define teardown hook for the group */ teardown(handler: GroupHooksHandler): this; /** * Execute group hooks and tests */ exec(): Promise; }