Skip to main content
Magnitude tests are defined using the globally available test function imported from magnitude-test.

test(title, options?, testFn)

Defines a new test case.
string
required
A descriptive title for the test case. This title appears in test reports and logs.
object
Optional configuration specific to this test case.
(agent) => Promise<void>
required
An asynchronous function containing the test logic. It receives an agent object with the properties described below.

test.group(id, options?, groupFn)

Defines a group of test cases, allowing shared options (like url) to be applied to all tests within the group.
string
required
A descriptive identifier for the test group.
object
Optional configuration applied to all tests within this group. See properties below.
() => void
required
A synchronous function that contains the test() declarations belonging to this group.