dhuan/testbox: A fast test runner that works out of the box with zero dependencies. - dhuan/testbox

github.com · 2026-09-30 · by Long Nguyen ·github
A fast test runner that works out of the box with zero dependencies. - dhuan/testbox

dhuan/testbox

A fast test runner that works out of the box with zero dependencies. - dhuan/testbox

0 stars · 0 forks

README

testbox A fast test runner that works out of the box. Zero dependencies.

Tests are written in Lua (but you don't need Lua installed on your system) Batteries included for API testing

$ testbox - <<EOF test("just a test", function() expect_equal(2, 1 + 1) end)

test("this will fail!", function() expect_equal(1, 2) end) EOF

Prints out:

✅ just a test ❌ this will fail! Not equal! Left: 1 Right: 2 Installation If you have cargo/rust on your system: $ cargo install testbox

...

$ testbox --version Otherwise you can just download the compiled executable from the releases page. Examples Run your API server and fetch $ testbox - <<EOF test("API test: get users", function() exec_bg("cd path/to/my/app ; npm run dev", { wait = function(stdout, stderr) return string.match(stdout, "Server is ready") ~= nil end })

local response = fetch({ url = "http://localhost:3000/api/users", method = "GET", })

expect_equal(response.json.users[1].email, "someuser@example.com") end) EOF Test command-line tools testbox - <<EOF test("uppercase text with awk", function() expect_equal( exec([[echo foobar | awk '{print toupper($0)}']]).output, "FOOBAR", ) end) EOF Test Library The examples above use helper functions such as exec_bg and fetch. These functions are part of the Testbox Library, which you can learn more about here. License MIT

source

github.com · 94 links

Comments (0)

No comments yet