Developer Tools

vtestrunner

Finds your test files and runs each one as its own process.

Released v1.0.0 · 2026-09-28
Import
use "stdlib/testrunner.ven"
vtestrunner.ven
print discover_tests("stdlib/tests", "test_vassert.ven")
:: ["stdlib/tests/test_vassert.ven"]
Reference (22 functions)

API reference

discover_tests(directory, pattern)

Finds every test file under directory matching pattern, sorted.

discover_tests("stdlib/tests", "test_vassert.ven")
:: ["stdlib/tests/test_vassert.ven"]

parse_crash_summary(stderr_text)

Pulls a bare error code and a human-readable message out of a crashed test's stderr.

parse_crash_summary("VENUTIAN ERROR \n\nDivision by zero. (line 1)")
:: {"code": "", "message": "Division by zero. (line 1)"}

run_one_test(venutian_binary, path)

Runs one test file end to end and gives back a result map, never raising.

run_one_test("bin/venutian", "stdlib/tests/test_vassert.ven")
:: {"path": "stdlib/tests/test_vassert.ven", "passed": yes, "elapsed_seconds": 0.072, "stdout": "..."}

run_test_suite(venutian_binary, directory, pattern)

Discovers and runs every test matching pattern under directory.

run_test_suite("bin/venutian", "stdlib/tests", "test_vassert.ven")
:: a one-element list; length(...) == 1

run_test_suite_filtered(venutian_binary, directory, pattern, name_contains)

Runs run_test_suite, keeping only the discovered paths that contain name_contains.

run_test_suite_filtered("bin/venutian", "stdlib/tests", "test_vassert.ven", "vassert")
:: a one-element list; length(...) == 1

passed_tests(results)

Filters results down to the ones that passed.

passed_tests([{"path": "a.ven", "passed": yes}, {"path": "b.ven", "passed": no}])
:: a one-element list containing only the "a.ven" result

failed_tests(results)

Filters results down to the ones that failed.

failed_tests([{"path": "a.ven", "passed": yes}, {"path": "b.ven", "passed": no}])
:: a one-element list containing only the "b.ven" result

pass_count(results)

Counts how many of results passed.

pass_count([{"path": "a.ven", "passed": yes}, {"path": "b.ven", "passed": no}])
:: 1

fail_count(results)

Counts how many of results failed.

fail_count([{"path": "a.ven", "passed": yes}, {"path": "b.ven", "passed": no}])
:: 1

total_elapsed(results)

Adds up every result's "elapsed_seconds" field.

total_elapsed([{"elapsed_seconds": 0.5}, {"elapsed_seconds": 1.5}])
:: 2.0

sorted_by_key_descending(rows, key_fn)

Sorts rows by key_fn(row), largest key first.

sorted_by_key_descending([3, 1, 2], make(x) give x)
:: [3, 2, 1]

slowest_tests(results, n)

Gives back the n slowest results, ranked by "elapsed_seconds".

slowest_tests([{"path": "a.ven", "elapsed_seconds": 0.01}, {"path": "b.ven", "elapsed_seconds": 0.07}], 1)
:: a one-element list containing only the "b.ven" result

all_passed(results)

Tests whether every one of results passed.

all_passed([{"path": "a.ven", "passed": yes}])
:: yes

summarize(results)

Builds a whole-suite summary map out of a list of test results.

summarize([{"path": "a.ven", "passed": yes, "elapsed_seconds": 0.07}, {"path": "b.ven", "passed": no, "elapsed_seconds": 0.01}])
:: {"total": 2, "passed": 1, "failed": 1, "total_elapsed_seconds": 0.08, "success": no}

short_name(path)

Gives back the last '/'-separated segment of path.

short_name("stdlib/tests/test_vassert.ven")
:: "test_vassert.ven"

format_number(value, digits)

Renders value as Text, rounded to digits decimal places.

format_number(1.23456, 2)
:: "1.23"

pad_right(text, width, fill)

Right-pads text with fill until it is at least width characters long.

pad_right("PASS", 6, " ")
:: "PASS  "

repeated_text(piece, count)

Repeats piece count times and concatenates the result.

repeated_text("ab", 3)
:: "ababab"

format_summary(summary)

Renders a suite summary map as one human-readable report line.

format_summary({"total": 2, "passed": 1, "failed": 1, "total_elapsed_seconds": 0.085})
:: "FAILED: 1/2 tests passed in 0.085s"

format_test_line(result)

Renders one test result as a single fixed-width report line.

format_test_line({"path": "stdlib/tests/test_vassert.ven", "passed": yes, "elapsed_seconds": 0.072})
:: "PASS  test_vassert.ven                0.072s"

format_failure_detail(result)

Renders one failed result's error code and message as an indented detail block.

format_failure_detail({"path": "does_not_exist_probe.ven", "error": {"code": "", "message": "\"does_not_exist_probe.ven\" does not exist. (line 58)"}})
::   does_not_exist_probe.ven:
::      "does_not_exist_probe.ven" does not exist. (line 58)

format_results(results, verbose)

Renders a full suite report: one line per test, then the summary, then optional failure detail.

format_results([{"path": "stdlib/tests/test_vassert.ven", "passed": yes, "elapsed_seconds": 0.072}], no)
:: "PASS  test_vassert.ven                0.072s\n\nPASSED: 1/1 tests passed in 0.072s"

Get notified when vtestrunner changes

Get notified about

New versions and security advisories.

New and updated packages, once a day.

News on the math model built in Venutian.