From b6d006e1bc26e3cb6f27be5d7563ab606eff24d9 Mon Sep 17 00:00:00 2001 From: Erica Marigold Date: Mon, 4 Nov 2024 12:18:00 +0530 Subject: [PATCH] chore(lune): include frktest-powered test runner --- .lune/test.luau | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .lune/test.luau diff --git a/.lune/test.luau b/.lune/test.luau new file mode 100644 index 0000000..bbe400e --- /dev/null +++ b/.lune/test.luau @@ -0,0 +1,24 @@ +--> Run tests using frktest runner + +local fs = require("@lune/fs") +local process = require("@lune/process") + +local frktest = require("@pkg/frktest") + +-- HACK: Cast require to allow for dynamic paths in strict mode +-- A more proper solution would be to use luau.load instead, but +-- frktest requires its global state to be modified by test suites +local require = require :: (path: string) -> () -> () + +if process.args[1] ~= nil then + require("../tests/" .. process.args[1])() +else + for _, test in fs.readDir("tests") do + require("../tests/" .. test)() + end +end + +frktest.reporters.lune.init() +if not frktest.core.run() then + process.exit(1) +end