Verified Commit 601fbe26 authored by WorldTeacher's avatar WorldTeacher
Browse files

fix(tests): enhance Lua test coverage reporting and setup

parent a6b74559
Loading
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -87,6 +87,7 @@ lua-tests:
      "$LUAROCKS_BIN" --lua-version=5.4 install luasec
      "$LUAROCKS_BIN" --lua-version=5.4 install busted
      "$LUAROCKS_BIN" --lua-version=5.4 install luacov
      eval "$($LUAROCKS_BIN --lua-version=5.4 path)"
    - |
      cat > /tmp/random.lua <<'EOF'
      local random = {}
@@ -108,10 +109,10 @@ lua-tests:

      return random
      EOF
      export LUA_PATH="/tmp/?.lua;;"
      export LUA_PATH="/tmp/?.lua;${LUA_PATH:-;;}"
  script:
    - echo "Running Lua test suite"
    - busted --output utfTerminal --pattern "_spec%.lua$" test
    - busted --coverage --output utfTerminal --pattern "_spec%.lua$" test
    - luacov
  artifacts:
    when: always
+6 −1
Original line number Diff line number Diff line
@@ -22,10 +22,15 @@ if ! command -v luacov-cobertura &>/dev/null; then
    exit 1
fi

LUAROCKS_BIN="$(command -v luarocks-5.4 || command -v luarocks || true)"
if [ -n "${LUAROCKS_BIN:-}" ]; then
    eval "$($LUAROCKS_BIN --lua-version=5.4 path 2>/dev/null || $LUAROCKS_BIN path)"
fi

rm -f luacov.stats.out luacov.report.out coverage.xml

echo "Running Busted test suite"
busted --output utfTerminal --pattern "_spec%.lua$" test
busted --coverage --output utfTerminal --pattern "_spec%.lua$" test

echo "Generating luacov text report"
luacov