Skip to content

gaslamp


Class: TestSuite

Collection of test cases with lifecycle hooks.

Used internally by describe() to group and execute tests.

Since

0.22.0

Constructors

Constructor

new TestSuite(name): TestSuite

Creates a new test suite.

Parameters

name

string

Suite name.

Returns

TestSuite

Methods

addTest()

addTest(description, testFn): void

Add a test case to the suite.

Parameters

description

string

Test description.

testFn

(expect) => void

Test function.

Returns

void


beforeAll()

beforeAll(fn): void

Register a setup function to run once before all tests.

Parameters

fn

() => void

Setup function.

Returns

void


afterAll()

afterAll(fn): void

Register a cleanup function to run once after all tests.

Parameters

fn

() => void

Cleanup function.

Returns

void


beforeEach()

beforeEach(fn): void

Register a function to run before each test.

Parameters

fn

() => void

Setup function.

Returns

void


afterEach()

afterEach(fn): void

Register a function to run after each test.

Parameters

fn

() => void

Cleanup function.

Returns

void


run()

run(): SuiteRunResult

Run all tests in the suite.

Returns

SuiteRunResult

Suite execution result.