diff --git a/.lune/update_tools.luau b/.lune/update_tools.luau index cf639db..e2ae9b1 100644 --- a/.lune/update_tools.luau +++ b/.lune/update_tools.luau @@ -79,7 +79,7 @@ local BINS_SRC_DIR = pathfs.getAbsolutePathOf(pathfs.Path.from("bins")) for _, binSrc in pathfs.readDir(BINS_SRC_DIR) do local absPath = BINS_SRC_DIR:join(binSrc) - local testsPath = absPath:join("tests/init.spec.luau") + local testsPath = absPath:join("tests/run.luau") local binEntrypoint = absPath:join("init.luau") local manifestPath = absPath:join("pesde.toml") local readmePath = absPath:join("README.md") @@ -136,6 +136,21 @@ for _, binSrc in pathfs.readDir(BINS_SRC_DIR) do )}{newVersion}{stdio.style("reset")}` ) + -- Check if the tool has any tests, and run them if they do + if pathfs.isFile(testsPath) then + local success, result = pcall(require, testsPath:toString()) + if not success then + continue + end + + success, result = pcall(result, newVersion) + if not success then + continue + end + else + warn(`Unit tests not found for {binSrc}, assuming that they pass`) + end + -- HACK: To prevent messing with our existing toml ordering and formatting -- we just replace the old version field string with the new version field -- string @@ -171,18 +186,6 @@ for _, binSrc in pathfs.readDir(BINS_SRC_DIR) do pathfs.writeFile(manifestPath, updatedManifest) end - - -- Check if the tool has any tests, and run them if they do - if pathfs.isFile(testsPath) then - local success, result = pcall(require, testsPath:toString()) - if not success then - warn(`Rollbacking tool {binSrc} version due failed tests:`, result) - pathfs.writeFile(manifestPath, manifestContents) - continue - end - else - warn(`Unit tests not found for {binSrc}, assuming that they pass`) - end end -- Fetch README for the tool repo, if present diff --git a/bins/zap/tests/run.luau b/bins/zap/tests/run.luau index a4eb52d..6fb04b0 100644 --- a/bins/zap/tests/run.luau +++ b/bins/zap/tests/run.luau @@ -2,7 +2,7 @@ local toolchainlib = require("../lune_packages/core") local process = require("@lune/process") local fs = require("@lune/fs") --- not working, needing support +return function(version) -- process.args = { "bins/zap/tests/input.zap" } local success, err = pcall(require, "bins/zap/init.luau") @@ -10,3 +10,4 @@ assert(success, `failed to execute zap: {err}`) assert(fs.isFile("tests/output/client.luau"), `invalid output`) assert(fs.isFile("tests/output/server.luau"), `invalid output`) +end