API Reference¶
Wisp's public surface is four modules and one set of exported types. Everything is reachable from the main module; the classes are also requirable directly.
Pages¶
Symbols¶
Wisp¶
| Symbol | Kind | Signature | Description |
|---|---|---|---|
Wisp.assume |
function | (value: any) -> Assertion |
Wraps a value in an Assertion. |
Wisp.suite |
function | (name: string) -> Suite |
Creates a suite and registers it. |
Wisp |
callable | () -> ({number}, {number}) |
Runs the default runner, prints, returns the tallies. |
Suite¶
| Symbol | Kind | Signature | Description |
|---|---|---|---|
Suite.new |
function | (name: string, runner: Runner) -> Suite |
Constructs a suite and registers it. |
Suite:action |
method | (name: string, func: () -> ()) -> Suite |
Appends an action. Returns the suite. |
Suite:run |
method | (reporter: Reporter) -> () |
Runs every action, reporting each result. |
Runner¶
| Symbol | Kind | Signature | Description |
|---|---|---|---|
Runner.new |
function | () -> Runner |
Constructs an empty runner. |
Runner:registerSuite |
method | (suite: Suite) -> () |
Registers a suite. Ignored if the name is taken. |
Runner:pass |
method | (suiteName: string, actionName: string) -> () |
Records a passing action. |
Runner:fail |
method | (suiteName: string, actionName: string, message: string) -> () |
Records a failure. |
Runner:run |
method | () -> ({number}, {number}) |
Runs all registered suites, prints, returns the tallies. |
Runner:_report |
method | (elapsedSeconds: number) -> ({number}, {number}) |
Prints the report, returns the tallies. Internal. |
Assertion¶
| Symbol | Kind | Signature | Description |
|---|---|---|---|
Assertion.new |
function | (expression: any) -> Assertion |
Constructs an assertion. |
Assertion:equalsTo |
method | (expected: any) -> () |
Asserts expression == expected. |
Assertion:notEqualsTo |
method | (expected: any) -> () |
Asserts expression ~= expected. |
Assertion:isTrue |
method | () -> () |
Asserts expression == true. |
Assertion:isFalse |
method | () -> () |
Asserts expression == false. |
Assertion:isNil |
method | () -> () |
Asserts expression == nil. |
Assertion:isNotNil |
method | () -> () |
Asserts expression ~= nil. |
Assertion:isNaN |
method | () -> () |
Asserts math.isnan(expression). |
Assertion:isInf |
method | () -> () |
Asserts math.isinf(expression). |
Assertion:isFinite |
method | () -> () |
Asserts math.isfinite(expression). |
Assertion:isType |
method | (expectedType: string) -> () |
Asserts typeof(expression) == expectedType. |
Assertion:throws |
method | () -> () |
Asserts the function raises when called. |
Assertion:notThrows |
method | () -> () |
Asserts the function returns when called. |
Assertion:contains |
method | (value: any) -> () |
Asserts a substring or table value is present. |
Assertion:notContains |
method | (value: any) -> () |
The inverse of contains. |
Full semantics and failure messages are on the Assertion page.
Module paths¶
Assuming the repository root is what got mapped, so that wisp/ contains init.luau and
src/:
| Module | Path |
|---|---|
Wisp |
wisp |
Suite |
wisp/src/classes/Suite |
Runner |
wisp/src/classes/Runner |
Assertion |
wisp/src/classes/Assertion |
| Types | wisp/src/types.d |
If you mapped things differently, adjust the prefix — the class modules live in
src/classes/ either way.
Conventions¶
Assertions raise; they do not return. No method returns a boolean or an Assertion
for chaining. Each one either returns nothing (the assertion held) or calls
error(message, 2). Level 2 means the reported location is the assertion line, not a
line inside Wisp.
Only the run functions return anything. Runner:run, Runner:_report, and calling
Wisp each return ({number}, {number}) — the passed and total tallies, described in
Return values. Every other function and method in the surface
returns nothing. Wisp still never calls os.exit, so a failing run exits 0 unless you
branch on the tallies yourself.
Actions are protected, reporters are not. Suite:run wraps each action in pcall, so
one failure never aborts the rest. An error raised by the reporter is not caught and
propagates to the caller.
Underscore-prefixed fields are internal. _name, _actions, _expression,
_suites, _stats, and _report are internal by convention. Runner._stats is the one
place the guides read them directly; there is no stability guarantee across versions.
Types are available to tooling. Wisp ships --!strict source and exports its types
from types.d.luau, so an LSP infers Suite and Assertion without annotations. See
Types.
Next¶
- Advanced Usage — driving the runner yourself.