import Macroable from '@poppinss/macroable'; import { Test } from '../test/main.ts'; import { type Emitter } from '../emitter.ts'; import { type Refiner } from '../refiner.ts'; import { Group } from '../group/main.ts'; import type { SuiteHooksHandler } from '../types.ts'; /** * The Suite class exposes the API to run a group of tests * or independent tests together as part of a suite. * * You can think of suites as * - unit tests suite * - e2e tests suites * - and so on * * @example * const suite = new Suite('unit', emitter) * const group = new Group('addition', emitter, refiner) * const test = new Test('2 + 2 = 4', emitter, refiner) * * suite.add(group) * group.add(test) * * // Runs all the tests inside the registered group * await suite.exec() */ export declare class Suite> extends Macroable { #private; name: string; /** * A collection of tests and groups both */ stack: (Test | Group)[]; /** * Know if one or more groups or tests within this suite * has failed. */ get failed(): boolean; constructor(name: string, emitter: Emitter, refiner: Refiner); /** * Add a test or a group to the execution stack */ add(testOrGroup: Test | Group): this; /** * Tap into each test and configure it */ onTest(callback: (test: Test) => void): this; /** * Tap into each group and configure it */ onGroup(callback: (group: Group) => void): this; /** * Enable/disable the bail mode. In bail mode, all * upcoming tests/group will be skipped when the current * test fails */ bail(toggle?: boolean): this; /** * Register a test setup function */ setup(handler: SuiteHooksHandler): this; /** * Register a test teardown function */ teardown(handler: SuiteHooksHandler): this; /** * Execute suite groups, tests and hooks */ exec(): Promise; }