Skip to content

Commit

Permalink
Add verbose flag for test runner
Browse files Browse the repository at this point in the history
  • Loading branch information
novafacing committed Mar 1, 2025
1 parent 4830fbc commit a8f49d5
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions build.moon
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ class SeleneBuild

return rv

test: (patterns) =>
test: (patterns, verbose) =>
rv = OK
for _, pattern in ipairs patterns
print("Running tests with pattern #{pattern}")
Expand All @@ -189,6 +189,7 @@ class SeleneBuild
status = result\close!
if not status
rv = ERR
if not status or verbose
print(output)

if rv == ERR
Expand All @@ -204,10 +205,11 @@ main = (arg) ->
argparse = require("argparse")
parser = argparse("build", "Build a Selene project")
parser\argument("src", "Source directory")
parser\flag("-c --clean", "Clean the build directory (remove lua build files)")\args("?")
parser\flag("-d --dist", "Build a distribution and remove all moonscript files after building")\args("?")
parser\flag("-y --yes", "Answer yes to all prompts. THIS MAY BE DANGEROUS!")\args("?")
parser\flag("-t --test", "Run tests")\args("?")
parser\flag("-c --clean", "Clean the build directory (remove lua build files)")
parser\flag("-d --dist", "Build a distribution and remove all moonscript files after building")
parser\flag("-y --yes", "Answer yes to all prompts. THIS MAY BE DANGEROUS!")
parser\flag("-t --test", "Run tests")
parser\flag("-v --verbose", "Run tests")
parser\option("-p --pattern", "Pattern(s) to use to search for test files")\args("+")\default("Test.+%.moon")\defmode("u")
args = parser\parse(arg)

Expand All @@ -220,7 +222,7 @@ main = (arg) ->
rv = OK

if args["test"]
rv = build\test(args["pattern"])
rv = build\test(args["pattern"], args["verbose"])
elseif args["clean"]
rv = build\clean!
elseif args["dist"]
Expand Down

0 comments on commit a8f49d5

Please sign in to comment.