chore(lune): include frktest-powered test runner

This commit is contained in:
Erica Marigold 2024-11-04 12:18:00 +05:30 committed by GitHub
parent 9871570c66
commit b6d006e1bc

24
.lune/test.luau Normal file
View file

@ -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