tested is a new unit testing framework that can be used for Lua and Teal unit tests. It is designed to be modern and generate an easy-to-read output that helps you quickly identify and help to resolve a faililng test!
Full Docs: https://fouriertransformer.github.io/tested
luarocks install testedAfter installing, the tested module will be available to your Lua code with require("tested") and a CLI tool, also called tested will be installed wherever your LuaRocks installs executables.
local tested = require("tested")
local tinytoml = require("tinytoml")
local t = tested.new()
t:test("encode date as string", function()
local date_toml = [[offset_datetime = 1979-05-27T07:32:00Z
local_datetime = 1979-05-27T07:32:00
local_time = 07:32:00
local_date = 1979-05-27]]
local expected = {
offset_datetime = "1979-05-27T07:32:00Z",
local_datetime = "1979-05-27T07:32:00",
local_time = "07:32:00",
local_date = "1979-05-27"
}
local parsed_dates = tinytoml.parse(date_toml, {load_from_string=true, parse_datetime_as="string"})
tested.assert({given="toml with dates", should="parse dates as strings", expected=expected, actual=parsed_dates})
end)
--- as many other tests as you want
return tRunning the tests are as simple as placing the file in a tests folder and then running the CLI command tested (which should be installed from LuaRocks). It will go through the tests folder, find each file matching the *_test.lua (or *_test.tl file), and run it through the test framework. It also doesn't matter if the test is written in Lua or Teal, tested is able to load and run both!
You can see more tests in this repo's tests folder!
As of 9/2026, AI will no longer be used to implement any parts of tested. It may be used to aid in research or debugging (particularly with issues at the OS level). PRs/Issues should be written by humans.
AI was used between versions 0.1.0 and 0.3.0 to help implement some features, research Lua/Teal internals, debug issues, and make more readable output. PRs during those times indicate what work was done by an AI. Before 0.1.0, the code was hand-written, but some research was done with the help of AI.
The docs have always been and will always be hand written.
Apart from dependencies specified in the rockspec, parts of the following are included in the source code present in this repo:
- Bundles a slightly modified inspect.lua for table diffing and viewing - MIT
- Also bundles a slightly modified ansicolors.lua - MIT
- A function from Luacov code to help merge stats files in process - MIT
- Bundles dkjson.lua's encoder for writing test output as JSON - MIT
- Bundles a polyfill for
package.searchpathfor Lua 5.1 from Penlight - MIT - Uses a modified LuaRocks test loader to support
luarocks test- MIT
Major thanks to hishamhm, kikito, and benoit-germain for their work in the Lua space. Without them, tested wouldn't be possible.