The three functionsDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Octopodo/kt-testing-suite-core/llms.txt
Use this file to discover all available pages before exploring further.
describe, it, and getSuites form the structural backbone of every test file. describe organises related tests under a named block, it registers an individual test case within that block, and getSuites retrieves the global list of all root suites so the runner can execute them. Suites are stored in a module-level array and persist for the lifetime of the script—calling describe multiple times simply appends to that list.
Type Definitions
Before diving into the functions, it helps to understand the core types they operate on.describe()
fn. Any it(), beforeEach(), afterEach(), beforeAll(), or afterAll() calls made during the synchronous execution of fn are registered on that suite. Nested describe calls are supported and produce child suites linked via the parent / children references on Suite.
Only root-level suites (those not nested inside another describe) are pushed into the global suites array that getSuites() returns. Child suites are reachable through the root’s children tree.
A human-readable label for the test suite. Appears in reporter output and is concatenated with child suite descriptions to build the full test name used for filtering.
A synchronous callback in which you register tests and hooks. The function is called immediately and must not be async.
Example
Nesting describe blocks
The
fn callback is executed synchronously at the point describe is called. All suite registration happens at script parse time, before the runner is invoked.it()
tests array and run later by the TestRunner.
The label for this test case. Combined with all ancestor suite descriptions (space-separated) to form the full test name that appears in reporter output and is matched against the runner’s filter string.
The synchronous function that contains assertions. If this function throws any error the test is marked as failed; if it returns normally the test is marked as passed.
Example
getSuites()
Suite objects registered so far. This is the same array that runTests() uses by default when no explicit suite list is provided.
getSuites() returns a live reference to the internal array. Suites are appended each time a top-level describe() executes. Typically you call this once at the end of your test file, after all describe blocks have been defined.Return Value
Suite[]
An array of root
Suite objects. Each suite may have nested child suites accessible via the children property. The array is ordered by registration time (first describe first).