test: add comprehensive ts2lua-unreal TS/Lua 5.4 test suites and upgrade to v0.2.2

This commit is contained in:
szy73711 committed 2026-11-29 03:35:49 +08:00
1 parent ee2e62bb34
commit 3dd61c32a9
75 files changed
+9929 -10

No files matched your search

+38
View File
@@ -0,0 +1,38 @@
#!/usr/bin/env node
import * as path from "node:path";
import { spawnSync } from "node:child_process";
const tsRoot = path.resolve(import.meta.dirname, "..");
const luaRoot = path.resolve(tsRoot, "..", "lua");
const luaBin = ["lua5.4", "lua"].find((cmd) => {
const probe = spawnSync(cmd, ["-v"], { encoding: "utf8" });
return probe.status === 0 && /Lua 5\.4/.test((probe.stdout || "") + (probe.stderr || ""));
});
if (!luaBin) {
console.error("[run-tests] Lua 5.4 interpreter (lua5.4 / lua) not found in PATH.");
process.exit(1);
}
const luaPath = [
path.join(luaRoot, "?.lua"),
path.join(luaRoot, "?", "init.lua"),
process.env.LUA_PATH || "",
]
.filter(Boolean)
.join(";");
const code = `
package.path = ${JSON.stringify(luaPath)} .. ";" .. package.path
require("Tests.Harness.MockUnLuaRuntime").InstallIfNeeded()
_G.__TS2LUA_TEST_AUTO_RUN__ = true
require("Tests.RunAllTests")
`;
const result = spawnSync(luaBin, ["-e", code], {
stdio: "inherit",
cwd: luaRoot,
});
process.exit(result.status ?? 1);