Register a test case.
@eryx/test Module
Summary
Classes
Functions
API Reference
Classes
Suite
Properties
Suite:beforeAll
Run once before all tests in this suite.
Suite:afterAll
Run once after all tests in this suite.
Suite:beforeEach
Run before each individual test.
Suite:afterEach
Run after each individual test.
Suite:run
Execute all tests in the suite and print results.
Parameters
Optional Lua pattern. When provided, only tests whose name matches the pattern are executed; the rest are skipped.
Print all tests on an accumulating single line
Returns
pass/fail/skip counts.
Functions
test.expect
test.skip
Unconditionally skips the current test. Call at the top of a test body to mark it as not-yet-implemented or temporarily disabled.
suite:test("future feature", function()
test.skip("not implemented yet")
end)
Parameters
Optional human-readable reason shown in the test output.
test.skipIf
Conditionally skips the current test when condition is truthy.
Use this for platform-specific tests, tests that require external
services, or environment-dependent checks.
suite:test("unix permissions", function()
test.skipIf(os.platform() == "windows", "unix-only test")
-- ... test code ...
end)
Parameters
test.runOne
Load and run a single .test.luau file.
Parameters
The path to the test file.
Run options (exitOnFail, filter).
test.runAll
Walk path recursively for files matching *.test.luau.
Each such file must return a Suite.
-- Run all tests:
test.runAll("tests/")
-- Run only tests with "crypto" in the name:
test.runAll("tests/", { filter = "crypto" })
Parameters
The directory to search for test files.
Run options (exitOnFail, filter).
Types
RunOptions
Exit the process with code 1 when any test fails. Defaults to true.
Lua pattern matched against test names. Only matching tests run;
the rest are skipped. Equivalent to Jest's -t / --testNamePattern.